docstr: Update LLR threshold by a value inferred from the percentage of instances
  considered to be outliers in a sample of the dataset.
  
  Parameters
  ----------
  X
      Batch of instances.
  outlier_type
      Predict outliers at the 'feature' or 'instance' level.
  threshold_perc
      Percentage of sorted feature level outlier scores used to predict instance level outlier.
  batch_size
      Batch size for the generative model evaluations.
docstr_tok: ["Update","LLR","threshold","by","a","value","inferred","from","the","percentage","of","instances","considered","to","be","outliers","in","a","sample","of","the","dataset",".","Parameters","--","--","--","--","--","X","Batch","of","instances",".","outlier_type","Predict","outliers","at","the","'feature","'","or","'instance","'","level",".","threshold_perc","Percentage","of","sorted","feature","level","outlier","scores","used","to","predict","instance","level","outlier",".","batch_size","Batch","size","for","the","generative","model","evaluations","."]
code: def infer_threshold(
      self,
      X: np.ndarray,
      outlier_type: str = "instance",
      threshold_perc: float = 95.0,
      batch_size: int = int(1e10),
  ) -> None:
      """
      Update LLR threshold by a value inferred from the percentage of instances
      considered to be outliers in a sample of the dataset.
  
      Parameters
      ----------
      X
          Batch of instances.
      outlier_type
          Predict outliers at the 'feature' or 'instance' level.
      threshold_perc
          Percentage of sorted feature level outlier scores used to predict instance level outlier.
      batch_size
          Batch size for the generative model evaluations.
      """
      # compute outlier scores
      fscore, iscore = self.score(X, batch_size=batch_size)
      if outlier_type == "feature":
          outlier_score = fscore
      elif outlier_type == "instance":
          outlier_score = iscore
      else:
          raise ValueError(
              "`outlier_score` needs to be either `feature` or `instance`."
          )
  
      # update threshold
      self.threshold = np.percentile(outlier_score, threshold_perc)
  
imports: from functools import partial
  import logging
  import numpy
  import tensorflow
  from tensorflow.keras.layers import Input
  from tensorflow.keras.models import Model
  from tensorflow_probability.python.distributions.distribution import Distribution
  from typing import Callable, Dict, Tuple, Union
  from alibi_detect.models.tensorflow.pixelcnn import PixelCNN
  from alibi_detect.models.tensorflow.trainer import trainer
  from alibi_detect.base import BaseDetector, FitMixin, ThresholdMixin, outlier_prediction_dict
  from alibi_detect.utils.tensorflow.prediction import predict_batch
  from alibi_detect.utils.tensorflow.perturbation import mutate_categorical
  from alibi_detect.utils._types import OptimizerTF
label_desc: Use image node_id 3 for calling the LLR obj's underlying member method code with example usage: obj.infer_threshold(X, outlier_type, threshold_perc, batch_size) without return types