Note
Go to the end to download the full example code
Weights & Biases (wandb)#
In this guide, we will demonstrate how to export the Check’s and the Suite’s output to wandb.
This enables to view the exported results in wandb and compare the results you receive with different parameters or model/data.
Structure:
Load Data#
from deepchecks.tabular.datasets.classification import iris
train_dataset, test_dataset = iris.load_data()
model = iris.load_fitted_model()
Run a Check#
from deepchecks.tabular.checks import MultivariateDrift
result = MultivariateDrift().add_condition_overall_drift_value_less_than(
).run(train_dataset, test_dataset, model)
Observe CheckResult Display and Value#
result
the value can be observed
result.value
{'domain_classifier_auc': 0.4545454545454546, 'domain_classifier_drift_score': 0, 'domain_classifier_feature_importance': {'petal length (cm)': 1.0, 'sepal length (cm)': 0.0, 'sepal width (cm)': 0.0, 'petal width (cm)': 0.0}}
Export a Check’s Output (CheckResult) to wandb#
Exporting the output to wandb is possible using the to_wandb
function. This function
exports the check outputs to a wandb project.
The output display that will be export will be a bit different from what you usually see. Only the tables and the plots are being exported.
On default if you export a single check to wandb without a wandb run active it will create a project with the name deepchecks and the and the check’s metadata in the config and export the results there.
See Check to_wandb options#
from deepchecks.core import CheckResult
help(CheckResult.to_wandb)
Help on function to_wandb in module deepchecks.core.check_result:
to_wandb(self, **kwargs)
Send result to wandb.
Parameters
----------
kwargs: Keyword arguments to pass to wandb.init.
Default project name is deepchecks.
Default config is the check metadata (params, train/test/ name etc.).
To use this function you first need to login to your wandb account
import wandb
wandb.login()
False
result.to_wandb()
wandb: Tracking run with wandb version 0.12.21
wandb: W&B syncing is set to `offline` in this directory.
wandb: Run `wandb online` or set WANDB_MODE=online to enable cloud syncing.
wandb: Waiting for W&B process to finish... (success).
wandb: - 0.000 MB of 0.000 MB uploaded (0.000 MB deduped)
wandb: \ 0.000 MB of 0.000 MB uploaded (0.000 MB deduped)
wandb:
wandb: You can sync this run to the cloud by running:
wandb: wandb sync /home/runner/work/deepchecks/deepchecks/docs/source/general/usage/exporting_results/wandb/offline-run-20240131_131841-2qkl9u96
wandb: Find logs at: ./wandb/offline-run-20240131_131841-2qkl9u96/logs
Exporting a Suite’s Output (SuiteResult) to wandb#
Run Suite and export to wandb#
Exporting a suite to wandb is the same as exporting a check. The display in wand will have a section per check.
On default if you export a suite to wandb without a wandb run active it will create a project with the name deepchecks and the suite’s name in the config and send the results there.
from deepchecks.tabular.suites import full_suite
suite = full_suite()
suite_result = suite.run(train_dataset=train_dataset, test_dataset=test_dataset, model=model)
suite_result.to_wandb()
Full Suite:
| | 0/35 [Time: 00:00]
Full Suite:
|█ | 1/35 [Time: 00:00, Check=Train Test Performance]
Full Suite:
|█████ | 5/35 [Time: 00:00, Check=Simple Model Comparison]
Full Suite:
|███████ | 7/35 [Time: 00:03, Check=Calibration Score]
Full Suite:
|████████████████████ | 20/35 [Time: 00:03, Check=Feature Label Correlation Change]
Full Suite:
|████████████████████████ | 24/35 [Time: 00:04, Check=Is Single Value]
Full Suite:
|█████████████████████████████████ | 33/35 [Time: 00:04, Check=Feature Label Correlation]
wandb: Tracking run with wandb version 0.12.21
wandb: W&B syncing is set to `offline` in this directory.
wandb: Run `wandb online` or set WANDB_MODE=online to enable cloud syncing.
wandb: Waiting for W&B process to finish... (success).
wandb: - 0.000 MB of 0.000 MB uploaded (0.000 MB deduped)
wandb: \ 0.000 MB of 0.000 MB uploaded (0.000 MB deduped)
wandb:
wandb: You can sync this run to the cloud by running:
wandb: wandb sync /home/runner/work/deepchecks/deepchecks/docs/source/general/usage/exporting_results/wandb/offline-run-20240131_131850-1h7cal40
wandb: Find logs at: ./wandb/offline-run-20240131_131850-1h7cal40/logs
You can also set all the kwargs the wandb.init will get:
suite_result.to_wandb(project='my-suite-project', config={'suite-name': 'full-suite'})
wandb: Tracking run with wandb version 0.12.21
wandb: W&B syncing is set to `offline` in this directory.
wandb: Run `wandb online` or set WANDB_MODE=online to enable cloud syncing.
wandb: Waiting for W&B process to finish... (success).
wandb: - 0.000 MB of 0.000 MB uploaded (0.000 MB deduped)
wandb: \ 0.000 MB of 0.000 MB uploaded (0.000 MB deduped)
wandb:
wandb: You can sync this run to the cloud by running:
wandb: wandb sync /home/runner/work/deepchecks/deepchecks/docs/source/general/usage/exporting_results/wandb/offline-run-20240131_131855-2qm8a04p
wandb: Find logs at: ./wandb/offline-run-20240131_131855-2qm8a04p/logs
Total running time of the script: (0 minutes 21.992 seconds)