class_docstr: RANSAC (RANdom SAmple Consensus) algorithm.
  
  RANSAC is an iterative algorithm for the robust estimation of parameters
  from a subset of inliers from the complete data set. More information can
  be found in the general documentation of linear models.
  
  A detailed description of the algorithm can be found in the documentation
  of the ``linear_model`` sub-package.
  
  Read more in the :ref:`User Guide <ransac_regression>`.
  
  Parameters
  ----------
  base_estimator : object, optional
      Base estimator object which implements the following methods:
  
       * `fit(X, y)`: Fit model to given training data and target values.
       * `score(X, y)`: Returns the mean accuracy on the given test data,
         which is used for the stop criterion defined by `stop_score`.
         Additionally, the score is used to decide which of two equally
         large consensus sets is chosen as the better one.
  
      If `base_estimator` is None, then
      ``base_estimator=sklearn.linear_model.LinearRegression()`` is used for
      target values of dtype float.
  
      Note that the current implementation only supports regression
      estimators.
  
  min_samples : int (>= 1) or float ([0, 1]), optional
      Minimum number of samples chosen randomly from original data. Treated
      as an absolute number of samples for `min_samples >= 1`, treated as a
      relative number `ceil(min_samples * X.shape[0]`) for
      `min_samples < 1`. This is typically chosen as the minimal number of
      samples necessary to estimate the given `base_estimator`. By default a
      ``sklearn.linear_model.LinearRegression()`` estimator is assumed and
      `min_samples` is chosen as ``X.shape[1] + 1``.
  
  residual_threshold : float, optional
      Maximum residual for a data sample to be classified as an inlier.
      By default the threshold is chosen as the MAD (median absolute
      deviation) of the target values `y`.
  
  is_data_valid : callable, optional
      This function is called with the randomly selected data before the
      model is fitted to it: `is_data_valid(X, y)`. If its return value is
      False the current randomly chosen sub-sample is skipped.
  
  is_model_valid : callable, optional
      This function is called with the estimated model and the randomly
      selected data: `is_model_valid(model, X, y)`. If its return value is
      False the current randomly chosen sub-sample is skipped.
      Rejecting samples with this function is computationally costlier than
      with `is_data_valid`. `is_model_valid` should therefore only be used if
      the estimated model is needed for making the rejection decision.
  
  max_trials : int, optional
      Maximum number of iterations for random sample selection.
  
  stop_n_inliers : int, optional
      Stop iteration if at least this number of inliers are found.
  
  stop_score : float, optional
      Stop iteration if score is greater equal than this threshold.
  
  stop_probability : float in range [0, 1], optional
      RANSAC iteration stops if at least one outlier-free set of the training
      data is sampled in RANSAC. This requires to generate at least N
      samples (iterations)::
  
          N >= log(1 - probability) / log(1 - e**m)
  
      where the probability (confidence) is typically set to high value such
      as 0.99 (the default) and e is the current fraction of inliers w.r.t.
      the total number of samples.
  
  residual_metric : callable, optional
      Metric to reduce the dimensionality of the residuals to 1 for
      multi-dimensional target values ``y.shape[1] > 1``. By default the sum
      of absolute differences is used::
  
          lambda dy: np.sum(np.abs(dy), axis=1)
  
      NOTE: residual_metric is deprecated from 0.18 and will be removed in 0.20
      Use ``loss`` instead.
  
  loss : string, callable, optional, default "absolute_loss"
      String inputs, "absolute_loss" and "squared_loss" are supported which
      find the absolute loss and squared loss per sample
      respectively.
  
      If ``loss`` is a callable, then it should be a function that takes
      two arrays as inputs, the true and predicted value and returns a 1-D
      array with the ``i``th value of the array corresponding to the loss
      on `X[i]`.
  
      If the loss on a sample is greater than the ``residual_threshold``, then
      this sample is classified as an outlier.
  
  random_state : integer or numpy.RandomState, optional
      The generator used to initialize the centers. If an integer is
      given, it fixes the seed. Defaults to the global numpy random
      number generator.
  
  Attributes
  ----------
  estimator_ : object
      Best fitted model (copy of the `base_estimator` object).
  
  n_trials_ : int
      Number of random selection trials until one of the stop criteria is
      met. It is always ``<= max_trials``.
  
  inlier_mask_ : bool array of shape [n_samples]
      Boolean mask of inliers classified as ``True``.
  
  References
  ----------
  .. [1] https://en.wikipedia.org/wiki/RANSAC
  .. [2] http://www.cs.columbia.edu/~belhumeur/courses/compPhoto/ransac.pdf
  .. [3] http://www.bmva.org/bmvc/2009/Papers/Paper355/Paper355.pdf
