class_docstr: A detector based on Tukey's outliar definition which is used in Boxplots
  (also invented by Tukey) as well to draw the whiskers.
  Reference: Exploratory Data Analysis, 1977, John Tukey
  Tukey defines outliars to be any points outside the interval range:
  ``(q1 - iqr_coef * iqr, q3 + iqr_coef * iqr)``
  where `q1` is the first quartile, `q3` is the third quartile and
  ``iqr = q3 - q1``.
  ``iqr_coef`` is the coefficient used and it is typically equal to 1.5
  In this detector, we choose the parameter using data.
class_docstr_tok: ["A","detector","based","on","Tukey","'s","outliar","definition","which","is","used","in","Boxplots","(","also","invented","by","Tukey",")","as","well","to","draw","the","whiskers",".","Reference",":","Exploratory","Data","Analysis",",","1977",",","John","Tukey","Tukey","defines","outliars","to","be","any","points","outside","the","interval","range",":","``","(","q1","-","iqr_coef","*","iqr",",","q3","+","iqr_coef","*","iqr",")","``","where","`","q1","`","is","the","first","quartile",",","`","q3","`","is","the","third","quartile","and","``","iqr","=","q3","-","q1","``",".","``","iqr_coef","``","is","the","coefficient","used","and","it","is","typically","equal","to","1.5","In","this","detector",",","we","choose","the","parameter","using","data","."]
code: def calc_with_param(self, param, data):
      df = data.df
      assert self.value_col in df.columns
      param["upper"] = param["q3"] + (param["iqr"] * param["iqr_coef"])
      param["lower"] = param["q1"] - (param["iqr"] * param["iqr_coef"])
  
      df[PREDICTED_ANOMALY_COL] = (
          df[self.value_col] < param["lower"]
      ) | (df[self.value_col] > param["upper"])
  
      data.y_pred = df[PREDICTED_ANOMALY_COL]
  
      return CalcResult(data=data)
  
imports: import numpy
  import pandas
  import pytest
  from scipy import stats
  from greykite.common.constants import PREDICTED_ANOMALY_COL
  from greykite.common.viz.timeseries_annotate import plot_lines_markers
  from greykite.detection.common.ad_evaluation import f1_score
  from greykite.detection.detector.data import DetectorData
  from greykite.detection.detector.detector import Detector
  from greykite.detection.detector.detector import build_anomaly_percent_reward
  from greykite.detection.detector.optimizer import CalcResult
  from greykite.detection.detector.reward import Reward
label_desc: Use image node_id 3 for calling the TukeyDetector obj's underlying member method code with example usage: obj.calc_with_param(param, data) and returns: CalcResult