class_docstr: `UMAPOutlierDetection` is an outlier detector based on the reconstruction error from UMAP.
  
  If the difference between original and reconstructed data is larger than the `threshold`, the point is
      considered an outlier.
  
  Parameters
  ----------
  n_components : int, default=2
      Number of components of the UMAP model.
  threshold : float | None, default=None
      The threshold used for the decision function.
  variant : Literal["relative", "absolute"], default="relative"
      The variant used for the difference calculation. "relative" means that the difference between original and
      reconstructed data is divided by the sum of the original data.
  n_neighbors : int, default=15
      `n_neighbors` parameter of UMAP model.
  min_dist : float, default=0.1
      `min_dist` parameter of UMAP model.
  metric : str, default="euclidean"
      `metric` parameter of UMAP model
      (see [UMAP documentation](https://umap-learn.readthedocs.io/en/latest/parameters.html#metric) for the full list
      of available metrics and more information).
  random_state : int | None, default=None
      `random_state` parameter of UMAP model.
  
  Attributes
  ----------
  umap_ : UMAP
      The underlying UMAP model.
  offset_ : float
      The offset used for the decision function.
class_docstr_tok: ["`","UMAPOutlierDetection","`","is","an","outlier","detector","based","on","the","reconstruction","error","from","UMAP",".","If","the","difference","between","original","and","reconstructed","data","is","larger","than","the","`","threshold","`",",","the","point","is","considered","an","outlier",".","Parameters","--","--","--","--","--","n_components",":","int",",","default=2","Number","of","components","of","the","UMAP","model",".","threshold",":","float","|","None",",","default=None","The","threshold","used","for","the","decision","function",".","variant",":","Literal","[","``","relative","''",",","``","absolute","''","]",",","default=","''","relative","''","The","variant","used","for","the","difference","calculation",".","``","relative","''","means","that","the","difference","between","original","and","reconstructed","data","is","divided","by","the","sum","of","the","original","data",".","n_neighbors",":","int",",","default=15","`","n_neighbors","`","parameter","of","UMAP","model",".","min_dist",":","float",",","default=0.1","`","min_dist","`","parameter","of","UMAP","model",".","metric",":","str",",","default=","''","euclidean","''","`","metric","`","parameter","of","UMAP","model","(","see","[","UMAP","documentation","]","(","https",":","\/\/umap-learn.readthedocs.io\/en\/latest\/parameters.html","#","metric",")","for","the","full","list","of","available","metrics","and","more","information",")",".","random_state",":","int","|","None",",","default=None","`","random_state","`","parameter","of","UMAP","model",".","Attributes","--","--","--","--","--","umap_",":","UMAP","The","underlying","UMAP","model",".","offset_",":","float","The","offset","used","for","the","decision","function","."]
docstr: Fit the `UMAPOutlierDetection` model using `X` as training data by fitting the underlying UMAP model, and
  checking the `threshold` value.
  
  Parameters
  ----------
  X : array-like of shape (n_samples, n_features )
      The training data.
  y : array-like of shape (n_samples,) or None, default=None
      Ignored, present for compatibility.
  
  Returns
  -------
  self : UMAPOutlierDetection
      The fitted estimator.
  
  Raises
  ------
  ValueError
      - If `n_components` is less than 2.
      - If `threshold` is `None`.
docstr_tok: ["Fit","the","`","UMAPOutlierDetection","`","model","using","`","X","`","as","training","data","by","fitting","the","underlying","UMAP","model",",","and","checking","the","`","threshold","`","value",".","Parameters","--","--","--","--","--","X",":","array-like","of","shape","(","n_samples",",","n_features",")","The","training","data",".","y",":","array-like","of","shape","(","n_samples",",",")","or","None",",","default=None","Ignored",",","present","for","compatibility",".","Returns","--","--","--","-","self",":","UMAPOutlierDetection","The","fitted","estimator",".","Raises","--","--","--","ValueError","-","If","`","n_components","`","is","less","than","2",".","-","If","`","threshold","`","is","`","None","`","."]
code: def fit(self, X, y=None):
      """Fit the `UMAPOutlierDetection` model using `X` as training data by fitting the underlying UMAP model, and
      checking the `threshold` value.
  
      Parameters
      ----------
      X : array-like of shape (n_samples, n_features )
          The training data.
      y : array-like of shape (n_samples,) or None, default=None
          Ignored, present for compatibility.
  
      Returns
      -------
      self : UMAPOutlierDetection
          The fitted estimator.
  
      Raises
      ------
      ValueError
          - If `n_components` is less than 2.
          - If `threshold` is `None`.
      """
      X = check_array(X, estimator=self, dtype=FLOAT_DTYPES)
      if self.n_components < 2:
          raise ValueError("Number of components must be at least two.")
      if not self.threshold:
          raise ValueError("The `threshold` value cannot be `None`.")
  
      self.umap_ = umap.UMAP(
          n_components=self.n_components,
          n_neighbors=self.n_neighbors,
          min_dist=self.min_dist,
          metric=self.metric,
          random_state=self.random_state,
      )
      self.umap_.fit(X, y)
      self.offset_ = -self.threshold
      return self
  
file_path: scikit-lego/sklego/decomposition/umap_reconstruction.py
imports: import numpy
  from sklearn.base import BaseEstimator, OutlierMixin
  from sklearn.utils.validation import FLOAT_DTYPES, check_array, check_is_fitted
label_desc: Use image node_id 2 for calling the UMAPOutlierDetection obj's underlying member method code with example usage: obj.fit(X, y) and returns: self