class_docstr_tok: ["RANSAC","(","RANdom","SAmple","Consensus",")","algorithm",".","RANSAC","is","an","iterative","algorithm","for","the","robust","estimation","of","parameters","from","a","subset","of","inliers","from","the","complete","data","set",".","More","information","can","be","found","in","the","general","documentation","of","linear","models",".","A","detailed","description","of","the","algorithm","can","be","found","in","the","documentation","of","the","``","linear_model","``","sub-package",".","Read","more","in","the",":","ref",":","`","User","Guide","<","ransac_regression",">","`",".","Parameters","--","--","--","--","--","base_estimator",":","object",",","optional","Base","estimator","object","which","implements","the","following","methods",":","*","`","fit","(","X",",","y",")","`",":","Fit","model","to","given","training","data","and","target","values",".","*","`","score","(","X",",","y",")","`",":","Returns","the","mean","accuracy","on","the","given","test","data",",","which","is","used","for","the","stop","criterion","defined","by","`","stop_score","`",".","Additionally",",","the","score","is","used","to","decide","which","of","two","equally","large","consensus","sets","is","chosen","as","the","better","one",".","If","`","base_estimator","`","is","None",",","then","``","base_estimator=sklearn.linear_model.LinearRegression","(",")","``","is","used","for","target","values","of","dtype","float",".","Note","that","the","current","implementation","only","supports","regression","estimators",".","min_samples",":","int","(",">","=","1",")","or","float","(","[","0",",","1","]",")",",","optional","Minimum","number","of","samples","chosen","randomly","from","original","data",".","Treated","as","an","absolute","number","of","samples","for","`","min_samples",">","=","1","`",",","treated","as","a","relative","number","`","ceil","(","min_samples","*","X.shape","[","0","]","`",")","for","`","min_samples","<","1","`",".","This","is","typically","chosen","as","the","minimal","number","of","samples","necessary","to","estimate","the","given","`","base_estimator","`",".","By","default","a","``","sklearn.linear_model.LinearRegression","(",")","``","estimator","is","assumed","and","`","min_samples","`","is","chosen","as","``","X.shape","[","1","]","+","1","``",".","residual_threshold",":","float",",","optional","Maximum","residual","for","a","data","sample","to","be","classified","as","an","inlier",".","By","default","the","threshold","is","chosen","as","the","MAD","(","median","absolute","deviation",")","of","the","target","values","`","y","`",".","is_data_valid",":","callable",",","optional","This","function","is","called","with","the","randomly","selected","data","before","the","model","is","fitted","to","it",":","`","is_data_valid","(","X",",","y",")","`",".","If","its","return","value","is","False","the","current","randomly","chosen","sub-sample","is","skipped",".","is_model_valid",":","callable",",","optional","This","function","is","called","with","the","estimated","model","and","the","randomly","selected","data",":","`","is_model_valid","(","model",",","X",",","y",")","`",".","If","its","return","value","is","False","the","current","randomly","chosen","sub-sample","is","skipped",".","Rejecting","samples","with","this","function","is","computationally","costlier","than","with","`","is_data_valid","`",".","`","is_model_valid","`","should","therefore","only","be","used","if","the","estimated","model","is","needed","for","making","the","rejection","decision",".","max_trials",":","int",",","optional","Maximum","number","of","iterations","for","random","sample","selection",".","stop_n_inliers",":","int",",","optional","Stop","iteration","if","at","least","this","number","of","inliers","are","found",".","stop_score",":","float",",","optional","Stop","iteration","if","score","is","greater","equal","than","this","threshold",".","stop_probability",":","float","in","range","[","0",",","1","]",",","optional","RANSAC","iteration","stops","if","at","least","one","outlier-free","set","of","the","training","data","is","sampled","in","RANSAC",".","This","requires","to","generate","at","least","N","samples","(","iterations",")",":",":","N",">","=","log","(","1","-","probability",")","\/","log","(","1","-","e","*","*","m",")","where","the","probability","(","confidence",")","is","typically","set","to","high","value","such","as","0.99","(","the","default",")","and","e","is","the","current","fraction","of","inliers","w.r.t",".","the","total","number","of","samples",".","residual_metric",":","callable",",","optional","Metric","to","reduce","the","dimensionality","of","the","residuals","to","1","for","multi-dimensional","target","values","``","y.shape","[","1","]",">","1","``",".","By","default","the","sum","of","absolute","differences","is","used",":",":","lambda","dy",":","np.sum","(","np.abs","(","dy",")",",","axis=1",")","NOTE",":","residual_metric","is","deprecated","from","0.18","and","will","be","removed","in","0.20","Use","``","loss","``","instead",".","loss",":","string",",","callable",",","optional",",","default","``","absolute_loss","''","String","inputs",",","``","absolute_loss","''","and","``","squared_loss","''","are","supported","which","find","the","absolute","loss","and","squared","loss","per","sample","respectively",".","If","``","loss","``","is","a","callable",",","then","it","should","be","a","function","that","takes","two","arrays","as","inputs",",","the","true","and","predicted","value","and","returns","a","1-D","array","with","the","``","i","``","th","value","of","the","array","corresponding","to","the","loss","on","`","X","[","i","]","`",".","If","the","loss","on","a","sample","is","greater","than","the","``","residual_threshold","``",",","then","this","sample","is","classified","as","an","outlier",".","random_state",":","integer","or","numpy.RandomState",",","optional","The","generator","used","to","initialize","the","centers",".","If","an","integer","is","given",",","it","fixes","the","seed",".","Defaults","to","the","global","numpy","random","number","generator",".","Attributes","--","--","--","--","--","estimator_",":","object","Best","fitted","model","(","copy","of","the","`","base_estimator","`","object",")",".","n_trials_",":","int","Number","of","random","selection","trials","until","one","of","the","stop","criteria","is","met",".","It","is","always","``","<","=","max_trials","``",".","inlier_mask_",":","bool","array","of","shape","[","n_samples","]","Boolean","mask","of","inliers","classified","as","``","True","``",".","References","--","--","--","--","--","..","[","1","]","https",":","\/\/en.wikipedia.org\/wiki\/RANSAC","..","[","2","]","http",":","\/\/www.cs.columbia.edu\/~belhumeur\/courses\/compPhoto\/ransac.pdf","..","[","3","]","http",":","\/\/www.bmva.org\/bmvc\/2009\/Papers\/Paper355\/Paper355.pdf"]
code: def __init__(
      self,
      base_estimator=None,
      min_samples=None,
      residual_threshold=None,
      is_data_valid=None,
      is_model_valid=None,
      max_trials=100,
      stop_n_inliers=np.inf,
      stop_score=np.inf,
      stop_probability=0.99,
      residual_metric=None,
      loss="absolute_loss",
      random_state=None,
  ):
      self.base_estimator = base_estimator
      self.min_samples = min_samples
      self.residual_threshold = residual_threshold
      self.is_data_valid = is_data_valid
      self.is_model_valid = is_model_valid
      self.max_trials = max_trials
      self.stop_n_inliers = stop_n_inliers
      self.stop_score = stop_score
      self.stop_probability = stop_probability
      self.residual_metric = residual_metric
      self.random_state = random_state
      self.loss = loss
  
file_path: catboost/contrib/python/scikit-learn/py2/sklearn/linear_model/ransac.py
imports: import numpy
  import warnings
  from ..base import BaseEstimator, MetaEstimatorMixin, RegressorMixin, clone
  from ..utils import check_random_state, check_array, check_consistent_length
  from ..utils.random import sample_without_replacement
  from ..utils.validation import check_is_fitted
  from .base import LinearRegression
  from ..utils.validation import has_fit_parameter
label_desc: Use image node_id 1 to create a new RANSACRegressor object from inherited base classes: BaseEstimator, MetaEstimatorMixin, RegressorMixin with example: obj = RANSACRegressor(base_estimator, min_samples, residual_threshold, is_data_valid, is_model_valid, max_trials, stop_n_inliers, stop_score, stop_probability, residual_metric, loss, random_state)