@@ -24,7 +24,7 @@ class RANSACRegressor(BaseEstimator, MetaEstimatorMixin, RegressorMixin):
2424
2525 Parameters
2626 ----------
27- estimator : object, optional
27+ base_estimator : object, optional
2828 Base estimator object which implements the following methods:
2929
3030 * `fit(X, y)`: Fit model to given training data and target values.
@@ -33,8 +33,8 @@ class RANSACRegressor(BaseEstimator, MetaEstimatorMixin, RegressorMixin):
3333 Additionally, the score is used to decide which of two equally
3434 large consensus sets is chosen as the better one.
3535
36- If estimator is None, then
37- ``estimator =sklearn.linear_model.LinearRegression()`` is used for
36+ If `base_estimator` is None, then
37+ ``base_estimator =sklearn.linear_model.LinearRegression()`` is used for
3838 target values of dtype float.
3939
4040 Note that the current implementation only supports regression
@@ -90,7 +90,7 @@ class RANSACRegressor(BaseEstimator, MetaEstimatorMixin, RegressorMixin):
9090 Attributes
9191 ----------
9292 estimator_ : object
93- Best fitted model (copy of the `estimator ` object).
93+ Best fitted model (copy of the `base_estimator ` object).
9494
9595 n_trials_ : int
9696 Number of random selection trials until one of the stop criteria is
@@ -106,13 +106,13 @@ class RANSACRegressor(BaseEstimator, MetaEstimatorMixin, RegressorMixin):
106106 .. [3] http://www.bmva.org/bmvc/2009/Papers/Paper355/Paper355.pdf
107107 """
108108
109- def __init__ (self , estimator = None , min_samples = None ,
109+ def __init__ (self , base_estimator = None , min_samples = None ,
110110 residual_threshold = None , is_data_valid = None ,
111111 is_model_valid = None , max_trials = 100 ,
112112 stop_n_inliers = np .inf , stop_score = np .inf ,
113113 residual_metric = None , random_state = None ):
114114
115- self .estimator = estimator
115+ self .base_estimator = base_estimator
116116 self .min_samples = min_samples
117117 self .residual_threshold = residual_threshold
118118 self .is_data_valid = is_data_valid
@@ -142,10 +142,10 @@ def fit(self, X, y):
142142 `max_trials` randomly chosen sub-samples.
143143
144144 """
145- if self .estimator is not None :
146- estimator = clone (self .estimator )
145+ if self .base_estimator is not None :
146+ base_estimator = clone (self .base_estimator )
147147 else :
148- estimator = LinearRegression ()
148+ base_estimator = LinearRegression ()
149149
150150 if self .min_samples is None :
151151 # assume linear model by default
@@ -178,7 +178,7 @@ def fit(self, X, y):
178178 random_state = check_random_state (self .random_state )
179179
180180 try : # Not all estimator accept a random_state
181- estimator .set_params (random_state = random_state )
181+ base_estimator .set_params (random_state = random_state )
182182 except ValueError :
183183 pass
184184
@@ -212,15 +212,15 @@ def fit(self, X, y):
212212 continue
213213
214214 # fit model for current random sample set
215- estimator .fit (X_subset , y_subset )
215+ base_estimator .fit (X_subset , y_subset )
216216
217217 # check if estimated model is valid
218218 if (self .is_model_valid is not None and not
219- self .is_model_valid (estimator , X_subset , y_subset )):
219+ self .is_model_valid (base_estimator , X_subset , y_subset )):
220220 continue
221221
222222 # residuals of all data for current random sample model
223- y_pred = estimator .predict (X )
223+ y_pred = base_estimator .predict (X )
224224 if y_pred .ndim == 1 :
225225 y_pred = y_pred [:, None ]
226226
@@ -240,7 +240,7 @@ def fit(self, X, y):
240240 y_inlier_subset = y [inlier_idxs_subset ]
241241
242242 # score of inlier data set
243- score_subset = estimator .score (X_inlier_subset ,
243+ score_subset = base_estimator .score (X_inlier_subset ,
244244 y_inlier_subset )
245245
246246 # same number of inliers but worse score -> skip current random
@@ -270,9 +270,9 @@ def fit(self, X, y):
270270 "constraints." )
271271
272272 # estimate final model using all inliers
273- estimator .fit (X_inlier_best , y_inlier_best )
273+ base_estimator .fit (X_inlier_best , y_inlier_best )
274274
275- self .estimator_ = estimator
275+ self .estimator_ = base_estimator
276276 self .inlier_mask_ = inlier_mask_best
277277
278278 def predict (self , X ):
0 commit comments