.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "tabular/auto_checks/model_evaluation/plot_roc_report.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note :ref:`Go to the end ` to download the full example code .. rst-class:: sphx-glr-example-title .. _sphx_glr_tabular_auto_checks_model_evaluation_plot_roc_report.py: .. _tabular__roc_report: ROC Report ********** This notebook provides an overview for using and understanding the ROC Report check. **Structure:** * `What is the ROC Report check? <#what-is-the-roc-report-check>`__ * `Generate data & model <#generate-data-model>`__ * `Run the check <#run-the-check>`__ * `Define a condition <#define-a-condition>`__ What is the ROC Report check? ============================== The ``ROCReport`` check calculates the ROC curve for each class. The ROC curve is a plot of TPR (true positive rate) with respect to FPR (false positive rate) at various thresholds (`ROC curve `__). .. GENERATED FROM PYTHON SOURCE LINES 26-28 Imports ======== .. GENERATED FROM PYTHON SOURCE LINES 28-45 .. code-block:: default import warnings import pandas as pd from sklearn.datasets import load_iris from sklearn.linear_model import LogisticRegression from sklearn.model_selection import train_test_split from deepchecks.tabular import Dataset from deepchecks.tabular.checks import RocReport def custom_formatwarning(msg, *args, **kwargs): return str(msg) + '\n' warnings.formatwarning = custom_formatwarning .. GENERATED FROM PYTHON SOURCE LINES 46-48 Generate data & model ====================== .. GENERATED FROM PYTHON SOURCE LINES 48-60 .. code-block:: default iris = load_iris(as_frame=True) clf = LogisticRegression(penalty='none') frame = iris.frame X = iris.data y = iris.target X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.5, random_state=55) clf.fit(X_train, y_train) ds = Dataset(pd.concat([X_test, y_test], axis=1), features=iris.feature_names, label='target') .. GENERATED FROM PYTHON SOURCE LINES 61-63 Run the Check ================ .. GENERATED FROM PYTHON SOURCE LINES 63-68 .. code-block:: default check = RocReport() check.run(ds, clf) .. raw:: html
ROC Report


.. GENERATED FROM PYTHON SOURCE LINES 69-73 Define a condition =================== A condition for minimum allowed AUC score per class can be defined. Here, we define minimum AUC score to be 0.7. .. GENERATED FROM PYTHON SOURCE LINES 73-76 .. code-block:: default check = RocReport() check.add_condition_auc_greater_than(0.7).run(ds, clf) .. raw:: html
ROC Report


.. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 0.130 seconds) .. _sphx_glr_download_tabular_auto_checks_model_evaluation_plot_roc_report.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_roc_report.py ` .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_roc_report.ipynb ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_