class_docstr: Drift detector based on the partial MMD Distance.
  (see T. Viehmann: Partial Wasserstein and Maximum Mean Discrepancy distances
  for bridging the gap between outlier detection and drift detection,
  https://arxiv.org/abs/2106.01289 )
  Note: We recommend using dtype double as input for now.
  
  Args:
       fraction_to_match: fraction of x probability mass to be matched
       n_perm: number of bootstrap permutations to run to compute p-value (None for not returning a p-value)
       method: PartialKernelMMDDriftDetector.METHOD_TWOSTAGE, METHOD_APPROX, or METHOD_QP
class_docstr_tok: ["Drift","detector","based","on","the","partial","MMD","Distance",".","(","see","T.","Viehmann",":","Partial","Wasserstein","and","Maximum","Mean","Discrepancy","distances","for","bridging","the","gap","between","outlier","detection","and","drift","detection",",","https",":","\/\/arxiv.org\/abs\/2106.01289",")","Note",":","We","recommend","using","dtype","double","as","input","for","now",".","Args",":","fraction_to_match",":","fraction","of","x","probability","mass","to","be","matched","n_perm",":","number","of","bootstrap","permutations","to","run","to","compute","p-value","(","None","for","not","returning","a","p-value",")","method",":","PartialKernelMMDDriftDetector.METHOD_TWOSTAGE",",","METHOD_APPROX",",","or","METHOD_QP"]
code: def predict_shift_from_features(
      self,
      base_outputs: torch.Tensor,
      outputs: torch.Tensor,
      compute_score: bool,
      compute_p_value: bool,
      individual_samples: bool = False,
  ):
      torchdrift.utils.check(
          not individual_samples,
          "Individual samples not supported by Wasserstein distance detector",
      )
      if not compute_p_value:
          ood_score = self.partial_mmd(
              base_outputs,
              outputs,
              fraction_to_match=self.fraction_to_match,
              n_perm=None,
          )
          p_value = None
      else:
          torchdrift.utils.check(
              self.n_test is not None,
              "Bootstrapping within partial MMD is not implemented, use bootstrap during fit",
              error_class=NotImplementedError,
          )
          torchdrift.utils.check(
              self.n_test == outputs.size(0),
              "number of test samples does not match calibrated number",
          )
          ood_score = self.partial_mmd(
              base_outputs,
              outputs,
              fraction_to_match=self.fraction_to_match,
              n_perm=None,
          )
          p_value = torch.igammac(
              self.dist_alpha,
              self.dist_beta
              * (ood_score - self.dist_min).clamp_(min=0),
          )  # needs PyTorch >=1.8
          # z = (ood_score - self.dist_mean) / self.dist_std
          # p_value = 0.5 * torch.erfc(z * (0.5**0.5))
          # p_value = (self.scores > ood_score).float().mean()
      return ood_score, p_value
  
file_path: TorchDrift/torchdrift/detectors/partial_mmd.py
imports: from typing import Optional
  import torch
  from .mmd import GaussianKernel
  from .detector import Detector
  import torchdrift
  import warnings
label_desc: Use image node_id 3 for calling the PartialKernelMMDDriftDetector obj's underlying member method code with example usage: obj.predict_shift_from_features(base_outputs, outputs, compute_score, compute_p_value, individual_samples) and returns: ood_score,  p_value