Documentation
Classes
DummyRegressor

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 (opens in a new tab)

Constructors

constructor()

Signature

new DummyRegressor(opts?: object): DummyRegressor;

Parameters

NameTypeDescription
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. Default Value 'mean'

Returns

DummyRegressor

Defined in: generated/dummy/DummyRegressor.ts:25 (opens in a new tab)

Methods

dispose()

Disposes of the underlying Python resources.

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

Signature

dispose(): Promise<void>;

Returns

Promise<void>

Defined in: generated/dummy/DummyRegressor.ts:102 (opens in a new tab)

fit()

Fit the random regressor.

Signature

fit(opts: object): Promise<any>;

Parameters

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

Returns

Promise<any>

Defined in: generated/dummy/DummyRegressor.ts:119 (opens in a new tab)

get_metadata_routing()

Get metadata routing of this object.

Please check User Guide on how the routing mechanism works.

Signature

get_metadata_routing(opts: object): Promise<any>;

Parameters

NameTypeDescription
optsobject-
opts.routing?anyA MetadataRequest encapsulating routing information.

Returns

Promise<any>

Defined in: generated/dummy/DummyRegressor.ts:168 (opens in a new tab)

init()

Initializes the underlying Python resources.

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

Signature

init(py: PythonBridge): Promise<void>;

Parameters

NameType
pyPythonBridge

Returns

Promise<void>

Defined in: generated/dummy/DummyRegressor.ts:60 (opens in a new tab)

predict()

Perform classification on test vectors X.

Signature

predict(opts: object): Promise<ArrayLike>;

Parameters

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

Returns

Promise<ArrayLike>

Defined in: generated/dummy/DummyRegressor.ts:203 (opens in a new tab)

score()

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.

Signature

score(opts: object): Promise<number>;

Parameters

NameTypeDescription
optsobject-
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.sample_weight?ArrayLikeSample weights.
opts.y?ArrayLikeTrue values for X.

Returns

Promise<number>

Defined in: generated/dummy/DummyRegressor.ts:247 (opens in a new tab)

set_fit_request()

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:

Signature

set_fit_request(opts: object): Promise<any>;

Parameters

NameTypeDescription
optsobject-
opts.sample_weight?string | booleanMetadata routing for sample\_weight parameter in fit.

Returns

Promise<any>

Defined in: generated/dummy/DummyRegressor.ts:298 (opens in a new tab)

set_predict_request()

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:

Signature

set_predict_request(opts: object): Promise<any>;

Parameters

NameTypeDescription
optsobject-
opts.return_std?string | booleanMetadata routing for return\_std parameter in predict.

Returns

Promise<any>

Defined in: generated/dummy/DummyRegressor.ts:337 (opens in a new tab)

set_score_request()

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:

Signature

set_score_request(opts: object): Promise<any>;

Parameters

NameTypeDescription
optsobject-
opts.sample_weight?string | booleanMetadata routing for sample\_weight parameter in score.

Returns

Promise<any>

Defined in: generated/dummy/DummyRegressor.ts:376 (opens in a new tab)

Properties

_isDisposed

boolean = false

Defined in: generated/dummy/DummyRegressor.ts:23 (opens in a new tab)

_isInitialized

boolean = false

Defined in: generated/dummy/DummyRegressor.ts:22 (opens in a new tab)

_py

PythonBridge

Defined in: generated/dummy/DummyRegressor.ts:21 (opens in a new tab)

id

string

Defined in: generated/dummy/DummyRegressor.ts:18 (opens in a new tab)

opts

any

Defined in: generated/dummy/DummyRegressor.ts:19 (opens in a new tab)

Accessors

constant_

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

Signature

constant_(): Promise<ArrayLike[]>;

Returns

Promise<ArrayLike[]>

Defined in: generated/dummy/DummyRegressor.ts:412 (opens in a new tab)

n_outputs_

Number of outputs.

Signature

n_outputs_(): Promise<number>;

Returns

Promise<number>

Defined in: generated/dummy/DummyRegressor.ts:437 (opens in a new tab)

py

Signature

py(): PythonBridge;

Returns

PythonBridge

Defined in: generated/dummy/DummyRegressor.ts:47 (opens in a new tab)

Signature

py(pythonBridge: PythonBridge): void;

Parameters

NameType
pythonBridgePythonBridge

Returns

void

Defined in: generated/dummy/DummyRegressor.ts:51 (opens in a new tab)