DocumentationClassesRANSACRegressor

Class: RANSACRegressor

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.

Read more in the User Guide.

Python Reference

Constructors

new RANSACRegressor()

new RANSACRegressor(opts?): RANSACRegressor

Parameters

ParameterTypeDescription
opts?object-
opts.estimator?anyBase estimator object which implements the following methods:
opts.is_data_valid?anyThis 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.
opts.is_model_valid?anyThis 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.
opts.loss?stringString inputs, ‘absolute_error’ and ‘squared_error’ are supported which find the absolute error and squared error 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.
opts.max_skips?numberMaximum number of iterations that can be skipped due to finding zero inliers or invalid data defined by is_data_valid or invalid models defined by is_model_valid.
opts.max_trials?numberMaximum number of iterations for random sample selection.
opts.min_samples?numberMinimum 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 estimator. By default a LinearRegression estimator is assumed and min_samples is chosen as X.shape\[1\] + 1. This parameter is highly dependent upon the model, so if a estimator other than LinearRegression is used, the user must provide a value.
opts.random_state?numberThe generator used to initialize the centers. Pass an int for reproducible output across multiple function calls. See Glossary.
opts.residual_threshold?numberMaximum 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. Points whose residuals are strictly equal to the threshold are considered as inliers.
opts.stop_n_inliers?numberStop iteration if at least this number of inliers are found.
opts.stop_probability?numberRANSAC 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):
opts.stop_score?numberStop iteration if score is greater equal than this threshold.

Returns RANSACRegressor

Defined in generated/linear_model/RANSACRegressor.ts:25

Properties

PropertyTypeDefault valueDefined in
_isDisposedbooleanfalsegenerated/linear_model/RANSACRegressor.ts:23
_isInitializedbooleanfalsegenerated/linear_model/RANSACRegressor.ts:22
_pyPythonBridgeundefinedgenerated/linear_model/RANSACRegressor.ts:21
idstringundefinedgenerated/linear_model/RANSACRegressor.ts:18
optsanyundefinedgenerated/linear_model/RANSACRegressor.ts:19

Accessors

estimator_

Get Signature

get estimator_(): Promise<any>

Best fitted model (copy of the estimator object).

Returns Promise<any>

Defined in generated/linear_model/RANSACRegressor.ts:373


feature_names_in_

Get Signature

get feature_names_in_(): Promise<ArrayLike>

Names of features seen during fit. Defined only when X has feature names that are all strings.

Returns Promise<ArrayLike>

Defined in generated/linear_model/RANSACRegressor.ts:548


inlier_mask_

Get Signature

get inlier_mask_(): Promise<any>

Boolean mask of inliers classified as true.

Returns Promise<any>

Defined in generated/linear_model/RANSACRegressor.ts:423


n_features_in_

Get Signature

get n_features_in_(): Promise<number>

Number of features seen during fit.

Returns Promise<number>

Defined in generated/linear_model/RANSACRegressor.ts:523


n_skips_invalid_data_

Get Signature

get n_skips_invalid_data_(): Promise<number>

Number of iterations skipped due to invalid data defined by is_data_valid.

Returns Promise<number>

Defined in generated/linear_model/RANSACRegressor.ts:473


n_skips_invalid_model_

Get Signature

get n_skips_invalid_model_(): Promise<number>

Number of iterations skipped due to an invalid model defined by is_model_valid.

Returns Promise<number>

Defined in generated/linear_model/RANSACRegressor.ts:498


n_skips_no_inliers_

Get Signature

get n_skips_no_inliers_(): Promise<number>

Number of iterations skipped due to finding zero inliers.

Returns Promise<number>

Defined in generated/linear_model/RANSACRegressor.ts:448


n_trials_

Get Signature

get n_trials_(): Promise<number>

Number of random selection trials until one of the stop criteria is met. It is always <= max_trials.

Returns Promise<number>

Defined in generated/linear_model/RANSACRegressor.ts:398


py

Get Signature

get py(): PythonBridge

Returns PythonBridge

Set Signature

set py(pythonBridge): void

Parameters

ParameterType
pythonBridgePythonBridge

Returns void

Defined in generated/linear_model/RANSACRegressor.ts:100

Methods

dispose()

dispose(): Promise<void>

Disposes of the underlying Python resources.

Once dispose() is called, the instance is no longer usable.

Returns Promise<void>

Defined in generated/linear_model/RANSACRegressor.ts:152


fit()

fit(opts): Promise<any>

Fit estimator using RANSAC algorithm.

Parameters

ParameterTypeDescription
optsobject-
opts.fit_params?anyParameters routed to the fit method of the sub-estimator via the metadata routing API.
opts.sample_weight?ArrayLikeIndividual weights for each sample raises error if sample_weight is passed and estimator fit method does not support it.
opts.X?ArrayLikeTraining data.
opts.y?ArrayLikeTarget values.

Returns Promise<any>

Defined in generated/linear_model/RANSACRegressor.ts:169


get_metadata_routing()

get_metadata_routing(opts): Promise<any>

Get metadata routing of this object.

Please check User Guide on how the routing mechanism works.

Parameters

ParameterTypeDescription
optsobject-
opts.routing?anyA MetadataRouter encapsulating routing information.

Returns Promise<any>

Defined in generated/linear_model/RANSACRegressor.ts:218


init()

init(py): Promise<void>

Initializes the underlying Python resources.

This instance is not usable until the Promise returned by init() resolves.

Parameters

ParameterType
pyPythonBridge

Returns Promise<void>

Defined in generated/linear_model/RANSACRegressor.ts:113


predict()

predict(opts): Promise<any>

Predict using the estimated model.

This is a wrapper for estimator_.predict(X).

Parameters

ParameterTypeDescription
optsobject-
opts.params?anyParameters routed to the predict method of the sub-estimator via the metadata routing API.
opts.X?any[]Input data.

Returns Promise<any>

Defined in generated/linear_model/RANSACRegressor.ts:254


score()

score(opts): Promise<number>

Return the score of the prediction.

This is a wrapper for estimator_.score(X, y).

Parameters

ParameterTypeDescription
optsobject-
opts.params?anyParameters routed to the score method of the sub-estimator via the metadata routing API.
opts.X?any[]Training data.
opts.y?ArrayLikeTarget values.

Returns Promise<number>

Defined in generated/linear_model/RANSACRegressor.ts:293


set_fit_request()

set_fit_request(opts): Promise<any>

Request metadata passed to the fit method.

Note that this method is only relevant if enable_metadata_routing=True (see sklearn.set_config). Please see User Guide on how the routing mechanism works.

The options for each parameter are:

Parameters

ParameterTypeDescription
optsobject-
opts.sample_weight?string | booleanMetadata routing for sample_weight parameter in fit.

Returns Promise<any>

Defined in generated/linear_model/RANSACRegressor.ts:339