.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "checks_gallery/tabular/train_test_validation/plot_index_leakage.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_train_test_validation_plot_index_leakage.py: .. _plot_tabular_index_leakage: Index Leakage ************* .. GENERATED FROM PYTHON SOURCE LINES 10-16 .. code-block:: default import pandas as pd from deepchecks.tabular import Dataset from deepchecks.tabular.checks import IndexTrainTestLeakage .. GENERATED FROM PYTHON SOURCE LINES 17-22 .. code-block:: default def dataset_from_dict(d: dict, index_name: str = None) -> Dataset: dataframe = pd.DataFrame(data=d) return Dataset(dataframe, index_name=index_name) .. GENERATED FROM PYTHON SOURCE LINES 23-25 Synthetic example with index leakage ==================================== .. GENERATED FROM PYTHON SOURCE LINES 25-31 .. code-block:: default train_ds = dataset_from_dict({'col1': [1, 2, 3, 4, 10, 11]}, 'col1') test_ds = dataset_from_dict({'col1': [4, 3, 5, 6, 7]}, 'col1') check_obj = IndexTrainTestLeakage() check_obj.run(train_ds, test_ds) .. raw:: html
Index Train-Test Leakage


.. GENERATED FROM PYTHON SOURCE LINES 32-38 .. code-block:: default train_ds = dataset_from_dict({'col1': [1, 2, 3, 4, 10, 11]}, 'col1') test_ds = dataset_from_dict({'col1': [4, 3, 5, 6, 7]}, 'col1') check_obj = IndexTrainTestLeakage(n_to_show=1) check_obj.run(train_ds, test_ds) .. raw:: html
Index Train-Test Leakage


.. GENERATED FROM PYTHON SOURCE LINES 39-41 Synthetic example without index leakage ======================================= .. GENERATED FROM PYTHON SOURCE LINES 41-46 .. code-block:: default train_ds = dataset_from_dict({'col1': [1, 2, 3, 4, 10, 11]}, 'col1') test_ds = dataset_from_dict({'col1': [20, 21, 5, 6, 7]}, 'col1') check_obj = IndexTrainTestLeakage() check_obj.run(train_ds, test_ds) .. raw:: html
Index Train-Test Leakage


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