.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "checks_gallery/tabular/performance/plot_segment_performance.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note Click :ref:`here ` to download the full example code .. rst-class:: sphx-glr-example-title .. _sphx_glr_checks_gallery_tabular_performance_plot_segment_performance.py: Segment Performance ******************* .. GENERATED FROM PYTHON SOURCE LINES 8-14 Load data ========= The dataset is the adult dataset which can be downloaded from the UCI machine learning repository. Dua, D. and Graff, C. (2019). UCI Machine Learning Repository [http://archive.ics.uci.edu/ml]. Irvine, CA: University of California, School of Information and Computer Science. .. GENERATED FROM PYTHON SOURCE LINES 14-17 .. code-block:: default from deepchecks.tabular.datasets.classification import adult .. GENERATED FROM PYTHON SOURCE LINES 18-20 Create Dataset ============== .. GENERATED FROM PYTHON SOURCE LINES 20-24 .. code-block:: default train_ds, validation_ds = adult.load_data() .. GENERATED FROM PYTHON SOURCE LINES 25-27 Classification Model ==================== .. GENERATED FROM PYTHON SOURCE LINES 27-31 .. code-block:: default model = adult.load_fitted_model() model .. rst-class:: sphx-glr-script-out Out: .. code-block:: none Pipeline(steps=[('preprocessing', ColumnTransformer(transformers=[('num', SimpleImputer(), ['education-num', 'capital-gain', 'capital-loss', 'hours-per-week', 'age', 'fnlwgt']), ('cat', Pipeline(steps=[('imputer', SimpleImputer(strategy='most_frequent')), ('encoder', OrdinalEncoder())]), ['workclass', 'education', 'marital-status', 'occupation', 'relationship', 'race', 'sex', 'native-country'])])), ('model', RandomForestClassifier(max_depth=5, n_jobs=-1, random_state=0))]) .. GENERATED FROM PYTHON SOURCE LINES 32-36 .. code-block:: default from deepchecks.tabular.checks.performance import SegmentPerformance SegmentPerformance(feature_1='workclass', feature_2='hours-per-week').run(validation_ds, model) .. rst-class:: sphx-glr-script-out Out: .. code-block:: none /home/runner/work/deepchecks/deepchecks/deepchecks/utils/features.py:180: UserWarning: Cannot use model's built-in feature importance on a Scikit-learn Pipeline, using permutation feature importance calculation instead Calculating permutation feature importance. Expected to finish in 44 seconds .. raw:: html

Segment Performance

Display performance score segmented by 2 top (or given) features in a heatmap.

Additional Outputs


.. rst-class:: sphx-glr-timing **Total running time of the script:** ( 0 minutes 37.398 seconds) .. _sphx_glr_download_checks_gallery_tabular_performance_plot_segment_performance.py: .. only :: html .. container:: sphx-glr-footer :class: sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_segment_performance.py ` .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_segment_performance.ipynb ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_