docstr: Update the outlier threshold by using a sequence of instances from the dataset
  of which the fraction of features which are outliers are known. This fraction can be across
  all features or per feature.
  
  Parameters
  ----------
  X
      Univariate or multivariate time series.
  outlier_perc
      Percentage of sorted feature level outlier scores used to predict instance level outlier.
  threshold_perc
      Percentage of X considered to be normal based on the outlier score.
      Overall (float) or feature-wise (array or list).
  batch_size
      Batch size used when making predictions with the seq2seq model.
docstr_tok: ["Update","the","outlier","threshold","by","using","a","sequence","of","instances","from","the","dataset","of","which","the","fraction","of","features","which","are","outliers","are","known",".","This","fraction","can","be","across","all","features","or","per","feature",".","Parameters","--","--","--","--","--","X","Univariate","or","multivariate","time","series",".","outlier_perc","Percentage","of","sorted","feature","level","outlier","scores","used","to","predict","instance","level","outlier",".","threshold_perc","Percentage","of","X","considered","to","be","normal","based","on","the","outlier","score",".","Overall","(","float",")","or","feature-wise","(","array","or","list",")",".","batch_size","Batch","size","used","when","making","predictions","with","the","seq2seq","model","."]
code: def infer_threshold(
      self,
      X: np.ndarray,
      outlier_perc: Union[int, float] = 100.0,
      threshold_perc: Union[int, float, np.ndarray, list] = 95.0,
      batch_size: int = int(1e10),
  ) -> None:
      """
      Update the outlier threshold by using a sequence of instances from the dataset
      of which the fraction of features which are outliers are known. This fraction can be across
      all features or per feature.
  
      Parameters
      ----------
      X
          Univariate or multivariate time series.
      outlier_perc
          Percentage of sorted feature level outlier scores used to predict instance level outlier.
      threshold_perc
          Percentage of X considered to be normal based on the outlier score.
          Overall (float) or feature-wise (array or list).
      batch_size
          Batch size used when making predictions with the seq2seq model.
      """
      orig_shape = X.shape
      threshold_shape = (1, orig_shape[-1])
      if len(orig_shape) == 3:  # (batch_size, seq_len, n_features)
          threshold_shape = (1,) + threshold_shape  # type: ignore
  
      # compute outlier scores
      fscore, iscore = self.score(
          X, outlier_perc=outlier_perc, batch_size=batch_size
      )
      if outlier_perc == 100.0:
          fscore = fscore.reshape((-1, self.shape[-1]))
  
      # update threshold
      if (
          isinstance(threshold_perc, (int, float))
          and outlier_perc == 100.0
      ):
          self.threshold += np.percentile(fscore, threshold_perc)
      elif (
          isinstance(threshold_perc, (int, float))
          and outlier_perc < 100.0
      ):
          self.threshold += np.percentile(iscore, threshold_perc)
      elif (
          isinstance(threshold_perc, (list, np.ndarray))
          and outlier_perc == 100.0
      ):
          self.threshold += np.diag(
              np.percentile(fscore, threshold_perc, axis=0)
          ).reshape(threshold_shape)
      elif (
          isinstance(threshold_perc, (list, np.ndarray))
          and outlier_perc < 100.0
      ):
          # number feature scores used for outlier score
          n_score = int(np.ceil(0.01 * outlier_perc * fscore.shape[1]))
          # compute threshold level by feature
          sorted_fscore = np.sort(fscore, axis=1)
          if len(orig_shape) == 3:  # (batch_size, seq_len, n_features)
              sorted_fscore_perc = sorted_fscore[
                  :, -n_score:, :
              ]  # (batch_size, n_score, n_features)
              self.threshold += np.mean(
                  sorted_fscore_perc, axis=(0, 1)
              ).reshape(
                  threshold_shape
              )  # (1,1,n_features)
          else:  # (batch_size, n_features)
              sorted_fscore_perc = sorted_fscore[
                  :, -n_score:
              ]  # (batch_size, n_score)
              self.threshold += np.mean(
                  sorted_fscore_perc, axis=0
              )  # float
      else:
          raise TypeError(
              "Incorrect type for `threshold` and/or `threshold_perc`."
          )
  
imports: import logging
  import numpy
  import tensorflow
  from tensorflow.keras.layers import Dense, InputLayer
  from typing import Dict, Tuple, Union
  from alibi_detect.models.tensorflow.autoencoder import Seq2Seq, EncoderLSTM, DecoderLSTM
  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._types import OptimizerTF
label_desc: Use image node_id 3 for calling the OutlierSeq2Seq obj's underlying member method code with example usage: obj.infer_threshold(X, outlier_perc, threshold_perc, batch_size) without return types