.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "checks_gallery/tabular/methodology/plot_single_feature_contribution.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_methodology_plot_single_feature_contribution.py: Single Feature Contribution *************************** .. GENERATED FROM PYTHON SOURCE LINES 8-10 Imports ======= .. GENERATED FROM PYTHON SOURCE LINES 10-17 .. code-block:: default import numpy as np import pandas as pd from deepchecks.tabular import Dataset from deepchecks.tabular.checks.methodology import * .. GENERATED FROM PYTHON SOURCE LINES 18-20 Generating Data =============== .. GENERATED FROM PYTHON SOURCE LINES 20-26 .. code-block:: default df = pd.DataFrame(np.random.randn(100, 3), columns=['x1', 'x2', 'x3']) df['x4'] = df['x1'] * 0.5 + df['x2'] df['label'] = df['x2'] + 0.1 * df['x1'] df['x5'] = df['label'].apply(lambda x: 'v1' if x < 0 else 'v2') .. GENERATED FROM PYTHON SOURCE LINES 27-30 .. code-block:: default ds = Dataset(df, label='label', cat_features=[]) .. GENERATED FROM PYTHON SOURCE LINES 31-33 Running single_feature_contribution check ========================================= .. GENERATED FROM PYTHON SOURCE LINES 33-36 .. code-block:: default SingleFeatureContribution().run(ds) .. raw:: html

Single Feature Contribution

Return the PPS (Predictive Power Score) of all features in relation to the label.

Additional Outputs
The Predictive Power Score (PPS) is used to estimate the ability of a feature to predict the label by itself (Read more about Predictive Power Score). A high PPS (close to 1) can mean that this feature's success in predicting the label is actually due to data leakage - meaning that the feature holds information that is based on the label to begin with.


.. GENERATED FROM PYTHON SOURCE LINES 37-39 Using the SingleFeatureContribution check class =============================================== .. GENERATED FROM PYTHON SOURCE LINES 39-42 .. code-block:: default my_check = SingleFeatureContribution(ppscore_params={'sample': 10}) my_check.run(dataset=ds) .. raw:: html

Single Feature Contribution

Return the PPS (Predictive Power Score) of all features in relation to the label.

Additional Outputs
The Predictive Power Score (PPS) is used to estimate the ability of a feature to predict the label by itself (Read more about Predictive Power Score). A high PPS (close to 1) can mean that this feature's success in predicting the label is actually due to data leakage - meaning that the feature holds information that is based on the label to begin with.


.. rst-class:: sphx-glr-timing **Total running time of the script:** ( 0 minutes 0.135 seconds) .. _sphx_glr_download_checks_gallery_tabular_methodology_plot_single_feature_contribution.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_single_feature_contribution.py ` .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_single_feature_contribution.ipynb ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_