class_docstr: Check if test indexes are present in train data.
  
  Parameters
  ----------
  n_to_show : int , default: 5
      Number of samples with same indices in train and test to show.
  n_samples : int , default: 10_000_000
      number of samples to use for this check.
  random_state : int, default: 42
      random seed for all check internals.
docstr: Run check.
  
  Returns
  -------
  CheckResult
      value is the ratio of index leakage.
      data is html display of the checks' textual result.
  
  Raises
  ------
  DeepchecksValueError
      If one of the datasets is not a Dataset instance with an index
docstr_tok: ["Run","check",".","Returns","--","--","--","-","CheckResult","value","is","the","ratio","of","index","leakage",".","data","is","html","display","of","the","checks","'","textual","result",".","Raises","--","--","--","DeepchecksValueError","If","one","of","the","datasets","is","not","a","Dataset","instance","with","an","index"]
code: def run_logic(self, context: Context) -> CheckResult:
      """Run check.
  
      Returns
      -------
      CheckResult
          value is the ratio of index leakage.
          data is html display of the checks' textual result.
  
      Raises
      ------
      DeepchecksValueError
          If one of the datasets is not a Dataset instance with an index
      """
      train_dataset = context.train.sample(
          self.n_samples, random_state=self.random_state
      )
      test_dataset = context.test.sample(
          self.n_samples, random_state=self.random_state
      )
  
      train_dataset.assert_index()
      train_index = train_dataset.index_col
      val_index = test_dataset.index_col
  
      index_intersection = list(
          set(train_index).intersection(val_index)
      )
      if len(index_intersection) > 0:
          size_in_test = (
              len(index_intersection) / test_dataset.n_samples
          )
          if context.with_display:
              text = f"{size_in_test:.1%} of test data indexes appear in training data"
              table = pd.DataFrame(
                  [[list(index_intersection)[: self.n_index_to_show]]],
                  index=["Sample of test indexes in train:"],
              )
              display = [text, table]
          else:
              display = None
      else:
          size_in_test = 0
          display = None
  
      return CheckResult(
          value=size_in_test,
          header="Index Train-Test Leakage",
          display=display,
      )
  
file_path: deepchecks/deepchecks/tabular/checks/train_test_validation/index_leakage.py
imports: import pandas
  from deepchecks.core import CheckResult, ConditionResult
  from deepchecks.core.condition import ConditionCategory
  from deepchecks.tabular import Context, TrainTestCheck
  from deepchecks.utils.strings import format_percent
label_desc: Use image node_id 2 for calling the IndexTrainTestLeakage obj's underlying member method code with example usage: obj.run_logic(context) and returns: CheckResult