Classification Model Validation Tutorial#

In this tutorial, you will learn how to validate your classification model using deepchecks test suites. You can read more about the different checks and suites for computer vision use cases at the examples section

A classification model is usually used to classify an image into one of a number of classes. Although there are multi label use-cases, in which the model is used to classify an image into multiple classes, most use-cases require the model to classify images into a single class. Currently deepchecks supports only single label classification (either binary or multi-class).

Defining the data and model#

# Importing the required packages

import os
import urllib.request
import zipfile

import albumentations as A
import matplotlib.pyplot as plt
import numpy as np
import PIL.Image
import torch
import torchvision
from albumentations.pytorch import ToTensorV2
from torch import nn
from torchvision import transforms
from torchvision.datasets import ImageFolder

from deepchecks.vision.classification_data import ClassificationData

Downloading the dataset#

The data is available from the torch library. We will download and extract it to the current directory.

url = 'https://download.pytorch.org/tutorial/hymenoptera_data.zip'
urllib.request.urlretrieve(url, 'hymenoptera_data.zip')

with zipfile.ZipFile('hymenoptera_data.zip', 'r') as zip_ref:
    zip_ref.extractall('.')

Load Data#

We will use torchvision and torch.utils.data packages for loading the data. The model we are building will learn to classify ants and bees. We have about 120 training images each for ants and bees. There are 75 validation images for each class. This dataset is a very small subset of imagenet.

class AntsBeesDataset(ImageFolder):
    def __init__(self, *args, **kwargs):
        """
        Overrides initialization method to replace default loader with OpenCV loader
        :param args:
        :param kwargs:
        """
        super(AntsBeesDataset, self).__init__(*args, **kwargs)

    def __getitem__(self, index: int):
        """
        overrides __getitem__ to be compatible to albumentations
        Args:
            index (int): Index
        Returns:
            tuple: (sample, target) where target is class_index of the target class.
        """
        path, target = self.samples[index]
        sample = self.loader(path)
        sample = self.get_cv2_image(sample)
        if self.transforms is not None:
            transformed = self.transforms(image=sample, target=target)
            sample, target = transformed["image"], transformed["target"]
        else:
            if self.transform is not None:
                sample = self.transform(image=sample)['image']
            if self.target_transform is not None:
                target = self.target_transform(target)

        return sample, target

    def get_cv2_image(self, image):
        if isinstance(image, PIL.Image.Image):
            image_np = np.array(image).astype('uint8')
            return image_np
        elif isinstance(image, np.ndarray):
            return image
        else:
            raise RuntimeError("Only PIL.Image and CV2 loaders currently supported!")

# Just normalization for validation
data_transforms = transforms.Compose([
        transforms.Resize(256),
        transforms.CenterCrop(224),
        transforms.ToTensor(),
        transforms.Normalize([0.485, 0.456, 0.406], [0.229, 0.224, 0.225])
    ])

data_dir = 'hymenoptera_data'
# Just normalization for validation
data_transforms = A.Compose([
    A.Resize(height=256, width=256),
    A.CenterCrop(height=224, width=224),
    A.Normalize(mean=(0.485, 0.456, 0.406), std=(0.229, 0.224, 0.225)),
    ToTensorV2(),
])
train_dataset = AntsBeesDataset(root=os.path.join(data_dir,'train'))
train_dataset.transforms = data_transforms

val_dataset = AntsBeesDataset(root=os.path.join(data_dir,'val'))
val_dataset.transforms = data_transforms

dataloaders = {
    'train':torch.utils.data.DataLoader(train_dataset, batch_size=4,
                                                shuffle=True),
    'val': torch.utils.data.DataLoader(val_dataset, batch_size=4,
                                                shuffle=True)
}

class_names = ['ants', 'bees']

device = torch.device("cuda:0" if torch.cuda.is_available() else "cpu")

Visualize a Few Images#

Let’s visualize a few training images so as to understand the data augmentation.

def imshow(inp, title=None):
    """Imshow for Tensor."""
    inp = inp.numpy().transpose((1, 2, 0))
    mean = np.array([0.485, 0.456, 0.406])
    std = np.array([0.229, 0.224, 0.225])
    inp = std * inp + mean
    inp = np.clip(inp, 0, 1)
    plt.imshow(inp)
    if title is not None:
        plt.title(title)
    plt.pause(0.001)  # pause a bit so that plots are updated


