Exporting Deepchecks’ Results#
This guide will help you understand how to export deepchecks results, which enables saving them for later viewing, sharing the analysis results as a report, sending to different tools, or for further processing steps (e.g. in ci/cd for deciding whether a new model is good enough for deployment).
We will discuss the two main export options, that are relevant for saving Check or Suite results:
Saving an HTML File - saving the interactive report as a file
Exporting to JSON - exporting to a serializeable object that can later be used in other Python scopes, and enables processing the checks’ output with code.
For sending the results to other tools (e.g. experiment trackers), you can either use one of the above send the desires results or report, or check out our integrations examples section in the user guide.
Save Result as an HTML Report:
This method saves the Check or Suite’s output as an HTML file. It expects an output filename or a full file path to the report’s destination folder. If no name given, the default filename will be ‘output.html’.
Save as HTML#
Export Results to JSON:
This method takes the check outputs and serializes it to a JSON string format.
The format of the output json includes all info required to reconstruct the run and its output, including the check’s name, parameters, a short description of its purpose, its result value, and a json of the releant data for displaying its outputs.
If serializing a SuiteResult, the output is an array of the CheckResults JSON’s, along with the suite’s name.
Save Check/Suite result as a JSON formatted string:
serialized_output = result.to_json()
Inspect the JSON Structure#
Parse resulting json string as dict and observe the JSON’s structure:
import json json_output = json.loads(serialized_output) # to see output keys: json_output.keys() # to see all JSON: json_output
See docstring in code or in method’s API reference:
from deepchecks.core import CheckResult help(CheckResult.to_json)
Inspect the check results output keys and content to see how the checks name, parameters, etc. are saved.
See docstring in code or in the method’s API reference:
A Suite’s output JSON is an array of all of the Check’s output JSON’s inside the
results key, along with the suite’s name.
from deepchecks.core import SuiteResult help(SuiteResult.to_json)
See suite result json:
# save as json string suite_json_ = suite_result.to_json() # load json to dict from string json_output = json.loads(suite_json) # Suite name json_output['name'] # Results is an array of CheckResult JSON's, let's see how many checks ran in suite: len(json_output['results']) # Let's observe a specific check's output, which is similar to a single check's json format`Check output's json_output['results']
View the Output Display from the JSON#
The serialized JSON can be used to reproduce the run in other Python scopes. The full display output
can be viewed by using the
deepchecks.core.SuiteResult.from_json() for a Suite’s result
deepchecks.core.CheckResult.from_json() for a Check’s result).
from deepchecks.utils.json_utils import from_json from_json(serialized_output)