.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "auto_examples\2_explain\plot_1_pdp.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_2_explain_plot_1_pdp.py: Partial Dependence Plot ===================================== .. GENERATED FROM PYTHON SOURCE LINES 9-10 Experiment initialization and data preparation .. GENERATED FROM PYTHON SOURCE LINES 10-18 .. code-block:: default from piml import Experiment from piml.models import XGB2Regressor 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=XGB2Regressor(n_estimators=100), name="XGB2") .. GENERATED FROM PYTHON SOURCE LINES 23-24 1D PDP for hr (use training data by default) .. GENERATED FROM PYTHON SOURCE LINES 24-27 .. code-block:: default exp.model_explain(model="XGB2", show="pdp", uni_feature="hr", grid_size=50, original_scale=True, figsize=(5, 4)) .. image-sg:: /auto_examples/2_explain/images/sphx_glr_plot_1_pdp_001.png :alt: Partial Dependence Plot :srcset: /auto_examples/2_explain/images/sphx_glr_plot_1_pdp_001.png :class: sphx-glr-single-img .. GENERATED FROM PYTHON SOURCE LINES 28-29 1D PDP for hr (use test data) .. GENERATED FROM PYTHON SOURCE LINES 29-32 .. code-block:: default exp.model_explain(model="XGB2", show="pdp", uni_feature="hr", use_test=True, grid_size=50, original_scale=True, figsize=(5, 4)) .. image-sg:: /auto_examples/2_explain/images/sphx_glr_plot_1_pdp_002.png :alt: Partial Dependence Plot :srcset: /auto_examples/2_explain/images/sphx_glr_plot_1_pdp_002.png :class: sphx-glr-single-img .. GENERATED FROM PYTHON SOURCE LINES 33-34 1D PDP for season .. GENERATED FROM PYTHON SOURCE LINES 34-37 .. code-block:: default exp.model_explain(model="XGB2", show="pdp", uni_feature='season', original_scale=True, figsize=(5, 4)) .. image-sg:: /auto_examples/2_explain/images/sphx_glr_plot_1_pdp_003.png :alt: Partial Dependence Plot :srcset: /auto_examples/2_explain/images/sphx_glr_plot_1_pdp_003.png :class: sphx-glr-single-img .. GENERATED FROM PYTHON SOURCE LINES 38-39 2D PDP for hr and workingday .. GENERATED FROM PYTHON SOURCE LINES 39-41 .. code-block:: default exp.model_explain(model="XGB2", show="pdp", bi_features=["hr", "workingday"], grid_size=10, sample_size=10000, sliced_line=False, original_scale=True, figsize=(5, 4)) .. image-sg:: /auto_examples/2_explain/images/sphx_glr_plot_1_pdp_004.png :alt: Partial Dependence Plot :srcset: /auto_examples/2_explain/images/sphx_glr_plot_1_pdp_004.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-timing **Total running time of the script:** ( 0 minutes 46.333 seconds) **Estimated memory usage:** 15 MB .. _sphx_glr_download_auto_examples_2_explain_plot_1_pdp.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/2_explain/plot_1_pdp.ipynb :alt: Launch binder :width: 150 px .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_1_pdp.py ` .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_1_pdp.ipynb ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_