class_docstr: Example:
      >>> #The dataset is split into x_train, x_test, y_train, y_test
      >>> forecaster = Forecaster(...)
      >>> forecaster.fit(x=x_train, y=y_train, ...)
      >>> y_pred = forecaster.predict(x_test)
      >>> td = ThresholdDetector()
      >>> td.fit(y_test, y_pred)
      >>> anomaly_scores = td.score()
      >>> anomaly_indexes = td.anomaly_indexes()
docstr: Gets the indexes of the anomalies.
  
  :param y: new time series to detect anomaly. If y is None, returns anomalies in y_pred.
      Moreover, if both y and y_hat are None, returns anomalies in the fit input.
  :param y_pred: predicted values corresponding to y
  
  :return: dict, anomaly indexes composed of pattern and trend type
docstr_tok: ["Gets","the","indexes","of","the","anomalies",".",":","param","y",":","new","time","series","to","detect","anomaly",".","If","y","is","None",",","returns","anomalies","in","y_pred",".","Moreover",",","if","both","y","and","y_hat","are","None",",","returns","anomalies","in","the","fit","input",".",":","param","y_pred",":","predicted","values","corresponding","to","y",":","return",":","dict",",","anomaly","indexes","composed","of","pattern","and","trend","type"]
code: def anomaly_indexes(self, y=None, y_pred=None):
      """
      Gets the indexes of the anomalies.
  
      :param y: new time series to detect anomaly. If y is None, returns anomalies in y_pred.
          Moreover, if both y and y_hat are None, returns anomalies in the fit input.
      :param y_pred: predicted values corresponding to y
  
      :return: dict, anomaly indexes composed of pattern and trend type
      """
      if self.anomaly_indexes_ is None:
          invalidInputError(
              False, "please call fit before calling score"
          )
  
      if y is None and y_pred is None:
          return self.anomaly_indexes_
      elif y is None:
          index_dict, _ = detect_anomaly(
              y=y_pred,
              trend_th=self.trend_th,
              dist_measure=self.dist_measure,
          )
          return index_dict
      else:
          index_dict, _ = detect_anomaly(
              y,
              yhat=y_pred,
              pattern_th=self.pattern_th,
              trend_th=self.trend_th,
              dist_measure=self.dist_measure,
          )
          return index_dict
  
imports: import math
  import numpy
  from bigdl.chronos.detector.anomaly.abstract import AnomalyDetector
  from bigdl.nano.utils.common import invalidInputError
  from abc import ABC, abstractmethod
label_desc: Use image node_id 5 for calling the ThresholdDetector obj's underlying member method code with example usage: obj.anomaly_indexes(y, y_pred) and returns: self, index_dict, index_dict