code: def detect_pattern_anomaly(y, yhat, th, dist_measure):
      anomaly_indexes = []
      for i, (y_i, yhat_i) in enumerate(zip(y, yhat)):
          if dist_measure.abs_dist(y_i, yhat_i) > th:
              anomaly_indexes.append(i)
      return anomaly_indexes
  
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 3 for calling a global function with example usage: detect_pattern_anomaly(y, yhat, th, dist_measure) and returns: anomaly_indexes