class_docstr: This is the base class for detecting one-dimensional outliers.
      These classes are expected to return (outlier) scores for each point and a
      boolean to express if each point is an outlier or not.
  
      Additionally, a lower bound (`lower_bound`) and upper bound (`upper_bound`)
      attribute will be available after `fit` to determine the bounds for
      outlier determination.
  
      This class already implements a few processing steps which are useful across
      various outlier detection methods:
  
      - `remove_na`: removing NAs
      - `trim`: trimming the data. This is useful for example when using z-score
      - `diff_from_baseline`: fitting a simple baseline and differencing the input from baseline.
  
  Children of this base class need to implement two abstract methods:
  
      - `fit_logic`
      - `detect_logic`
  
  Parameters
  ----------
  trim_percent : `float`, default None
      Trimming percent before calculating the model quantities.
      This removes `trim_percent` of data in symmetric fashion from
      both ends and then it calculates the quantities needed.
      For example in Z-score based method: `ZScoreOutlierDetector` (a child of this class),
      this will remove extreme values before calculating the variance.
  diff_method : `str` or None, default `~greykite.common.features.outlier.MOVING_MEDIAN`
      A simple method to fit a baseline and calculate residuals, then apply
      the approach on the residuals.
      The implemented methods are listed in:
      `~greykite.common.features.outlier.IMPLEMENTED_DIFF_METHODS`
  
  Attributes
  ----------
  self.lower_bound : `float` or None, default None
      The lower bound for not being outlier which is decided after `self.fit`
      is called.
  self.upper_bound : `float` or None, default None
      The upper bound for not being outlier which is decided after `self.fit`
      is called.
  self.fitted_param : `dict`, default None
      Fitted (method specific) parameters.
      The dictionary keys depend on the model (child of this class).
      This is updated from empty dict after `self.fit` is called.
      Note that `self.fit` calls the abstract method `self.fit_logic`,
      which is implemented by the child class.
  self.y : `pandas.Series` or None, default None
      Input series which is added after `self.fit` is called with data.
  y_diff : `pandas.Series` or None, default None
      Differenced series if a `diff_method` is passed.
  y_na_removed : `pandas.Series` or None, default None
      The vector `y` after removing NAs.
  y_trimmed : `pandas.Series` or None, default None
      The `y` vector after trimming in symmetric fashion using `trim_percent`.
  y_ready_to_fit` : `pandas.Series` or None, default None
      The final vector used in `fit` which essentially finds
      This vector is constructed with the following three steps:
  
          - (1) differencing if a `diff_method` is passed;
          - (2) removing NAs;
          - (3) trimming.
  
  self.y_diffed : `pandas.Series` or None, default None
  self.y_na_removed : `pandas.Series` or None, default None
  self.y_trimmed : `pandas.Series` or None, default None
  self.y_ready_to_fit: `pandas.Series` or None, default None
  self.fitted : `~greykite.common.features.outlier.DetectionResult` or None, default None
      Fitted scores and booleans.
      The default for both fields is None, before fit is called.
  self.y_new : `pandas.Series` or None, default None
      This is a series used at `prediction` time.
      Note that in this case prediction means that we want to apply
      the same logic to new data.
      It iw worth noting in most application `fit` is only needed because
      the sole purpose is to do outlier removal.
  self.y_new_ready_to_predict : `pandas.Series` or None, default None
      This is the transformed input for prediction.
      In this case, only differencing might take place, if a `diff_method` is passed.
      Note that there is no need to trim or remove NAs in this case.
  self.predicted : `~greykite.common.features.outlier.DetectionResult` or None, default None
      Predicted scores and booleans, if `self.predict` is called on new data.
class_docstr_tok: ["This","is","the","base","class","for","detecting","one-dimensional","outliers",".","These","classes","are","expected","to","return","(","outlier",")","scores","for","each","point","and","a","boolean","to","express","if","each","point","is","an","outlier","or","not",".","Additionally",",","a","lower","bound","(","`","lower_bound","`",")","and","upper","bound","(","`","upper_bound","`",")","attribute","will","be","available","after","`","fit","`","to","determine","the","bounds","for","outlier","determination",".","This","class","already","implements","a","few","processing","steps","which","are","useful","across","various","outlier","detection","methods",":","-","`","remove_na","`",":","removing","NAs","-","`","trim","`",":","trimming","the","data",".","This","is","useful","for","example","when","using","z-score","-","`","diff_from_baseline","`",":","fitting","a","simple","baseline","and","differencing","the","input","from","baseline",".","Children","of","this","base","class","need","to","implement","two","abstract","methods",":","-","`","fit_logic","`","-","`","detect_logic","`","Parameters","--","--","--","--","--","trim_percent",":","`","float","`",",","default","None","Trimming","percent","before","calculating","the","model","quantities",".","This","removes","`","trim_percent","`","of","data","in","symmetric","fashion","from","both","ends","and","then","it","calculates","the","quantities","needed",".","For","example","in","Z-score","based","method",":","`","ZScoreOutlierDetector","`","(","a","child","of","this","class",")",",","this","will","remove","extreme","values","before","calculating","the","variance",".","diff_method",":","`","str","`","or","None",",","default","`","~greykite.common.features.outlier.MOVING_MEDIAN","`","A","simple","method","to","fit","a","baseline","and","calculate","residuals",",","then","apply","the","approach","on","the","residuals",".","The","implemented","methods","are","listed","in",":","`","~greykite.common.features.outlier.IMPLEMENTED_DIFF_METHODS","`","Attributes","--","--","--","--","--","self.lower_bound",":","`","float","`","or","None",",","default","None","The","lower","bound","for","not","being","outlier","which","is","decided","after","`","self.fit","`","is","called",".","self.upper_bound",":","`","float","`","or","None",",","default","None","The","upper","bound","for","not","being","outlier","which","is","decided","after","`","self.fit","`","is","called",".","self.fitted_param",":","`","dict","`",",","default","None","Fitted","(","method","specific",")","parameters",".","The","dictionary","keys","depend","on","the","model","(","child","of","this","class",")",".","This","is","updated","from","empty","dict","after","`","self.fit","`","is","called",".","Note","that","`","self.fit","`","calls","the","abstract","method","`","self.fit_logic","`",",","which","is","implemented","by","the","child","class",".","self.y",":","`","pandas.Series","`","or","None",",","default","None","Input","series","which","is","added","after","`","self.fit","`","is","called","with","data",".","y_diff",":","`","pandas.Series","`","or","None",",","default","None","Differenced","series","if","a","`","diff_method","`","is","passed",".","y_na_removed",":","`","pandas.Series","`","or","None",",","default","None","The","vector","`","y","`","after","removing","NAs",".","y_trimmed",":","`","pandas.Series","`","or","None",",","default","None","The","`","y","`","vector","after","trimming","in","symmetric","fashion","using","`","trim_percent","`",".","y_ready_to_fit","`",":","`","pandas.Series","`","or","None",",","default","None","The","final","vector","used","in","`","fit","`","which","essentially","finds","This","vector","is","constructed","with","the","following","three","steps",":","-","(","1",")","differencing","if","a","`","diff_method","`","is","passed",";","-","(","2",")","removing","NAs",";","-","(","3",")","trimming",".","self.y_diffed",":","`","pandas.Series","`","or","None",",","default","None","self.y_na_removed",":","`","pandas.Series","`","or","None",",","default","None","self.y_trimmed",":","`","pandas.Series","`","or","None",",","default","None","self.y_ready_to_fit",":","`","pandas.Series","`","or","None",",","default","None","self.fitted",":","`","~greykite.common.features.outlier.DetectionResult","`","or","None",",","default","None","Fitted","scores","and","booleans",".","The","default","for","both","fields","is","None",",","before","fit","is","called",".","self.y_new",":","`","pandas.Series","`","or","None",",","default","None","This","is","a","series","used","at","`","prediction","`","time",".","Note","that","in","this","case","prediction","means","that","we","want","to","apply","the","same","logic","to","new","data",".","It","iw","worth","noting","in","most","application","`","fit","`","is","only","needed","because","the","sole","purpose","is","to","do","outlier","removal",".","self.y_new_ready_to_predict",":","`","pandas.Series","`","or","None",",","default","None","This","is","the","transformed","input","for","prediction",".","In","this","case",",","only","differencing","might","take","place",",","if","a","`","diff_method","`","is","passed",".","Note","that","there","is","no","need","to","trim","or","remove","NAs","in","this","case",".","self.predicted",":","`","~greykite.common.features.outlier.DetectionResult","`","or","None",",","default","None","Predicted","scores","and","booleans",",","if","`","self.predict","`","is","called","on","new","data","."]
docstr: This is an abstract method to be implemented by children of this base class.
  
  Parameters
  ----------
  y_new : `pandas.series`
      A series of floats. This is the input series to be labeled.
  
  Returns
  -------
  result :  `~greykite.common.features.outlier.DetectionResult`
      Includes the outlier detection results (see the data class attributes).
docstr_tok: ["This","is","an","abstract","method","to","be","implemented","by","children","of","this","base","class",".","Parameters","--","--","--","--","--","y_new",":","`","pandas.series","`","A","series","of","floats",".","This","is","the","input","series","to","be","labeled",".","Returns","--","--","--","-","result",":","`","~greykite.common.features.outlier.DetectionResult","`","Includes","the","outlier","detection","results","(","see","the","data","class","attributes",")","."]
code: def detect_logic(self, y_new):
      """This is an abstract method to be implemented by children of this base class.
  
      Parameters
      ----------
      y_new : `pandas.series`
          A series of floats. This is the input series to be labeled.
  
      Returns
      -------
      result :  `~greykite.common.features.outlier.DetectionResult`
          Includes the outlier detection results (see the data class attributes).
      """
      # Implement detect logic here!
      return DetectionResult(scores=None, is_outlier=None)
  
imports: import warnings
  from abc import abstractmethod
  from dataclasses import dataclass
  from dataclasses import field
  from typing import Optional
  import numpy
  import pandas
label_desc: Use image node_id 6 for calling the BaseOutlierDetector obj's underlying member method code with example usage: obj.detect_logic(y_new) and returns: DetectionResult