Class: MultiOutputRegressor
Multi target regression.
This strategy consists of fitting one regressor per target. This is a simple strategy for extending regressors that do not natively support multi-target regression.
Constructors
new MultiOutputRegressor()
new MultiOutputRegressor(
opts
?):MultiOutputRegressor
Parameters
Parameter | Type | Description |
---|---|---|
opts ? | object | - |
opts.estimator ? | any | An estimator object implementing fit and predict. |
opts.n_jobs ? | number | The number of jobs to run in parallel. fit , predict and partial_fit (if supported by the passed estimator) will be parallelized for each target. When individual estimators are fast to train or predict, using n_jobs > 1 can result in slower performance due to the parallelism overhead. undefined means 1 unless in a joblib.parallel_backend context. \-1 means using all available processes / threads. See Glossary for more details. |
Returns MultiOutputRegressor
Defined in generated/multioutput/MultiOutputRegressor.ts:23
Properties
Property | Type | Default value | Defined in |
---|---|---|---|
_isDisposed | boolean | false | generated/multioutput/MultiOutputRegressor.ts:21 |
_isInitialized | boolean | false | generated/multioutput/MultiOutputRegressor.ts:20 |
_py | PythonBridge | undefined | generated/multioutput/MultiOutputRegressor.ts:19 |
id | string | undefined | generated/multioutput/MultiOutputRegressor.ts:16 |
opts | any | undefined | generated/multioutput/MultiOutputRegressor.ts:17 |
Accessors
estimators_
Get Signature
get estimators_():
Promise
<any
>
Estimators used for predictions.
Returns Promise
<any
>
Defined in generated/multioutput/MultiOutputRegressor.ts:455
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/multioutput/MultiOutputRegressor.ts:509
n_features_in_
Get Signature
get n_features_in_():
Promise
<number
>
Number of features seen during fit. Only defined if the underlying estimator
exposes such an attribute when fit.
Returns Promise
<number
>
Defined in generated/multioutput/MultiOutputRegressor.ts:482
py
Get Signature
get py():
PythonBridge
Returns PythonBridge
Set Signature
set py(
pythonBridge
):void
Parameters
Parameter | Type |
---|---|
pythonBridge | PythonBridge |
Returns void
Defined in generated/multioutput/MultiOutputRegressor.ts:42
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/multioutput/MultiOutputRegressor.ts:98
fit()
fit(
opts
):Promise
<any
>
Fit the model to data, separately for each output variable.
Parameters
Parameter | Type | Description |
---|---|---|
opts | object | - |
opts.fit_params ? | any | Parameters passed to the estimator.fit method of each step. |
opts.sample_weight ? | ArrayLike | Sample weights. If undefined , then samples are equally weighted. Only supported if the underlying regressor supports sample weights. |
opts.X ? | ArrayLike | The input data. |
opts.y ? | ArrayLike | Multi-output targets. An indicator matrix turns on multilabel estimation. |
Returns Promise
<any
>
Defined in generated/multioutput/MultiOutputRegressor.ts:115
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/multioutput/MultiOutputRegressor.ts:166
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/multioutput/MultiOutputRegressor.ts:55
partial_fit()
partial_fit(
opts
):Promise
<any
>
Incrementally fit the model to data, for each output variable.
Parameters
Parameter | Type | Description |
---|---|---|
opts | object | - |
opts.partial_fit_params ? | any | Parameters passed to the estimator.partial_fit method of each sub-estimator. Only available if enable_metadata_routing=True . See the User Guide. |
opts.sample_weight ? | ArrayLike | Sample weights. If undefined , then samples are equally weighted. Only supported if the underlying regressor supports sample weights. |
opts.X ? | ArrayLike | The input data. |
opts.y ? | ArrayLike | Multi-output targets. |
Returns Promise
<any
>
Defined in generated/multioutput/MultiOutputRegressor.ts:202
predict()
predict(
opts
):Promise
<ArrayLike
>
Predict multi-output variable using model for each target variable.
Parameters
Parameter | Type | Description |
---|---|---|
opts | object | - |
opts.X ? | ArrayLike | The input data. |
Returns Promise
<ArrayLike
>
Defined in generated/multioutput/MultiOutputRegressor.ts:255
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/multioutput/MultiOutputRegressor.ts:291
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/multioutput/MultiOutputRegressor.ts:339
set_partial_fit_request()
set_partial_fit_request(
opts
):Promise
<any
>
Request metadata passed to the partial_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 partial_fit . |
Returns Promise
<any
>
Defined in generated/multioutput/MultiOutputRegressor.ts:379
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/multioutput/MultiOutputRegressor.ts:419