.. 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_reg.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_reg.py: EBM Regression (Bike Sharing) ===================================== .. GENERATED FROM PYTHON SOURCE LINES 8-9 Experiment initialization and data preparation .. GENERATED FROM PYTHON SOURCE LINES 9-18 .. code-block:: default from piml import Experiment from piml.models import ExplainableBoostingRegressor exp = Experiment() exp.data_loader(data="BikeSharing", silent=True) exp.data_summary(feature_exclude=["yr", "mnth", "temp"], silent=True) exp.data_prepare(target="cnt", task_type="regression", silent=True) .. GENERATED FROM PYTHON SOURCE LINES 19-20 Train Model .. GENERATED FROM PYTHON SOURCE LINES 20-22 .. code-block:: default exp.model_train(model=ExplainableBoostingRegressor(interactions=10), name="EBM") .. GENERATED FROM PYTHON SOURCE LINES 23-24 Evaluate predictive performance .. GENERATED FROM PYTHON SOURCE LINES 24-26 .. code-block:: default exp.model_diagnose(model="EBM", show="accuracy_table") .. rst-class:: sphx-glr-script-out .. code-block:: none MSE MAE R2 Train 0.0072 0.0589 0.7918 Test 0.0078 0.0615 0.7779 Gap 0.0006 0.0025 -0.0140 .. GENERATED FROM PYTHON SOURCE LINES 27-28 Global effect plot for hr .. GENERATED FROM PYTHON SOURCE LINES 28-31 .. code-block:: default exp.model_interpret(model="EBM", show="global_effect_plot", uni_feature="hr", original_scale=True, figsize=(5, 4)) .. image-sg:: /auto_examples/3_models/images/sphx_glr_plot_6_ebm_reg_001.png :alt: hr (64.0%) :srcset: /auto_examples/3_models/images/sphx_glr_plot_6_ebm_reg_001.png :class: sphx-glr-single-img .. GENERATED FROM PYTHON SOURCE LINES 32-33 Global effect plot for season .. GENERATED FROM PYTHON SOURCE LINES 33-35 .. code-block:: default exp.model_interpret(model="EBM", show="global_effect_plot", uni_feature="season", figsize=(5, 4)) .. image-sg:: /auto_examples/3_models/images/sphx_glr_plot_6_ebm_reg_002.png :alt: season (3.6%) :srcset: /auto_examples/3_models/images/sphx_glr_plot_6_ebm_reg_002.png :class: sphx-glr-single-img .. GENERATED FROM PYTHON SOURCE LINES 36-37 Global effect plot for hr and season .. GENERATED FROM PYTHON SOURCE LINES 37-40 .. code-block:: default exp.model_interpret(model="EBM", show="global_effect_plot", bi_features=["hr", "season"], original_scale=True, figsize=(5, 4)) .. image-sg:: /auto_examples/3_models/images/sphx_glr_plot_6_ebm_reg_003.png :alt: season x hr (1.3%) :srcset: /auto_examples/3_models/images/sphx_glr_plot_6_ebm_reg_003.png :class: sphx-glr-single-img .. GENERATED FROM PYTHON SOURCE LINES 41-42 Effect importance .. GENERATED FROM PYTHON SOURCE LINES 42-44 .. 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_reg_004.png :alt: Effect Importance :srcset: /auto_examples/3_models/images/sphx_glr_plot_6_ebm_reg_004.png :class: sphx-glr-single-img .. GENERATED FROM PYTHON SOURCE LINES 45-46 Feature importance .. GENERATED FROM PYTHON SOURCE LINES 46-48 .. 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_reg_005.png :alt: Feature Importance :srcset: /auto_examples/3_models/images/sphx_glr_plot_6_ebm_reg_005.png :class: sphx-glr-single-img .. GENERATED FROM PYTHON SOURCE LINES 49-50 Local interpretation by effect .. GENERATED FROM PYTHON SOURCE LINES 50-52 .. 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_reg_006.png :alt: Predicted: 0.0805 | Actual: 0.1600 :srcset: /auto_examples/3_models/images/sphx_glr_plot_6_ebm_reg_006.png :class: sphx-glr-single-img .. GENERATED FROM PYTHON SOURCE LINES 53-54 Local interpretation by feature .. GENERATED FROM PYTHON SOURCE LINES 54-55 .. 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_reg_007.png :alt: Predicted: 0.0805 | Actual: 0.1600 :srcset: /auto_examples/3_models/images/sphx_glr_plot_6_ebm_reg_007.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-timing **Total running time of the script:** ( 1 minutes 19.800 seconds) **Estimated memory usage:** 14 MB .. _sphx_glr_download_auto_examples_3_models_plot_6_ebm_reg.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_reg.ipynb :alt: Launch binder :width: 150 px .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_6_ebm_reg.py ` .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_6_ebm_reg.ipynb ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_