# Get a batch of training data
inputs, classes = next(iter(dataloaders['train']))

# Make a grid from batch
out = torchvision.utils.make_grid(inputs)

imshow(out, title=[class_names[x] for x in classes])
['ants', 'ants', 'bees', 'bees']Ants and Bees

Downloading a pre-trained model#

Now, we will download a pre-trained model from torchvision, that was trained on the ImageNet dataset.

model = torchvision.models.resnet18(pretrained=True)
num_ftrs = model.fc.in_features
# We have only 2 classes
model.fc = nn.Linear(num_ftrs, 2)
model = model.to(device)
_ = model.eval()
Downloading: "https://download.pytorch.org/models/resnet18-f37072fd.pth" to /home/runner/.cache/torch/hub/checkpoints/resnet18-f37072fd.pth

  0%|          | 0.00/44.7M [00:00<?, ?B/s]
 16%|#5        | 7.07M/44.7M [00:00<00:00, 74.1MB/s]
 37%|###7      | 16.7M/44.7M [00:00<00:00, 89.9MB/s]
 58%|#####8    | 26.1M/44.7M [00:00<00:00, 93.6MB/s]
 79%|#######8  | 35.2M/44.7M [00:00<00:00, 94.5MB/s]
100%|#########9| 44.6M/44.7M [00:00<00:00, 95.7MB/s]
100%|##########| 44.7M/44.7M [00:00<00:00, 93.3MB/s]

Validating the Model with Deepchecks#

Now, after we have the training data, validation data and the model, we can validate the model with deepchecks test suites.

Visualize the data loader and the model outputs#

First we’ll make sure we are familiar with the data loader and the model outputs.

batch = next(iter(dataloaders['train']))

print("Batch type is: ", type(batch))
print("First element is: ", type(batch[0]), "with len of ", len(batch[0]))
print("Example output of an image shape from the dataloader ", batch[0][0].shape)
print("Image values", batch[0][0])
print("-"*80)

print("Second element is: ", type(batch[1]), "with len of ", len(batch[1]))
print("Example output of a label shape from the dataloader ", batch[1][0].shape)
print("Image values", batch[1][0])
Batch type is:  <class 'list'>
First element is:  <class 'torch.Tensor'> with len of  4
Example output of an image shape from the dataloader  torch.Size([3, 224, 224])
Image values tensor([[[ 0.10831,  0.10831,  0.09119,  ...,  0.81043,  0.84468,  0.87893],
         [ 0.22819,  0.19394,  0.17681,  ...,  0.77618,  0.82755,  0.86180],
         [ 0.26244,  0.26244,  0.29669,  ...,  0.82755,  0.82755,  0.84468],
         ...,
         [ 0.22819,  0.15969,  0.15969,  ...,  0.72481,  0.75905,  0.81043],
         [ 0.15969,  0.15969,  0.14256,  ...,  0.70768,  0.75905,  0.81043],
         [ 0.10831,  0.10831,  0.12544,  ...,  0.70768,  0.74193,  0.81043]],

        [[-0.30252, -0.32003, -0.32003,  ...,  0.29272,  0.38025,  0.41527],
         [-0.23249, -0.26751, -0.26751,  ...,  0.31022,  0.34524,  0.38025],
         [-0.23249, -0.21499, -0.16246,  ...,  0.29272,  0.32773,  0.36275],
         ...,
         [-0.37255, -0.40756, -0.37255,  ...,  0.59034,  0.57283,  0.53782],
         [-0.44258, -0.42507, -0.39006,  ...,  0.57283,  0.57283,  0.53782],
         [-0.49510, -0.46008, -0.40756,  ...,  0.57283,  0.57283,  0.53782]],

        [[-0.53211, -0.51468, -0.53211,  ..., -0.11381, -0.04410,  0.06048],
         [-0.47983, -0.47983, -0.47983,  ..., -0.13124, -0.06153,  0.02562],
         [-0.46240, -0.42754, -0.37525,  ..., -0.07895, -0.06153, -0.00924],
         ...,
         [-0.56697, -0.58440, -0.54954,  ...,  0.42649,  0.44392,  0.44392],
         [-0.63669, -0.60183, -0.58440,  ...,  0.39163,  0.42649,  0.44392],
         [-0.68898, -0.67155, -0.61926,  ...,  0.39163,  0.44392,  0.47878]]])
