.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "auto_examples\4_testing\plot_0_accuracy_cls.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 or to run this example in your browser via Binder .. rst-class:: sphx-glr-example-title .. _sphx_glr_auto_examples_4_testing_plot_0_accuracy_cls.py: Accuracy: Classification ===================================== .. GENERATED FROM PYTHON SOURCE LINES 8-9 Experiment initialization and data preparation .. GENERATED FROM PYTHON SOURCE LINES 9-17 .. code-block:: default from piml import Experiment from piml.models import XGB2Classifier exp = Experiment() exp.data_loader(data="TaiwanCredit", silent=True) exp.data_summary(feature_exclude=["LIMIT_BAL", "SEX", "EDUCATION", "MARRIAGE", "AGE"], silent=True) exp.data_prepare(target="FlagDefault", task_type="classification", silent=True) .. GENERATED FROM PYTHON SOURCE LINES 18-19 Train Model .. GENERATED FROM PYTHON SOURCE LINES 19-20 .. code-block:: default exp.model_train(XGB2Classifier(), name="XGB2") .. GENERATED FROM PYTHON SOURCE LINES 21-22 Accuracy table .. GENERATED FROM PYTHON SOURCE LINES 22-23 .. code-block:: default exp.model_diagnose(model="XGB2", show="accuracy_table") .. rst-class:: sphx-glr-script-out .. code-block:: none ACC AUC F1 LogLoss Brier Train 0.8219 0.7978 0.4759 0.4196 0.1316 Test 0.8290 0.7728 0.4797 0.4252 0.1319 Gap 0.0071 -0.0251 0.0038 0.0057 0.0004 .. GENERATED FROM PYTHON SOURCE LINES 24-25 Plot confusion matrix, ROC and Recall-Precision .. GENERATED FROM PYTHON SOURCE LINES 25-27 .. code-block:: default exp.model_diagnose(model="XGB2", show="accuracy_plot", figsize=(10, 4)) .. image-sg:: /auto_examples/4_testing/images/sphx_glr_plot_0_accuracy_cls_001.png :alt: Recall-Precision Curve, ROC Curve :srcset: /auto_examples/4_testing/images/sphx_glr_plot_0_accuracy_cls_001.png :class: sphx-glr-single-img .. GENERATED FROM PYTHON SOURCE LINES 28-29 Plot residual with respect to the feature PAY_1 .. GENERATED FROM PYTHON SOURCE LINES 29-31 .. code-block:: default exp.model_diagnose(model="XGB2", show="accuracy_residual", show_feature="PAY_1", use_test=False, original_scale=True, figsize=(5, 4)) .. image-sg:: /auto_examples/4_testing/images/sphx_glr_plot_0_accuracy_cls_002.png :alt: Residual Plot :srcset: /auto_examples/4_testing/images/sphx_glr_plot_0_accuracy_cls_002.png :class: sphx-glr-single-img .. GENERATED FROM PYTHON SOURCE LINES 32-33 Plot residual with respect to the target feature .. GENERATED FROM PYTHON SOURCE LINES 33-35 .. code-block:: default exp.model_diagnose(model="XGB2", show="accuracy_residual", show_feature="FlagDefault", use_test=False, figsize=(5, 4)) .. image-sg:: /auto_examples/4_testing/images/sphx_glr_plot_0_accuracy_cls_003.png :alt: Residual Plot :srcset: /auto_examples/4_testing/images/sphx_glr_plot_0_accuracy_cls_003.png :class: sphx-glr-single-img .. GENERATED FROM PYTHON SOURCE LINES 36-37 Plot residual with respect to the predicted response .. GENERATED FROM PYTHON SOURCE LINES 37-39 .. code-block:: default exp.model_diagnose(model="XGB2", show="accuracy_residual", show_feature="FlagDefault_predict", use_test=False, figsize=(5, 4)) .. image-sg:: /auto_examples/4_testing/images/sphx_glr_plot_0_accuracy_cls_004.png :alt: Residual Plot :srcset: /auto_examples/4_testing/images/sphx_glr_plot_0_accuracy_cls_004.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-timing **Total running time of the script:** ( 0 minutes 46.487 seconds) **Estimated memory usage:** 54 MB .. _sphx_glr_download_auto_examples_4_testing_plot_0_accuracy_cls.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: binder-badge .. image:: images/binder_badge_logo.svg :target: https://mybinder.org/v2/gh/selfexplainml/piml-toolbox/main?urlpath=lab/tree/./docs/_build/html/notebooks/auto_examples/4_testing/plot_0_accuracy_cls.ipynb :alt: Launch binder :width: 150 px .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_0_accuracy_cls.py ` .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_0_accuracy_cls.ipynb ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_