class_docstr: Drift detector based on the Wasserstein 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 )
  
  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)
   
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 = wasserstein(
              base_outputs,
              outputs,
              p=self.wasserstein_p,
              fraction_to_match=self.fraction_to_match,
              n_perm=None,
          )
          p_value = None
      elif self.n_test is None:
          ood_score, p_value = wasserstein(
              base_outputs,
              outputs,
              p=self.wasserstein_p,
              fraction_to_match=self.fraction_to_match,
              n_perm=self.n_perm,
          )
      else:
          torchdrift.utils.check(
              self.n_test == outputs.size(0),
              "number of test samples does not match calibrated number",
          )
          ood_score = wasserstein(
              base_outputs,
              outputs,
              p=self.wasserstein_p,
              fraction_to_match=self.fraction_to_match,
              n_perm=None,
          )
          p_value = torch.igammac(
              self.dist_alpha,
              self.dist_beta
              * (ood_score.cpu() - self.dist_min).clamp_(min=0),
          ).to(
              outputs.device
          )  # 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/wasserstein.py
imports: from typing import Optional
  import torch
  from .None import Detector
  import torchdrift.utils
label_desc: Use image node_id 3 for calling the WassersteinDriftDetector 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