class_docstr: A classifier 2 sample test, which tests for a difference between a source and target dataset.  It fits a
  classifier to predict if a sample is in the source and target dataset, then computes an evaluation metric on a
  holdout which becomes the test statistic.
  
  Parameters
  ----------
  classifier_class : an AutoGluon predictor, such as autogluon.tabular.TabularPredictor
      The predictor (classifier) class to classify the source from target dataset, predictor class needs to support
      binary classification
  sample_label : str, default = 'xshift_label'
      The label that will be used to indicate if the sample is from training or test
  eval_metric : callable, default = autogluon.core.metrics.balanced_accuracy
      Binary classification metric to use for the classifier 2 sample test, currently only metrics that accept binary
      predictions are supported, such as balanced_accuracy
  compute_fi : bool, default = True
      To compute the feature importances set to True, this can be computationally intensive
  split : float, default = 0.5
      Training/test split proportion for classifier 2 sample test
  classifier_kwargs : dict, default = {}
      The kwargs passed to the classifier, a member of classifier_class
  test_size_2st: float, default = 0.3
      The size of the test set in the training test split in 2ST
docstr: The half permutation method for computing p-values.
  See Section 9.2 of https://arxiv.org/pdf/1602.02210.pdf
docstr_tok: ["The","half","permutation","method","for","computing","p-values",".","See","Section","9.2","of","https",":","\/\/arxiv.org\/pdf\/1602.02210.pdf"]
code: def _pvalue_half_permutation(self, num_permutations=1000):
      """The half permutation method for computing p-values.
      See Section 9.2 of https://arxiv.org/pdf/1602.02210.pdf
      """
      perm_stats = [self.test_stat]
      yhat = self.classifier.predict_proba(self._test)[1]
      for _ in range(num_permutations):
          perm_yhat = np.random.permutation(yhat)
          perm_test_stat = self.eval_metric(self._test[self.sample_label], perm_yhat)  # type: ignore
          perm_stats.append(perm_test_stat)
      pval = (self.test_stat <= np.array(perm_stats)).mean()
      return pval
  
imports: import copy
  from typing import Any, Dict, List, Optional, Union
  import numpy
  import pandas
  from autogluon.core.constants import BINARY
  from autogluon.core.metrics import BINARY_METRICS, roc_auc
  from autogluon.core.utils import generate_train_test_split
  from autogluon.tabular import TabularPredictor
  from ..None import AnalysisState
  from ..state import StateCheckMixin
  from .base import AbstractAnalysis
label_desc: Use image node_id 4 for calling the Classifier2ST obj's underlying member method code with example usage: obj._pvalue_half_permutation(num_permutations) and returns: pval