DocumentationClassesVotingRegressor

Class: VotingRegressor

Prediction voting regressor for unfitted estimators.

A voting regressor is an ensemble meta-estimator that fits several base regressors, each on the whole dataset. Then it averages the individual predictions to form a final prediction.

Read more in the User Guide.

Python Reference

Constructors

new VotingRegressor()

new VotingRegressor(opts?): VotingRegressor

Parameters

ParameterTypeDescription
opts?object-
opts.estimators?anyInvoking the fit method on the VotingRegressor will fit clones of those original estimators that will be stored in the class attribute self.estimators_. An estimator can be set to 'drop' using set_params.
opts.n_jobs?numberThe number of jobs to run in parallel for fit. undefined means 1 unless in a joblib.parallel_backend context. \-1 means using all processors. See Glossary for more details.
opts.verbose?booleanIf true, the time elapsed while fitting will be printed as it is completed.
opts.weights?ArrayLikeSequence of weights (float or int) to weight the occurrences of predicted values before averaging. Uses uniform weights if undefined.

Returns VotingRegressor

Defined in generated/ensemble/VotingRegressor.ts:25

Properties

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

Accessors

estimators_

Get Signature

get estimators_(): Promise<any>

The collection of fitted sub-estimators as defined in estimators that are not ‘drop’.

Returns Promise<any>

Defined in generated/ensemble/VotingRegressor.ts:502


feature_names_in_

Get Signature

get feature_names_in_(): Promise<ArrayLike>

Names of features seen during fit. Only defined if the underlying estimators expose such an attribute when fit.

Returns Promise<ArrayLike>

Defined in generated/ensemble/VotingRegressor.ts:552


named_estimators_

Get Signature

get named_estimators_(): Promise<any>

Attribute to access any fitted sub-estimators by name.

Returns Promise<any>

Defined in generated/ensemble/VotingRegressor.ts:527


py

Get Signature

get py(): PythonBridge

Returns PythonBridge

Set Signature

set py(pythonBridge): void

Parameters

ParameterType
pythonBridgePythonBridge

Returns void

Defined in generated/ensemble/VotingRegressor.ts:52

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/ensemble/VotingRegressor.ts:104


fit()

fit(opts): Promise<any>

Fit the estimators.

Parameters

ParameterTypeDescription
optsobject-
opts.fit_params?anyParameters to pass to the underlying estimators.
opts.sample_weight?ArrayLikeSample weights. If undefined, then samples are equally weighted. Note that this is supported only if all underlying estimators support sample weights.
opts.X?ArrayLikeTraining vectors, where n_samples is the number of samples and n_features is the number of features.
opts.y?ArrayLikeTarget values.

Returns Promise<any>

Defined in generated/ensemble/VotingRegressor.ts:121


fit_transform()

fit_transform(opts): Promise<any[]>

Return class labels or probabilities for each estimator.

Return predictions for X for each estimator.

Parameters

ParameterTypeDescription
optsobject-
opts.fit_params?anyAdditional fit parameters.
opts.X?ArrayLikeInput samples.
opts.y?ArrayLikeTarget values (undefined for unsupervised transformations).

Returns Promise<any[]>

Defined in generated/ensemble/VotingRegressor.ts:170


get_feature_names_out()

get_feature_names_out(opts): Promise<any>

Get output feature names for transformation.

Parameters

ParameterTypeDescription
optsobject-
opts.input_features?anyNot used, present here for API consistency by convention.

Returns Promise<any>

Defined in generated/ensemble/VotingRegressor.ts:212


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/ensemble/VotingRegressor.ts:248


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/ensemble/VotingRegressor.ts:65


predict()

predict(opts): Promise<ArrayLike>

Predict regression target for X.

The predicted regression target of an input sample is computed as the mean predicted regression targets of the estimators in the ensemble.

Parameters

ParameterTypeDescription
optsobject-
opts.X?ArrayLikeThe input samples.

Returns Promise<ArrayLike>

Defined in generated/ensemble/VotingRegressor.ts:284


score()

score(opts): Promise<number>

Return the coefficient of determination of the prediction.

The coefficient of determination \(R^2\) is defined as \((1 - \frac{u}{v})\), where \(u\) is the residual sum of squares ((y_true \- y_pred)\*\* 2).sum() and \(v\) is the total sum of squares ((y_true \- y_true.mean()) \*\* 2).sum(). The best possible score is 1.0 and it can be negative (because the model can be arbitrarily worse). A constant model that always predicts the expected value of y, disregarding the input features, would get a \(R^2\) score of 0.0.

Parameters

ParameterTypeDescription
optsobject-
opts.sample_weight?ArrayLikeSample weights.
opts.X?ArrayLike[]Test samples. For some estimators this may be a precomputed kernel matrix or a list of generic objects instead with shape (n_samples, n_samples_fitted), where n_samples_fitted is the number of samples used in the fitting for the estimator.
opts.y?ArrayLikeTrue values for X.

Returns Promise<number>

Defined in generated/ensemble/VotingRegressor.ts:318


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/ensemble/VotingRegressor.ts:364


set_output()

set_output(opts): Promise<any>

Set output container.

See Introducing the set_output API for an example on how to use the API.

Parameters

ParameterTypeDescription
optsobject-
opts.transform?"default" | "pandas" | "polars"Configure output of transform and fit_transform.

Returns Promise<any>

Defined in generated/ensemble/VotingRegressor.ts:400


set_score_request()

set_score_request(opts): Promise<any>

Request metadata passed to the score 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 score.

Returns Promise<any>

Defined in generated/ensemble/VotingRegressor.ts:436


transform()

transform(opts): Promise<ArrayLike[]>

Return predictions for X for each estimator.

Parameters

ParameterTypeDescription
optsobject-
opts.X?ArrayLikeThe input samples.

Returns Promise<ArrayLike[]>

Defined in generated/ensemble/VotingRegressor.ts:470