--------------------------------------------------------------------------------
Second element is:  <class 'torch.Tensor'> with len of  4
Example output of a label shape from the dataloader  torch.Size([])
Image values tensor(0)

Implementing the ClassificationData class#

The first step is to implement a class that enables deepchecks to interact with your model and data. The appropriate class to implement should be selected according to you models task type. In this tutorial, we will implement the classification task type by implementing a class that inherits from the deepchecks.vision.classification_data.ClassificationData class.

# The goal of this class is to make sure the outputs of the model and of the dataloader are in the correct format.
# To learn more about the expected format please visit the API reference for the
# :class:`deepchecks.vision.classification_data.ClassificationData` class.

class AntsBeesData(ClassificationData):

    def __init__(self, *args, **kwargs):
      super().__init__(*args, **kwargs)

    def batch_to_images(self, batch):
        """
        Convert a batch of data to images in the expected format. The expected format is an iterable of cv2 images,
        where each image is a numpy array of shape (height, width, channels). The numbers in the array should be in the
        range [0, 255]
        """
        inp = batch[0].detach().numpy().transpose((0, 2, 3, 1))
        mean = [0.485, 0.456, 0.406]
        std = [0.229, 0.224, 0.225]
        inp = std * inp + mean
        inp = np.clip(inp, 0, 1)
        return inp*255

    def batch_to_labels(self, batch):
        """
        Convert a batch of data to labels in the expected format. The expected format is a tensor of shape (N,),
        where N is the number of samples. Each element is an integer representing the class index.
        """
        return batch[1]

    def infer_on_batch(self, batch, model, device):
        """
        Returns the predictions for a batch of data. The expected format is a tensor of shape (N, n_classes),
        where N is the number of samples. Each element is an array of length n_classes that represent the probability of
        each class.
        """
        logits = model.to(device)(batch[0].to(device))
        return nn.Softmax(dim=1)(logits)

After defining the task class, we can validate it by running the following code:

LABEL_MAP = {
    0: 'ants',
    1: 'bees'
  }
training_data = AntsBeesData(data_loader=dataloaders["train"], label_map=LABEL_MAP)
val_data = AntsBeesData(data_loader=dataloaders["val"], label_map=LABEL_MAP)

training_data.validate_format(model)
val_data.validate_format(model)
Deepchecks will try to validate the extractors given...
Structure validation
--------------------
Label formatter: Pass!
Prediction formatter: Pass!
Image formatter: Pass!

Content validation
------------------
For validating the content within the structure you have to manually observe the classes, image, label and prediction.
Examples of classes observed in the batch's labels: [[1], [1], [1], [0]]
Visual images & label & prediction: should open in a new window
*******************************************************************************
This machine does not support GUI
The formatted image was saved in:
/home/runner/work/deepchecks/deepchecks/docs/source/user-guide/vision/quickstarts/deepchecks_formatted_image.jpg
Visual example of an image. Label class 1 Prediction class 1
validate_extractors can be set to skip the image saving or change the save path
*******************************************************************************
Deepchecks will try to validate the extractors given...
Structure validation
--------------------
Label formatter: Pass!
Prediction formatter: Pass!
Image formatter: Pass!

Content validation
------------------
For validating the content within the structure you have to manually observe the classes, image, label and prediction.
Examples of classes observed in the batch's labels: [[1], [0], [1], [1]]
Visual images & label & prediction: should open in a new window
*******************************************************************************
This machine does not support GUI
The formatted image was saved in:
/home/runner/work/deepchecks/deepchecks/docs/source/user-guide/vision/quickstarts/deepchecks_formatted_image (1).jpg
Visual example of an image. Label class 1 Prediction class 1
validate_extractors can be set to skip the image saving or change the save path
*******************************************************************************

And observe the output:

Running Deepchecks’ full suite on our data and model!#

Now that we have defined the task class, we can validate the model with the full suite of deepchecks. This can be done with this simple few lines of code:

from deepchecks.vision.suites import full_suite

suite = full_suite()
result = suite.run(training_data, val_data, model, device=device)
Validating Input:
|     | 0/1 [Time: 00:00]
Validating Input:
|#####| 1/1 [Time: 00:00]
Validating Input:
|#####| 1/1 [Time: 00:00]

Ingesting Batches - Train Dataset:
|                                                             | 0/61 [Time: 00:00]

