Note
Click here to download the full example code
Export Suite Output to a HTML Report#
In this guide, we will demonstrate how to export a suite’s output as an HTML report. This enables easily sharing the results easier and also using deepchecks outside of the notebook environment.
Structure:
Load Data#
Let’s fetch the iris train and test datasets
from deepchecks.tabular.datasets.classification import iris
train_dataset, test_dataset = iris.load_data()
Run Suite#
from deepchecks.tabular.suites import full_suite
suite = full_suite()
suite_result = suite.run(train_dataset=train_dataset, test_dataset=test_dataset)
Out:
Full Suite: 0%| | 0/36 [00:00<?, ? Check/s]
Full Suite: 0%| | 0/36 [00:00<?, ? Check/s, Check=Model Info]
Full Suite: 3%|# | 1/36 [00:00<00:00, 5675.65 Check/s, Check=Columns Info]
Full Suite: 6%|## | 2/36 [00:00<00:00, 1435.42 Check/s, Check=Confusion Matrix Report]
Full Suite: 8%|### | 3/36 [00:00<00:00, 1172.69 Check/s, Check=Performance Report]
Full Suite: 11%|#### | 4/36 [00:00<00:00, 1460.54 Check/s, Check=Roc Report]
Full Suite: 14%|##### | 5/36 [00:00<00:00, 1342.95 Check/s, Check=Simple Model Comparison]
Full Suite: 17%|###### | 6/36 [00:00<00:00, 1524.46 Check/s, Check=Model Error Analysis]
Full Suite: 19%|####### | 7/36 [00:00<00:00, 1719.08 Check/s, Check=Calibration Score]
Full Suite: 22%|######## | 8/36 [00:00<00:00, 1578.44 Check/s, Check=Regression Systematic Error]
Full Suite: 25%|######### | 9/36 [00:00<00:00, 1710.87 Check/s, Check=Regression Error Distribution]
Full Suite: 28%|########## | 10/36 [00:00<00:00, 1852.20 Check/s, Check=Boosting Overfit]
Full Suite: 31%|########### | 11/36 [00:00<00:00, 1993.49 Check/s, Check=Unused Features]
Full Suite: 33%|############ | 12/36 [00:00<00:00, 2128.64 Check/s, Check=Model Inference Time]
Full Suite: 36%|############# | 13/36 [00:00<00:00, 2257.06 Check/s, Check=Train Test Feature Drift]
Full Suite: 39%|############## | 14/36 [00:00<00:00, 97.01 Check/s, Check=Train Test Feature Drift]
Full Suite: 39%|############## | 14/36 [00:00<00:00, 97.01 Check/s, Check=Train Test Label Drift]
Full Suite: 42%|############### | 15/36 [00:00<00:00, 97.01 Check/s, Check=Whole Dataset Drift] Calculating permutation feature importance. Expected to finish in 1 seconds
Full Suite: 44%|################ | 16/36 [00:00<00:00, 97.01 Check/s, Check=Dominant Frequency Change]
Full Suite: 47%|################# | 17/36 [00:00<00:00, 97.01 Check/s, Check=Category Mismatch Train Test]
Full Suite: 50%|################## | 18/36 [00:00<00:00, 97.01 Check/s, Check=New Label Train Test]
Full Suite: 53%|################### | 19/36 [00:00<00:00, 97.01 Check/s, Check=String Mismatch Comparison]
Full Suite: 56%|#################### | 20/36 [00:00<00:00, 97.01 Check/s, Check=Datasets Size Comparison]
Full Suite: 58%|##################### | 21/36 [00:00<00:00, 97.01 Check/s, Check=Date Train Test Leakage Duplicates]
Full Suite: 61%|###################### | 22/36 [00:00<00:00, 97.01 Check/s, Check=Date Train Test Leakage Overlap]
Full Suite: 64%|####################### | 23/36 [00:00<00:00, 97.01 Check/s, Check=Single Feature Contribution Train Test]
Full Suite: 67%|######################## | 24/36 [00:00<00:00, 65.91 Check/s, Check=Single Feature Contribution Train Test]
Full Suite: 67%|######################## | 24/36 [00:00<00:00, 65.91 Check/s, Check=Train Test Samples Mix]
Full Suite: 69%|######################### | 25/36 [00:00<00:00, 65.91 Check/s, Check=Identifier Leakage]
Full Suite: 72%|########################## | 26/36 [00:00<00:00, 65.91 Check/s, Check=Index Train Test Leakage]
Full Suite: 75%|########################### | 27/36 [00:00<00:00, 65.91 Check/s, Check=Is Single Value]
Full Suite: 78%|############################ | 28/36 [00:00<00:00, 65.91 Check/s, Check=Mixed Nulls]
Full Suite: 81%|############################# | 29/36 [00:00<00:00, 65.91 Check/s, Check=Mixed Data Types]
Full Suite: 83%|############################## | 30/36 [00:00<00:00, 65.91 Check/s, Check=String Mismatch]
Full Suite: 86%|############################### | 31/36 [00:00<00:00, 65.91 Check/s, Check=Data Duplicates]
Full Suite: 89%|################################ | 32/36 [00:00<00:00, 65.91 Check/s, Check=String Length Out Of Bounds]
Full Suite: 92%|################################# | 33/36 [00:00<00:00, 65.91 Check/s, Check=Special Characters]
Full Suite: 94%|################################## | 34/36 [00:00<00:00, 65.91 Check/s, Check=Conflicting Labels]
Full Suite: 97%|################################### | 35/36 [00:00<00:00, 65.91 Check/s, Check=Outlier Sample Detection]
Save Suite Result to an HTML Report#
Exporting the suite’s output to an HTML file is possible using the save_as_html
function. This function expects a file-like object, whether it’s a file name or
the full path to the destination folder.
suite_result.save_as_html('my_suite.html')
# or
suite_result.save_as_html() # will save the result in output.html
Out:
'output.html'
# Removing outputs created. this cell should be hidden in nbpshinx using "nbsphinx: hidden" in the metadata
import os
os.remove('output.html')
os.remove('my_suite.html')
Working with in-memory buffers
The suite output can also be written into a file buffers. This can be done by
setting the file argument with a StringIO
or BytesIO
buffer object.
import io
html_out = io.StringIO()
suite_result.save_as_html(file=html_out)
View Suite Output#
The suite’s output can still be viewed within the notebook
suite_result
Total running time of the script: ( 0 minutes 4.412 seconds)