class_docstr: Cook's distance can be used to identify points that negatively
     affect a regression model. A combination of each observation’s
     leverage and residual values are used in the measurement. Higher
     leverage and residuals relate to  higher Cook’s distances. Note
     that this method is unsupervised and requires at least two 
     features for X with which to calculate the mean Cook's distance
     for each datapoint. Read more in the :cite:`cook1977detection`.
  
  Parameters
  ----------
  contamination : float in (0., 0.5), optional (default=0.1)
      The amount of contamination of the data set, i.e.
      the proportion of outliers in the data set. Used when fitting to
      define the threshold on the decision function.
      
  model : object, optional (default=LinearRegression())
      Regression model used to calculate the Cook's distance
        
  
  Attributes
  ----------
  decision_scores_ : numpy array of shape (n_samples,)
      The outlier scores of the training data.
      The higher, the more abnormal. Outliers tend to have higher
      scores. This value is available once the detector is
      fitted.
  
  threshold_ : float
     The modified z-score to use as a threshold. Observations with
     a modified z-score (based on the median absolute deviation) greater
     than this value will be classified as outliers.
  
  labels_ : int, either 0 or 1
      The binary labels of the training data. 0 stands for inliers
      and 1 for outliers/anomalies. It is generated by applying
      ``threshold_`` on ``decision_scores_``.
      
class_docstr_tok: ["Cook","'s","distance","can","be","used","to","identify","points","that","negatively","affect","a","regression","model",".","A","combination","of","each","observation","\u2019","s","leverage","and","residual","values","are","used","in","the","measurement",".","Higher","leverage","and","residuals","relate","to","higher","Cook","\u2019","s","distances",".","Note","that","this","method","is","unsupervised","and","requires","at","least","two","features","for","X","with","which","to","calculate","the","mean","Cook","'s","distance","for","each","datapoint",".","Read","more","in","the",":","cite",":","`","cook1977detection","`",".","Parameters","--","--","--","--","--","contamination",":","float","in","(","0.",",","0.5",")",",","optional","(","default=0.1",")","The","amount","of","contamination","of","the","data","set",",","i.e",".","the","proportion","of","outliers","in","the","data","set",".","Used","when","fitting","to","define","the","threshold","on","the","decision","function",".","model",":","object",",","optional","(","default=LinearRegression","(",")",")","Regression","model","used","to","calculate","the","Cook","'s","distance","Attributes","--","--","--","--","--","decision_scores_",":","numpy","array","of","shape","(","n_samples",",",")","The","outlier","scores","of","the","training","data",".","The","higher",",","the","more","abnormal",".","Outliers","tend","to","have","higher","scores",".","This","value","is","available","once","the","detector","is","fitted",".","threshold_",":","float","The","modified","z-score","to","use","as","a","threshold",".","Observations","with","a","modified","z-score","(","based","on","the","median","absolute","deviation",")","greater","than","this","value","will","be","classified","as","outliers",".","labels_",":","int",",","either","0","or","1","The","binary","labels","of","the","training","data",".","0","stands","for","inliers","and","1","for","outliers\/anomalies",".","It","is","generated","by","applying","``","threshold_","``","on","``","decision_scores_","``","."]
docstr: Predict raw anomaly score of X using the fitted detector.
  For consistency, outliers are assigned with larger anomaly scores.
  
  Parameters
  ----------
  X : numpy array of shape (n_samples, n_features)
      The training input samples. Sparse matrices are accepted only
      if they are supported by the base estimator.
  
  Returns
  -------
  anomaly_scores : numpy array of shape (n_samples,)
      The anomaly score of the input samples.
docstr_tok: ["Predict","raw","anomaly","score","of","X","using","the","fitted","detector",".","For","consistency",",","outliers","are","assigned","with","larger","anomaly","scores",".","Parameters","--","--","--","--","--","X",":","numpy","array","of","shape","(","n_samples",",","n_features",")","The","training","input","samples",".","Sparse","matrices","are","accepted","only","if","they","are","supported","by","the","base","estimator",".","Returns","--","--","--","-","anomaly_scores",":","numpy","array","of","shape","(","n_samples",",",")","The","anomaly","score","of","the","input","samples","."]
code: def decision_function(self, X):
      """Predict raw anomaly score of X using the fitted detector.
      For consistency, outliers are assigned with larger anomaly scores.
  
      Parameters
      ----------
      X : numpy array of shape (n_samples, n_features)
          The training input samples. Sparse matrices are accepted only
          if they are supported by the base estimator.
  
      Returns
      -------
      anomaly_scores : numpy array of shape (n_samples,)
          The anomaly score of the input samples.
      """
  
      check_is_fitted(
          self, ["decision_scores_", "threshold_", "labels_"]
      )
  
      # Validate input X
      X = check_array(X)
  
      # Get Cook's distance
      distances_ = _process_distances(X, self.model)
  
      return distances_
  
file_path: pyod/pyod/models/cd.py
imports: from __future__ import division
  from __future__ import print_function
  import numpy
  from sklearn.linear_model import LinearRegression
  from sklearn.utils import check_array
  from sklearn.utils.validation import check_is_fitted
  from .base import BaseDetector
label_desc: Use image node_id 3 for calling the CD obj's underlying member method code with example usage: obj.decision_function(X) and returns: distances_