Ingesting Batches - Train Dataset:
|#                                                            | 1/61 [Time: 00:00]

Ingesting Batches - Train Dataset:
|##                                                           | 2/61 [Time: 00:00]

Ingesting Batches - Train Dataset:
|###                                                          | 3/61 [Time: 00:00]

Ingesting Batches - Train Dataset:
|####                                                         | 4/61 [Time: 00:00]

Ingesting Batches - Train Dataset:
|#####                                                        | 5/61 [Time: 00:00]

Ingesting Batches - Train Dataset:
|######                                                       | 6/61 [Time: 00:00]

Ingesting Batches - Train Dataset:
|#######                                                      | 7/61 [Time: 00:01]

Ingesting Batches - Train Dataset:
|########                                                     | 8/61 [Time: 00:01]

Ingesting Batches - Train Dataset:
|#########                                                    | 9/61 [Time: 00:01]

Ingesting Batches - Train Dataset:
|##########                                                   | 10/61 [Time: 00:01]

Ingesting Batches - Train Dataset:
|###########                                                  | 11/61 [Time: 00:01]

Ingesting Batches - Train Dataset:
|############                                                 | 12/61 [Time: 00:01]

Ingesting Batches - Train Dataset:
|#############                                                | 13/61 [Time: 00:01]

Ingesting Batches - Train Dataset:
|##############                                               | 14/61 [Time: 00:02]

Ingesting Batches - Train Dataset:
|###############                                              | 15/61 [Time: 00:02]

Ingesting Batches - Train Dataset:
|################                                             | 16/61 [Time: 00:02]

Ingesting Batches - Train Dataset:
|#################                                            | 17/61 [Time: 00:02]

Ingesting Batches - Train Dataset:
|##################                                           | 18/61 [Time: 00:02]

Ingesting Batches - Train Dataset:
|###################                                          | 19/61 [Time: 00:02]

Ingesting Batches - Train Dataset:
|####################                                         | 20/61 [Time: 00:02]

Ingesting Batches - Train Dataset:
|#####################                                        | 21/61 [Time: 00:03]

Ingesting Batches - Train Dataset:
|######################                                       | 22/61 [Time: 00:03]

Ingesting Batches - Train Dataset:
|#######################                                      | 23/61 [Time: 00:03]

Ingesting Batches - Train Dataset:
|########################                                     | 24/61 [Time: 00:03]

Ingesting Batches - Train Dataset:
|#########################                                    | 25/61 [Time: 00:03]

Ingesting Batches - Train Dataset:
|##########################                                   | 26/61 [Time: 00:03]

Ingesting Batches - Train Dataset:
|###########################                                  | 27/61 [Time: 00:04]

Ingesting Batches - Train Dataset:
|############################                                 | 28/61 [Time: 00:04]

Ingesting Batches - Train Dataset:
|#############################                                | 29/61 [Time: 00:04]

Ingesting Batches - Train Dataset:
|##############################                               | 30/61 [Time: 00:04]

Ingesting Batches - Train Dataset:
|###############################                              | 31/61 [Time: 00:04]

Ingesting Batches - Train Dataset:
|################################                             | 32/61 [Time: 00:04]

Ingesting Batches - Train Dataset:
|#################################                            | 33/61 [Time: 00:04]

Ingesting Batches - Train Dataset:
|##################################                           | 34/61 [Time: 00:05]

Ingesting Batches - Train Dataset:
|###################################                          | 35/61 [Time: 00:05]

Ingesting Batches - Train Dataset:
|####################################                         | 36/61 [Time: 00:05]

Ingesting Batches - Train Dataset:
|#####################################                        | 37/61 [Time: 00:05]

Ingesting Batches - Train Dataset:
|######################################                       | 38/61 [Time: 00:05]

Ingesting Batches - Train Dataset:
|#######################################                      | 39/61 [Time: 00:05]

Ingesting Batches - Train Dataset:
|########################################                     | 40/61 [Time: 00:05]

Ingesting Batches - Train Dataset:
|#########################################                    | 41/61 [Time: 00:06]

Ingesting Batches - Train Dataset:
|##########################################                   | 42/61 [Time: 00:06]

Ingesting Batches - Train Dataset:
|###########################################                  | 43/61 [Time: 00:06]

Ingesting Batches - Train Dataset:
|############################################                 | 44/61 [Time: 00:06]

