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 fit(self, data):
      df = data.df
      assert self.value_col in df.columns
      q1 = np.quantile(a=df[self.value_col], q=0.25)
      q3 = np.quantile(a=df[self.value_col], q=0.75)
      iqr = q3 - q1
  
      default_param = {
          "q1": q1,
          "q3": q3,
          "iqr": iqr,
          "iqr_coef": None,
          "lower": None,
          "upper": None,
      }
  
      y_true = df[self.is_anomaly_col]
      data = Data(df=df, y_true=y_true)
  
      param_iterable = self.param_iterable
  
      optim_res = self.optimize_param(
          data=data,
          param_iterable=param_iterable,
          default_param=default_param,
      )
  
      self.fit_info = {
          "param": optim_res["best_param"],
          "param_full": optim_res["best_param_full"],
          "obj_value": optim_res["best_obj_value"],
          "param_obj_list": optim_res["param_obj_list"],
      }
  
      self.fitted_df = self.predict(Data(df=df.copy()))
  
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 2 for calling the TukeyDetector obj's underlying member method code with example usage: obj.fit(data) without return types