.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "auto_examples\4_testing\plot_4_robustness_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_4_testing_plot_4_robustness_reg.py: Robustness: Regression ===================================== .. 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 FIGSRegressor 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 18-19 Train Model .. GENERATED FROM PYTHON SOURCE LINES 19-21 .. code-block:: default exp.model_train(FIGSRegressor(max_iter=100, max_depth=5), name="FIGS") .. GENERATED FROM PYTHON SOURCE LINES 22-23 Robustness test with all features being perturbed .. GENERATED FROM PYTHON SOURCE LINES 23-26 .. code-block:: default exp.model_diagnose(model="FIGS", show='robustness_perf', perturb_features=None, perturb_method="raw", metric="MSE", perturb_size=0.1, figsize=(6, 4)) .. image-sg:: /auto_examples/4_testing/images/sphx_glr_plot_4_robustness_reg_001.png :alt: Model Performance: Perturb on All Features :srcset: /auto_examples/4_testing/images/sphx_glr_plot_4_robustness_reg_001.png :class: sphx-glr-single-img .. GENERATED FROM PYTHON SOURCE LINES 27-28 Robustness test with custom perturbation features .. GENERATED FROM PYTHON SOURCE LINES 28-31 .. code-block:: default exp.model_diagnose(model="FIGS", show="robustness_perf", perturb_features=["hr", "atemp"], perturb_method='raw', metric="MSE", perturb_size=0.1, figsize=(6, 4)) .. image-sg:: /auto_examples/4_testing/images/sphx_glr_plot_4_robustness_reg_002.png :alt: Model Performance: Perturb on 2 Features :srcset: /auto_examples/4_testing/images/sphx_glr_plot_4_robustness_reg_002.png :class: sphx-glr-single-img .. GENERATED FROM PYTHON SOURCE LINES 32-33 Robustness test with custom perturbation size .. GENERATED FROM PYTHON SOURCE LINES 33-36 .. code-block:: default exp.model_diagnose(model="FIGS", show="robustness_perf", perturb_features=None, perturb_method="raw", metric="MSE", perturb_size=0.2, figsize=(6, 4)) .. image-sg:: /auto_examples/4_testing/images/sphx_glr_plot_4_robustness_reg_003.png :alt: Model Performance: Perturb on All Features :srcset: /auto_examples/4_testing/images/sphx_glr_plot_4_robustness_reg_003.png :class: sphx-glr-single-img .. GENERATED FROM PYTHON SOURCE LINES 37-38 Robustness test with custom perturbation method .. GENERATED FROM PYTHON SOURCE LINES 38-41 .. code-block:: default exp.model_diagnose(model="FIGS", show="robustness_perf", perturb_features=None, perturb_method="quantile", metric="MSE", perturb_size=0.1, figsize=(6, 4)) .. image-sg:: /auto_examples/4_testing/images/sphx_glr_plot_4_robustness_reg_004.png :alt: Model Performance: Perturb on All Features :srcset: /auto_examples/4_testing/images/sphx_glr_plot_4_robustness_reg_004.png :class: sphx-glr-single-img .. GENERATED FROM PYTHON SOURCE LINES 42-43 Robustness test with custom metrics .. GENERATED FROM PYTHON SOURCE LINES 43-46 .. code-block:: default exp.model_diagnose(model="FIGS", show="robustness_perf", perturb_features=None, perturb_method="raw", metric="R2", perturb_size=0.1, figsize=(6, 4)) .. image-sg:: /auto_examples/4_testing/images/sphx_glr_plot_4_robustness_reg_005.png :alt: Model Performance: Perturb on All Features :srcset: /auto_examples/4_testing/images/sphx_glr_plot_4_robustness_reg_005.png :class: sphx-glr-single-img .. GENERATED FROM PYTHON SOURCE LINES 47-48 Robustness test on worst-alpha percent samples .. GENERATED FROM PYTHON SOURCE LINES 48-50 .. code-block:: default exp.model_diagnose(model="FIGS", show="robustness_perf_worst", perturb_features=None, perturb_method="raw", metric="MSE", perturb_size=0.1, alpha=0.3, figsize=(6, 4)) .. image-sg:: /auto_examples/4_testing/images/sphx_glr_plot_4_robustness_reg_006.png :alt: 30%-Worst Sample Performance :srcset: /auto_examples/4_testing/images/sphx_glr_plot_4_robustness_reg_006.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-timing **Total running time of the script:** ( 0 minutes 55.815 seconds) **Estimated memory usage:** 40 MB .. _sphx_glr_download_auto_examples_4_testing_plot_4_robustness_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/4_testing/plot_4_robustness_reg.ipynb :alt: Launch binder :width: 150 px .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_4_robustness_reg.py ` .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_4_robustness_reg.ipynb ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_