Ingesting Batches - Train Dataset:
|#############################################                | 45/61 [Time: 00:06]

Ingesting Batches - Train Dataset:
|##############################################               | 46/61 [Time: 00:06]

Ingesting Batches - Train Dataset:
|###############################################              | 47/61 [Time: 00:07]

Ingesting Batches - Train Dataset:
|################################################             | 48/61 [Time: 00:07]

Ingesting Batches - Train Dataset:
|#################################################            | 49/61 [Time: 00:07]

Ingesting Batches - Train Dataset:
|##################################################           | 50/61 [Time: 00:07]

Ingesting Batches - Train Dataset:
|###################################################          | 51/61 [Time: 00:07]

Ingesting Batches - Train Dataset:
|####################################################         | 52/61 [Time: 00:07]

Ingesting Batches - Train Dataset:
|#####################################################        | 53/61 [Time: 00:07]

Ingesting Batches - Train Dataset:
|######################################################       | 54/61 [Time: 00:08]

Ingesting Batches - Train Dataset:
|#######################################################      | 55/61 [Time: 00:08]

Ingesting Batches - Train Dataset:
|########################################################     | 56/61 [Time: 00:08]

Ingesting Batches - Train Dataset:
|#########################################################    | 57/61 [Time: 00:08]

Ingesting Batches - Train Dataset:
|##########################################################   | 58/61 [Time: 00:08]

Ingesting Batches - Train Dataset:
|###########################################################  | 59/61 [Time: 00:08]

Ingesting Batches - Train Dataset:
|############################################################ | 60/61 [Time: 00:08]

Ingesting Batches - Train Dataset:
|#############################################################| 61/61 [Time: 00:09]

Ingesting Batches - Train Dataset:
|#############################################################| 61/61 [Time: 00:09]


Computing Single Dataset Checks - Train Dataset:
|      | 0/6 [Time: 00:00]


Computing Single Dataset Checks - Train Dataset:
|####  | 4/6 [Time: 00:00, Check=Image Segment Performance]


Computing Single Dataset Checks - Train Dataset:
|##### | 5/6 [Time: 00:00, Check=Image Property Outliers]


Computing Single Dataset Checks - Train Dataset:
|######| 6/6 [Time: 00:00, Check=Label Property Outliers]



Ingesting Batches - Test Dataset:
|                                       | 0/39 [Time: 00:00]



Ingesting Batches - Test Dataset:
|#                                      | 1/39 [Time: 00:00]



Ingesting Batches - Test Dataset:
|##                                     | 2/39 [Time: 00:00]



Ingesting Batches - Test Dataset:
|###                                    | 3/39 [Time: 00:00]



Ingesting Batches - Test Dataset:
|####                                   | 4/39 [Time: 00:00]



Ingesting Batches - Test Dataset:
|#####                                  | 5/39 [Time: 00:00]



Ingesting Batches - Test Dataset:
|######                                 | 6/39 [Time: 00:00]



Ingesting Batches - Test Dataset:
|#######                                | 7/39 [Time: 00:01]



Ingesting Batches - Test Dataset:
|########                               | 8/39 [Time: 00:01]



Ingesting Batches - Test Dataset:
|#########                              | 9/39 [Time: 00:01]



Ingesting Batches - Test Dataset:
|##########                             | 10/39 [Time: 00:01]



Ingesting Batches - Test Dataset:
|###########                            | 11/39 [Time: 00:01]



Ingesting Batches - Test Dataset:
|############                           | 12/39 [Time: 00:01]



Ingesting Batches - Test Dataset:
|#############                          | 13/39 [Time: 00:02]



Ingesting Batches - Test Dataset:
|##############                         | 14/39 [Time: 00:02]



Ingesting Batches - Test Dataset:
|###############                        | 15/39 [Time: 00:02]



Ingesting Batches - Test Dataset:
|################                       | 16/39 [Time: 00:02]



Ingesting Batches - Test Dataset:
|#################                      | 17/39 [Time: 00:02]



Ingesting Batches - Test Dataset:
|##################                     | 18/39 [Time: 00:02]



Ingesting Batches - Test Dataset:
|###################                    | 19/39 [Time: 00:02]



Ingesting Batches - Test Dataset:
|####################                   | 20/39 [Time: 00:03]



Ingesting Batches - Test Dataset:
|#####################                  | 21/39 [Time: 00:03]



