class sklearn.linear_model.RANSACRegressor(base_estimator=None, min_samples=None, residual_threshold=None, is_data_valid=None, is_model_valid=None, max_trials=100, max_skips=inf, stop_n_inliers=inf, stop_score=inf, stop_probability=0.99, loss=’absolute_loss’, random_state=None)
[source]
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 User Guide.
Parameters: |
|
---|---|
Attributes: |
|
[1] | https://en.wikipedia.org/wiki/RANSAC |
[2] | https://www.sri.com/sites/default/files/publications/ransac-publication.pdf |
[3] | http://www.bmva.org/bmvc/2009/Papers/Paper355/Paper355.pdf |
>>> from sklearn.linear_model import RANSACRegressor >>> from sklearn.datasets import make_regression >>> X, y = make_regression( ... n_samples=200, n_features=2, noise=4.0, random_state=0) >>> reg = RANSACRegressor(random_state=0).fit(X, y) >>> reg.score(X, y) 0.9885... >>> reg.predict(X[:1,]) array([-31.9417...])
fit (X, y[, sample_weight]) | Fit estimator using RANSAC algorithm. |
get_params ([deep]) | Get parameters for this estimator. |
predict (X) | Predict using the estimated model. |
score (X, y) | Returns the score of the prediction. |
set_params (**params) | Set the parameters of this estimator. |
__init__(base_estimator=None, min_samples=None, residual_threshold=None, is_data_valid=None, is_model_valid=None, max_trials=100, max_skips=inf, stop_n_inliers=inf, stop_score=inf, stop_probability=0.99, loss=’absolute_loss’, random_state=None)
[source]
fit(X, y, sample_weight=None)
[source]
Fit estimator using RANSAC algorithm.
Parameters: |
|
---|---|
Raises: |
|
get_params(deep=True)
[source]
Get parameters for this estimator.
Parameters: |
|
---|---|
Returns: |
|
predict(X)
[source]
Predict using the estimated model.
This is a wrapper for estimator_.predict(X)
.
Parameters: |
|
---|---|
Returns: |
|
score(X, y)
[source]
Returns the score of the prediction.
This is a wrapper for estimator_.score(X, y)
.
Parameters: |
|
---|---|
Returns: |
|
set_params(**params)
[source]
Set the parameters of this estimator.
The method works on simple estimators as well as on nested objects (such as pipelines). The latter have parameters of the form <component>__<parameter>
so that it’s possible to update each component of a nested object.
Returns: |
|
---|
sklearn.linear_model.RANSACRegressor
© 2007–2018 The scikit-learn developers
Licensed under the 3-clause BSD License.
http://scikit-learn.org/stable/modules/generated/sklearn.linear_model.RANSACRegressor.html