DocumentationClassesDummyRegressor

Class: DummyRegressor

Regressor that makes predictions using simple rules.

This regressor is useful as a simple baseline to compare with other (real) regressors. Do not use it for real problems.

Read more in the User Guide.

Python Reference

Constructors

new DummyRegressor()

new DummyRegressor(opts?): DummyRegressor

Parameters

ParameterTypeDescription
opts?object-
opts.constant?number | ArrayLikeThe explicit constant as predicted by the “constant” strategy. This parameter is useful only for the “constant” strategy.
opts.quantile?numberThe quantile to predict using the “quantile” strategy. A quantile of 0.5 corresponds to the median, while 0.0 to the minimum and 1.0 to the maximum.
opts.strategy?"quantile" | "constant" | "mean" | "median"Strategy to use to generate predictions.

Returns DummyRegressor

Defined in generated/dummy/DummyRegressor.ts:25

Properties

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

Accessors

constant_

Get Signature

get constant_(): Promise<ArrayLike[]>

Mean or median or quantile of the training targets or constant value given by the user.

Returns Promise<ArrayLike[]>

Defined in generated/dummy/DummyRegressor.ts:391


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/dummy/DummyRegressor.ts:441


n_features_in_

Get Signature

get n_features_in_(): Promise<number>

Number of features seen during fit.

Returns Promise<number>

Defined in generated/dummy/DummyRegressor.ts:416


n_outputs_

Get Signature

get n_outputs_(): Promise<number>

Number of outputs.

Returns Promise<number>

Defined in generated/dummy/DummyRegressor.ts:466


py

Get Signature

get py(): PythonBridge

Returns PythonBridge

Set Signature

set py(pythonBridge): void

Parameters

ParameterType
pythonBridgePythonBridge

Returns void

Defined in generated/dummy/DummyRegressor.ts:47

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/dummy/DummyRegressor.ts:99


fit()

fit(opts): Promise<any>

Fit the random regressor.

Parameters

ParameterTypeDescription
optsobject-
opts.sample_weight?ArrayLikeSample weights.
opts.X?ArrayLike[]Training data.
opts.y?ArrayLikeTarget values.

Returns Promise<any>

Defined in generated/dummy/DummyRegressor.ts:116


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 MetadataRequest encapsulating routing information.

Returns Promise<any>

Defined in generated/dummy/DummyRegressor.ts:160


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/dummy/DummyRegressor.ts:60


predict()

predict(opts): Promise<ArrayLike>

Perform classification on test vectors X.

Parameters

ParameterTypeDescription
optsobject-
opts.return_std?booleanWhether to return the standard deviation of posterior prediction. All zeros in this case.
opts.X?ArrayLike[]Test data.

Returns Promise<ArrayLike>

Defined in generated/dummy/DummyRegressor.ts:194


score()

score(opts): Promise<number>

Return the coefficient of determination R^2 of the prediction.

The coefficient R^2 is defined as (1 \- 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. Passing undefined as test samples gives the same result as passing real test samples, since DummyRegressor operates independently of the sampled observations.
opts.y?ArrayLikeTrue values for X.

Returns Promise<number>

Defined in generated/dummy/DummyRegressor.ts:235


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/dummy/DummyRegressor.ts:281


set_predict_request()

set_predict_request(opts): Promise<any>

Request metadata passed to the predict 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.return_std?string | booleanMetadata routing for return_std parameter in predict.

Returns Promise<any>

Defined in generated/dummy/DummyRegressor.ts:319


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/dummy/DummyRegressor.ts:357