.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "auto_examples\3_models\plot_6_ebm_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_3_models_plot_6_ebm_cls.py: EBM Classification (Taiwan Credit) ===================================== .. 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 ExplainableBoostingClassifier 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-21 .. code-block:: default exp.model_train(model=ExplainableBoostingClassifier(interactions=10), name="EBM") .. GENERATED FROM PYTHON SOURCE LINES 22-23 Evaluate predictive performance .. GENERATED FROM PYTHON SOURCE LINES 23-25 .. code-block:: default exp.model_diagnose(model="EBM", show='accuracy_table') .. rst-class:: sphx-glr-script-out .. code-block:: none ACC AUC F1 LogLoss Brier Train 0.8218 0.7896 0.4778 0.4239 0.1327 Test 0.8272 0.7753 0.4792 0.4222 0.1312 Gap 0.0054 -0.0143 0.0013 -0.0017 -0.0016 .. GENERATED FROM PYTHON SOURCE LINES 26-27 Effect importance .. GENERATED FROM PYTHON SOURCE LINES 27-29 .. code-block:: default exp.model_interpret(model="EBM", show="global_ei", figsize=(5, 4)) .. image-sg:: /auto_examples/3_models/images/sphx_glr_plot_6_ebm_cls_001.png :alt: Effect Importance :srcset: /auto_examples/3_models/images/sphx_glr_plot_6_ebm_cls_001.png :class: sphx-glr-single-img .. GENERATED FROM PYTHON SOURCE LINES 30-31 Feature importance .. GENERATED FROM PYTHON SOURCE LINES 31-33 .. code-block:: default exp.model_interpret(model="EBM", show="global_fi", figsize=(5, 4)) .. image-sg:: /auto_examples/3_models/images/sphx_glr_plot_6_ebm_cls_002.png :alt: Feature Importance :srcset: /auto_examples/3_models/images/sphx_glr_plot_6_ebm_cls_002.png :class: sphx-glr-single-img .. GENERATED FROM PYTHON SOURCE LINES 34-35 Global effect plot .. GENERATED FROM PYTHON SOURCE LINES 35-38 .. code-block:: default exp.model_interpret(model="EBM", show="global_effect_plot", uni_feature="PAY_1", original_scale=True, figsize=(5, 4)) .. image-sg:: /auto_examples/3_models/images/sphx_glr_plot_6_ebm_cls_003.png :alt: PAY_1 (51.7%) :srcset: /auto_examples/3_models/images/sphx_glr_plot_6_ebm_cls_003.png :class: sphx-glr-single-img .. GENERATED FROM PYTHON SOURCE LINES 39-40 Local interpretation by effect .. GENERATED FROM PYTHON SOURCE LINES 40-42 .. code-block:: default exp.model_interpret(model="EBM", show="local_ei", sample_id=0, original_scale=True, figsize=(5, 4)) .. image-sg:: /auto_examples/3_models/images/sphx_glr_plot_6_ebm_cls_004.png :alt: Predicted: 0.2236 | Actual: 0.0000 :srcset: /auto_examples/3_models/images/sphx_glr_plot_6_ebm_cls_004.png :class: sphx-glr-single-img .. GENERATED FROM PYTHON SOURCE LINES 43-44 Local interpretation by feature .. GENERATED FROM PYTHON SOURCE LINES 44-45 .. code-block:: default exp.model_interpret(model="EBM", show="local_fi", sample_id=0, original_scale=True, figsize=(5, 4)) .. image-sg:: /auto_examples/3_models/images/sphx_glr_plot_6_ebm_cls_005.png :alt: Predicted: 0.2236 | Actual: 0.0000 :srcset: /auto_examples/3_models/images/sphx_glr_plot_6_ebm_cls_005.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-timing **Total running time of the script:** ( 1 minutes 25.154 seconds) **Estimated memory usage:** 34 MB .. _sphx_glr_download_auto_examples_3_models_plot_6_ebm_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/3_models/plot_6_ebm_cls.ipynb :alt: Launch binder :width: 150 px .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_6_ebm_cls.py ` .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_6_ebm_cls.ipynb ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_