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.
Constructors
new VotingRegressor()
new VotingRegressor(
opts?):VotingRegressor
Parameters
| Parameter | Type | Description |
|---|---|---|
opts? | object | - |
opts.estimators? | any | Invoking 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? | number | The 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? | boolean | If true, the time elapsed while fitting will be printed as it is completed. |
opts.weights? | ArrayLike | Sequence 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
| Property | Type | Default value | Defined in |
|---|---|---|---|
_isDisposed | boolean | false | generated/ensemble/VotingRegressor.ts:23 |
_isInitialized | boolean | false | generated/ensemble/VotingRegressor.ts:22 |
_py | PythonBridge | undefined | generated/ensemble/VotingRegressor.ts:21 |
id | string | undefined | generated/ensemble/VotingRegressor.ts:18 |
opts | any | undefined | generated/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
| Parameter | Type |
|---|---|
pythonBridge | PythonBridge |
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
| Parameter | Type | Description |
|---|---|---|
opts | object | - |
opts.fit_params? | any | Parameters to pass to the underlying estimators. |
opts.sample_weight? | ArrayLike | Sample weights. If undefined, then samples are equally weighted. Note that this is supported only if all underlying estimators support sample weights. |
opts.X? | ArrayLike | Training vectors, where n_samples is the number of samples and n_features is the number of features. |
opts.y? | ArrayLike | Target 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
| Parameter | Type | Description |
|---|---|---|
opts | object | - |
opts.fit_params? | any | Additional fit parameters. |
opts.X? | ArrayLike | Input samples. |
opts.y? | ArrayLike | Target 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
| Parameter | Type | Description |
|---|---|---|
opts | object | - |
opts.input_features? | any | Not 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
| Parameter | Type | Description |
|---|---|---|
opts | object | - |
opts.routing? | any | A 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
| Parameter | Type |
|---|---|
py | PythonBridge |
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
| Parameter | Type | Description |
|---|---|---|
opts | object | - |
opts.X? | ArrayLike | The 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
| Parameter | Type | Description |
|---|---|---|
opts | object | - |
opts.sample_weight? | ArrayLike | Sample 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? | ArrayLike | True 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
| Parameter | Type | Description |
|---|---|---|
opts | object | - |
opts.sample_weight? | string | boolean | Metadata 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
| Parameter | Type | Description |
|---|---|---|
opts | object | - |
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
| Parameter | Type | Description |
|---|---|---|
opts | object | - |
opts.sample_weight? | string | boolean | Metadata 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
| Parameter | Type | Description |
|---|---|---|
opts | object | - |
opts.X? | ArrayLike | The input samples. |
Returns Promise<ArrayLike[]>
Defined in generated/ensemble/VotingRegressor.ts:470