class_docstr: Morphs a regression estimator into one that can detect outliers. We will try to predict `column` in X.
  
  Parameters
  ----------
  model : scikit-learn compatible regression model
      A regression model that will be used for prediction.
  column : int
      The index of the target column to predict in the input data.
  lower : float, default=2.0
      Lower threshold for outlier detection. The method used for detection depends on the `method` parameter.
  upper : float, default=2.0
      Upper threshold for outlier detection. The method used for detection depends on the `method` parameter.
  method : Literal["sd", "relative", "absolute"], default="sd"
      The method to use for outlier detection.
  
      - `"sd"` uses standard deviation
      - `"relative"` uses relative difference
      - `"absolute"` uses absolute difference
  
  Attributes
  ----------
  estimator_ : scikit-learn compatible regression model
      The fitted underlying regression model.
  sd_ : float
      The standard deviation of the differences between true and predicted values.
  idx_ : int
      The index of the target column in the input data.
class_docstr_tok: ["Morphs","a","regression","estimator","into","one","that","can","detect","outliers",".","We","will","try","to","predict","`","column","`","in","X.","Parameters","--","--","--","--","--","model",":","scikit-learn","compatible","regression","model","A","regression","model","that","will","be","used","for","prediction",".","column",":","int","The","index","of","the","target","column","to","predict","in","the","input","data",".","lower",":","float",",","default=2.0","Lower","threshold","for","outlier","detection",".","The","method","used","for","detection","depends","on","the","`","method","`","parameter",".","upper",":","float",",","default=2.0","Upper","threshold","for","outlier","detection",".","The","method","used","for","detection","depends","on","the","`","method","`","parameter",".","method",":","Literal","[","``","sd","''",",","``","relative","''",",","``","absolute","''","]",",","default=","''","sd","''","The","method","to","use","for","outlier","detection",".","-","`","``","sd","''","`","uses","standard","deviation","-","`","``","relative","''","`","uses","relative","difference","-","`","``","absolute","''","`","uses","absolute","difference","Attributes","--","--","--","--","--","estimator_",":","scikit-learn","compatible","regression","model","The","fitted","underlying","regression","model",".","sd_",":","float","The","standard","deviation","of","the","differences","between","true","and","predicted","values",".","idx_",":","int","The","index","of","the","target","column","in","the","input","data","."]
docstr: Fit the underlying model on `X_to_use` and `y` where:
  
  - `y` is the column we want to predict (`X[:, self.column]`)
  - `X_to_use` is the rest of the data.
  
  Parameters
  ----------
  X : array-like of shape (n_samples, n_features)
      Training data.
  y : array-like of shape (n_samples,), default=None
      Ignored, present for compatibility.
  
  Returns
  -------
  self : RegressionOutlierDetector
      The fitted estimator.
  
  Raises
  ------
  ValueError
      If the `model` is not a regression estimator.
docstr_tok: ["Fit","the","underlying","model","on","`","X_to_use","`","and","`","y","`","where",":","-","`","y","`","is","the","column","we","want","to","predict","(","`","X","[",":",",","self.column","]","`",")","-","`","X_to_use","`","is","the","rest","of","the","data",".","Parameters","--","--","--","--","--","X",":","array-like","of","shape","(","n_samples",",","n_features",")","Training","data",".","y",":","array-like","of","shape","(","n_samples",",",")",",","default=None","Ignored",",","present","for","compatibility",".","Returns","--","--","--","-","self",":","RegressionOutlierDetector","The","fitted","estimator",".","Raises","--","--","--","ValueError","If","the","`","model","`","is","not","a","regression","estimator","."]
code: def fit(self, X, y=None):
      """Fit the underlying model on `X_to_use` and `y` where:
  
      - `y` is the column we want to predict (`X[:, self.column]`)
      - `X_to_use` is the rest of the data.
  
      Parameters
      ----------
      X : array-like of shape (n_samples, n_features)
          Training data.
      y : array-like of shape (n_samples,), default=None
          Ignored, present for compatibility.
  
      Returns
      -------
      self : RegressionOutlierDetector
          The fitted estimator.
  
      Raises
      ------
      ValueError
          If the `model` is not a regression estimator.
      """
      self.idx_ = (
          np.argmax([i == self.column for i in X.columns])
          if isinstance(X, pd.DataFrame)
          else self.column
      )
      X = check_array(X, estimator=self)
      if not self._is_regression_model():
          raise ValueError("Passed model must be regression!")
      X, y = self.to_x_y(X)
      self.estimator_ = self.model.fit(X, y)
      self.sd_ = np.std(self.estimator_.predict(X) - y)
      return self
  
file_path: scikit-lego/sklego/meta/regression_outlier_detector.py
imports: import numpy
  import pandas
  from sklearn.base import BaseEstimator, OutlierMixin
  from sklearn.utils.validation import check_array, check_is_fitted
label_desc: Use image node_id 5 for calling the RegressionOutlierDetector obj's underlying member method code with example usage: obj.fit(X, y) and returns: self