code: def _outlier_include(X):
      total = 0
      threshold = 0
      for v in X:
          if v >= 0:
              total += 1
              if v > threshold:
                  threshold = v
  
      if threshold < 0.01:
          return 0
  
      num_thresholds = int(threshold / 0.01) + 1
      means = np.zeros(num_thresholds)
      dists = np.zeros(num_thresholds)
      medians = np.zeros(num_thresholds)
      for i in range(num_thresholds):
          d = i * 0.01
  
          count = 0
          r = np.zeros(len(X))
          for n in range(len(X)):
              if X[n] >= d:
                  r[count] = n + 1
                  count += 1
  
          if count == 0:
              continue
  
          diff = np.zeros(count - 1)
          for n in range(len(diff)):
              diff[n] = r[n + 1] - r[n]
  
          means[i] = np.mean(diff) if len(diff) > 0 else 9999999999
          dists[i] = len(diff) * 100 / total
          medians[i] = np.median(r[:count]) / (len(X) / 2) - 1
  
      mj = 0
      fbi = num_thresholds - 1
      for i in range(num_thresholds):
          if dists[i] > 2:
              mj = i
          if means[i] == 9999999999:
              fbi = num_thresholds - 1 - i
  
      trim_limit = max(mj, fbi)
  
      return np.median(medians[: trim_limit + 1])
  
imports: import math
  import numpy
  from sktime.utils.numba.njit import njit
label_desc: Use image node_id 3 for calling a global function with example usage: _outlier_include(X) and returns: np, int