Ingesting Batches - Test Dataset:
|######################                 | 22/39 [Time: 00:03]



Ingesting Batches - Test Dataset:
|#######################                | 23/39 [Time: 00:03]



Ingesting Batches - Test Dataset:
|########################               | 24/39 [Time: 00:03]



Ingesting Batches - Test Dataset:
|#########################              | 25/39 [Time: 00:03]



Ingesting Batches - Test Dataset:
|##########################             | 26/39 [Time: 00:03]



Ingesting Batches - Test Dataset:
|###########################            | 27/39 [Time: 00:04]



Ingesting Batches - Test Dataset:
|############################           | 28/39 [Time: 00:04]



Ingesting Batches - Test Dataset:
|#############################          | 29/39 [Time: 00:04]



Ingesting Batches - Test Dataset:
|##############################         | 30/39 [Time: 00:04]



Ingesting Batches - Test Dataset:
|##############################9        | 31/39 [Time: 00:04]



Ingesting Batches - Test Dataset:
|################################       | 32/39 [Time: 00:04]



Ingesting Batches - Test Dataset:
|#################################      | 33/39 [Time: 00:05]



Ingesting Batches - Test Dataset:
|##################################     | 34/39 [Time: 00:05]



Ingesting Batches - Test Dataset:
|###################################    | 35/39 [Time: 00:05]



Ingesting Batches - Test Dataset:
|####################################   | 36/39 [Time: 00:05]



Ingesting Batches - Test Dataset:
|#####################################  | 37/39 [Time: 00:05]



Ingesting Batches - Test Dataset:
|###################################### | 38/39 [Time: 00:05]



Ingesting Batches - Test Dataset:
|#######################################| 39/39 [Time: 00:05]




Computing Single Dataset Checks - Test Dataset:
|      | 0/6 [Time: 00:00]




Computing Single Dataset Checks - Test Dataset:
|####  | 4/6 [Time: 00:00, Check=Image Segment Performance]




Computing Single Dataset Checks - Test Dataset:
|######| 6/6 [Time: 00:00, Check=Label Property Outliers]




Computing Single Dataset Checks - Test Dataset:
|######| 6/6 [Time: 00:00, Check=Label Property Outliers]





Computing Checks:
|          | 0/10 [Time: 00:00]





Computing Checks:
|          | 0/10 [Time: 00:00, Check=Class Performance]





Computing Checks:
|          | 0/10 [Time: 00:00, Check=Train Test Prediction Drift]





Computing Checks:
|##        | 2/10 [Time: 00:00, Check=Train Test Prediction Drift]





Computing Checks:
|##        | 2/10 [Time: 00:00, Check=Simple Model Comparison]





Computing Checks:
|##        | 2/10 [Time: 00:00, Check=Model Error Analysis]   Default parameter min_samples_leaf will change in version 2.6.See https://github.com/scikit-learn-contrib/category_encoders/issues/327
Default parameter smoothing will change in version 2.6.See https://github.com/scikit-learn-contrib/category_encoders/issues/327






Computing Checks:
|####      | 4/10 [Time: 00:00, Check=Model Error Analysis]





Computing Checks:
|####      | 4/10 [Time: 00:00, Check=New Labels]





Computing Checks:
|####      | 4/10 [Time: 00:00, Check=Heatmap Comparison]





Computing Checks:
|####      | 4/10 [Time: 00:00, Check=Train Test Label Drift]





Computing Checks:
|####      | 4/10 [Time: 00:00, Check=Image Property Drift]





Computing Checks:
|########  | 8/10 [Time: 00:00, Check=Image Property Drift]





Computing Checks:
|########  | 8/10 [Time: 00:00, Check=Image Dataset Drift]





Computing Checks:
|########  | 8/10 [Time: 00:00, Check=Property Label Correlation Change]





Computing Checks:
|##########| 10/10 [Time: 00:01, Check=Property Label Correlation Change]





Computing Checks:
|##########| 10/10 [Time: 00:01, Check=Property Label Correlation Change]

Observing the results:#

The results can be saved as a html file with the following code:

result.save_as_html('output.html')
'output (1).html'

Or, if working inside a notebook, the output can be displayed directly by simply printing the result object:

result
Full Suite


Total running time of the script: ( 0 minutes 21.554 seconds)

Gallery generated by Sphinx-Gallery