class_docstr: Outlier Detection via R-graph.
  Paper: https://openaccess.thecvf.com/content_cvpr_2017/papers/You_Provable_Self-Representation_Based_CVPR_2017_paper.pdf
  See :cite:`you2017provable` for details.
  
  Parameters
  ----------
  transition_steps : int, optional (default=20)
      Number of transition steps that are taken in the graph, after which 
      the outlier scores are determined.
  
  gamma : float
  
  gamma_nz : boolean, default True
      gamma and gamma_nz together determines the parameter alpha.
      When ``gamma_nz = False``, alpha = gamma.
      When ``gamma_nz = True``, then alpha = gamma * alpha0, where alpha0 is
      the largest number such that the solution to the optimization problem
      with alpha = alpha0 is the zero vector (see Proposition 1 in [1]).
      Therefore, when ``gamma_nz = True``, gamma should be a value greater
      than 1.0. A good choice is typically in the range [5, 500].
  
  tau : float, default 1.0
      Parameter for elastic net penalty term. 
      When tau = 1.0, the method reduces to sparse subspace clustering with
      basis pursuit (SSC-BP) [2].
      When tau = 0.0, the method reduces to least squares regression (LSR).
  
  algorithm : string, default ``lasso_lars``
      Algorithm for computing the representation. Either lasso_lars or
      lasso_cd.
      Note: ``lasso_lars`` and ``lasso_cd`` only support tau = 1.
      For cases tau << 1 linear regression is used.
  
  
  fit_intercept_LR: bool, optional (default=False)
      For  ``gamma`` > 10000 linear regression is used instead of
      ``lasso_lars`` or ``lasso_cd``. This parameter determines whether the
      intercept for the model is calculated.
  
  maxiter_lasso : int, default 1000
      The maximum number of iterations for ``lasso_lars`` and ``lasso_cd``.
  
  n_nonzero : int, default 50
      This is an upper bound on the number of nonzero entries of each
      representation vector.
      If there are more than n_nonzero nonzero entries,
      only the top n_nonzero number of
      entries with largest absolute value are kept.
  
  active_support: boolean, default True
      Set to True to use the active support algorithm in [1] for solving the
      optimization problem. This should significantly reduce the running time
      when n_samples is large.
  
  active_support_params: dictionary of string to any, optional
      Parameters (keyword arguments) and values for the active support
      algorithm. It may be used to set the parameters ``support_init``,
      ``support_size`` and ``maxiter``, see
      ``active_support_elastic_net`` for details. 
      Example: active_support_params={'support_size':50, 'maxiter':100}
      Ignored when ``active_support=False``
  
  preprocessing : bool, optional (default=True)
      If True, apply standardization on the data.
  
  
  verbose : int, optional (default=1)
      Verbosity mode.
  
      - 0 = silent
      - 1 = progress bar
      - 2 = one line per epoch.
  
      For verbose >= 1, model summary may be printed.
  
  random_state : random_state: int, RandomState instance or None, optional
      (default=None)
      If int, random_state is the seed used by the random
      number generator; If RandomState instance, random_state is the random
      number generator; If None, the random number generator is the
      RandomState instance used by `np.random`.
  
  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. When fitting this is used
      to define the threshold on the decision function.
  
  blocksize_test_data: int, optional (default=10)
      Test set is splitted into blocks of the size ``blocksize_test_data``
      to at least partially separate test - and train set
  
  Attributes
  ----------
  
  transition_matrix_ : numpy array of shape (n_samples,)
      Transition matrix from the last fitted data, this might include 
      training + test data
  
  
  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 threshold is based on ``contamination``. It is the
      ``n_samples * contamination`` most abnormal samples in
      ``decision_scores_``. The threshold is calculated for generating
      binary outlier labels.
  
  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: ["Outlier","Detection","via","R-graph",".","Paper",":","https",":","\/\/openaccess.thecvf.com\/content_cvpr_2017\/papers\/You_Provable_Self-Representation_Based_CVPR_2017_paper.pdf","See",":","cite",":","`","you2017provable","`","for","details",".","Parameters","--","--","--","--","--","transition_steps",":","int",",","optional","(","default=20",")","Number","of","transition","steps","that","are","taken","in","the","graph",",","after","which","the","outlier","scores","are","determined",".","gamma",":","float","gamma_nz",":","boolean",",","default","True","gamma","and","gamma_nz","together","determines","the","parameter","alpha",".","When","``","gamma_nz","=","False","``",",","alpha","=","gamma",".","When","``","gamma_nz","=","True","``",",","then","alpha","=","gamma","*","alpha0",",","where","alpha0","is","the","largest","number","such","that","the","solution","to","the","optimization","problem","with","alpha","=","alpha0","is","the","zero","vector","(","see","Proposition","1","in","[","1","]",")",".","Therefore",",","when","``","gamma_nz","=","True","``",",","gamma","should","be","a","value","greater","than","1.0",".","A","good","choice","is","typically","in","the","range","[","5",",","500","]",".","tau",":","float",",","default","1.0","Parameter","for","elastic","net","penalty","term",".","When","tau","=","1.0",",","the","method","reduces","to","sparse","subspace","clustering","with","basis","pursuit","(","SSC-BP",")","[","2","]",".","When","tau","=","0.0",",","the","method","reduces","to","least","squares","regression","(","LSR",")",".","algorithm",":","string",",","default","``","lasso_lars","``","Algorithm","for","computing","the","representation",".","Either","lasso_lars","or","lasso_cd",".","Note",":","``","lasso_lars","``","and","``","lasso_cd","``","only","support","tau","=","1",".","For","cases","tau","<","<","1","linear","regression","is","used",".","fit_intercept_LR",":","bool",",","optional","(","default=False",")","For","``","gamma","``",">","10000","linear","regression","is","used","instead","of","``","lasso_lars","``","or","``","lasso_cd","``",".","This","parameter","determines","whether","the","intercept","for","the","model","is","calculated",".","maxiter_lasso",":","int",",","default","1000","The","maximum","number","of","iterations","for","``","lasso_lars","``","and","``","lasso_cd","``",".","n_nonzero",":","int",",","default","50","This","is","an","upper","bound","on","the","number","of","nonzero","entries","of","each","representation","vector",".","If","there","are","more","than","n_nonzero","nonzero","entries",",","only","the","top","n_nonzero","number","of","entries","with","largest","absolute","value","are","kept",".","active_support",":","boolean",",","default","True","Set","to","True","to","use","the","active","support","algorithm","in","[","1","]","for","solving","the","optimization","problem",".","This","should","significantly","reduce","the","running","time","when","n_samples","is","large",".","active_support_params",":","dictionary","of","string","to","any",",","optional","Parameters","(","keyword","arguments",")","and","values","for","the","active","support","algorithm",".","It","may","be","used","to","set","the","parameters","``","support_init","``",",","``","support_size","``","and","``","maxiter","``",",","see","``","active_support_elastic_net","``","for","details",".","Example",":","active_support_params=","{","'support_size':50",",","'maxiter':100","}","Ignored","when","``","active_support=False","``","preprocessing",":","bool",",","optional","(","default=True",")","If","True",",","apply","standardization","on","the","data",".","verbose",":","int",",","optional","(","default=1",")","Verbosity","mode",".","-","0","=","silent","-","1","=","progress","bar","-","2","=","one","line","per","epoch",".","For","verbose",">","=","1",",","model","summary","may","be","printed",".","random_state",":","random_state",":","int",",","RandomState","instance","or","None",",","optional","(","default=None",")","If","int",",","random_state","is","the","seed","used","by","the","random","number","generator",";","If","RandomState","instance",",","random_state","is","the","random","number","generator",";","If","None",",","the","random","number","generator","is","the","RandomState","instance","used","by","`","np.random","`",".","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",".","When","fitting","this","is","used","to","define","the","threshold","on","the","decision","function",".","blocksize_test_data",":","int",",","optional","(","default=10",")","Test","set","is","splitted","into","blocks","of","the","size","``","blocksize_test_data","``","to","at","least","partially","separate","test","-","and","train","set","Attributes","--","--","--","--","--","transition_matrix_",":","numpy","array","of","shape","(","n_samples",",",")","Transition","matrix","from","the","last","fitted","data",",","this","might","include","training","+","test","data","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","threshold","is","based","on","``","contamination","``",".","It","is","the","``","n_samples","*","contamination","``","most","abnormal","samples","in","``","decision_scores_","``",".","The","threshold","is","calculated","for","generating","binary","outlier","labels",".","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: Fit detector. y is ignored in unsupervised methods.
  Parameters
  ----------
  X : numpy array of shape (n_samples, n_features)
      The input samples.
  y : Ignored
      Not used, present for API consistency by convention.
  Returns
  -------
  self : object
      Fitted estimator.
docstr_tok: ["Fit","detector",".","y","is","ignored","in","unsupervised","methods",".","Parameters","--","--","--","--","--","X",":","numpy","array","of","shape","(","n_samples",",","n_features",")","The","input","samples",".","y",":","Ignored","Not","used",",","present","for","API","consistency","by","convention",".","Returns","--","--","--","-","self",":","object","Fitted","estimator","."]
code: def fit(self, X, y=None):
      """Fit detector. y is ignored in unsupervised methods.
      Parameters
      ----------
      X : numpy array of shape (n_samples, n_features)
          The input samples.
      y : Ignored
          Not used, present for API consistency by convention.
      Returns
      -------
      self : object
          Fitted estimator.
      """
  
      # If we "re-fit" the model then we need to make sure previour self.X_train is first deleted
      # since this parameter is used downstream in the analysis in self.decision_function().
      if hasattr(self, "X_train"):
          del self.X_train
  
      X = check_array(X)
  
      # Fit scaler on train set
      if self.preprocessing:
          self.scaler_ = StandardScaler()
          self.scaler_.fit(X)
  
      self._set_n_classes(y)
      self.decision_scores_ = self.decision_function(X)
      self.X_train = X
      self._process_decision_scores()
      return self
  
file_path: pyod/pyod/models/rgraph.py
imports: from __future__ import division
  from __future__ import print_function
  import warnings
  import numpy
  from scipy import sparse
  from sklearn.decomposition import sparse_encode
  from sklearn.linear_model import LinearRegression
  from sklearn.preprocessing import StandardScaler
  from sklearn.preprocessing import normalize
  from sklearn.utils import check_array
  from .base import BaseDetector
label_desc: Use image node_id 4 for calling the RGraph obj's underlying member method code with example usage: obj.fit(X, y) and returns: self