class_docstr: This is a class for detecting one-dimensional outliers using z-score (based on the normal distribution).
  See https://en.wikipedia.org/wiki/Standard_score as a reference.
  
  This is a child of `~greykite.common.features.outlier.ZScoreOutlierDetector`,
  which 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.
  
  For this method:
  
  - `DetectionResult.scores` are defined as:
      The difference of the value with trimmed mean divided by the trimmed standard deviation
  - `DetectionResult.is_outlier` are defined as: scores which are off by more than `z_score_cutoff`.
  
  Parameters
  ----------
  z_score_cutoff : `float`, default `Z_SCORE_CUTOFF`
      The normal distribution cut-off used to decide outliers.
  
  Attribute
  ---------
  fitted_param: `dict` or None, default None
      This is updated after `self.fit` is run on data.
      This dictionary stores:
  
          - "trimmed_mean": `float`
              Trimmed mean of the input fit data (after trimming).
          - "trimmed_sd": `float`
              Trimmed standard deviation of the input fit data (after trimming).
  
  
  Other Parameters and Attributes:
      See `~greykite.common.features.outlier.BaseOutlierDetector` docstring.
class_docstr_tok: ["This","is","a","class","for","detecting","one-dimensional","outliers","using","z-score","(","based","on","the","normal","distribution",")",".","See","https",":","\/\/en.wikipedia.org\/wiki\/Standard_score","as","a","reference",".","This","is","a","child","of","`","~greykite.common.features.outlier.ZScoreOutlierDetector","`",",","which","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",".","For","this","method",":","-","`","DetectionResult.scores","`","are","defined","as",":","The","difference","of","the","value","with","trimmed","mean","divided","by","the","trimmed","standard","deviation","-","`","DetectionResult.is_outlier","`","are","defined","as",":","scores","which","are","off","by","more","than","`","z_score_cutoff","`",".","Parameters","--","--","--","--","--","z_score_cutoff",":","`","float","`",",","default","`","Z_SCORE_CUTOFF","`","The","normal","distribution","cut-off","used","to","decide","outliers",".","Attribute","--","--","--","--","-","fitted_param",":","`","dict","`","or","None",",","default","None","This","is","updated","after","`","self.fit","`","is","run","on","data",".","This","dictionary","stores",":","-","``","trimmed_mean","''",":","`","float","`","Trimmed","mean","of","the","input","fit","data","(","after","trimming",")",".","-","``","trimmed_sd","''",":","`","float","`","Trimmed","standard","deviation","of","the","input","fit","data","(","after","trimming",")",".","Other","Parameters","and","Attributes",":","See","`","~greykite.common.features.outlier.BaseOutlierDetector","`","docstring","."]
docstr: The logic of outlier detection, after `fit` is done.
  This method uses the fit information to decide which points are
  outliers and what should be their score.
  
  This is an abstract method of the base class:
  `~greykite.common.features.outlier.BaseOutlierDetector`
  and it is implemented for z-score here.
  
  For this method: scores are defined as the mean difference divided by the standard deviation
  (as prescribed z-score).
  
  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: ["The","logic","of","outlier","detection",",","after","`","fit","`","is","done",".","This","method","uses","the","fit","information","to","decide","which","points","are","outliers","and","what","should","be","their","score",".","This","is","an","abstract","method","of","the","base","class",":","`","~greykite.common.features.outlier.BaseOutlierDetector","`","and","it","is","implemented","for","z-score","here",".","For","this","method",":","scores","are","defined","as","the","mean","difference","divided","by","the","standard","deviation","(","as","prescribed","z-score",")",".","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):
      """The logic of outlier detection, after `fit` is done.
      This method uses the fit information to decide which points are
      outliers and what should be their score.
  
      This is an abstract method of the base class:
      `~greykite.common.features.outlier.BaseOutlierDetector`
      and it is implemented for z-score here.
  
      For this method: scores are defined as the mean difference divided by the standard deviation
      (as prescribed z-score).
  
      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).
      """
      scores = pd.Series([0] * len(y_new), dtype=float)
      is_outlier = pd.Series([False] * len(y_new))
  
      # If trimmed sd is zero or not defined, we will not detect any outlier and return.
      if not (self.fitted_param["trimmed_sd"] > 0):
          return DetectionResult(scores=scores, is_outlier=is_outlier)
  
      scores = (
          y_new - self.fitted_param["trimmed_mean"]
      ) / self.fitted_param["trimmed_sd"]
      # Boolean series to denote outliers.
      is_outlier = np.abs(scores) > self.z_score_cutoff
  
      return DetectionResult(scores=scores, is_outlier=is_outlier)
  
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 3 for calling the ZScoreOutlierDetector obj's underlying member method code with example usage: obj.detect_logic(y_new) and returns: DetectionResult, DetectionResult