Documentation
Classes
QuantileRegressor

QuantileRegressor

Linear regression model that predicts conditional quantiles.

The linear QuantileRegressor optimizes the pinball loss for a desired quantile and is robust to outliers.

This model uses an L1 regularization like Lasso.

Read more in the User Guide.

Python Reference (opens in a new tab)

Constructors

constructor()

Signature

new QuantileRegressor(opts?: object): QuantileRegressor;

Parameters

NameTypeDescription
opts?object-
opts.alpha?numberRegularization constant that multiplies the L1 penalty term. Default Value 1
opts.fit_intercept?booleanWhether or not to fit the intercept. Default Value true
opts.quantile?numberThe quantile that the model tries to predict. It must be strictly between 0 and 1. If 0.5 (default), the model predicts the 50% quantile, i.e. the median. Default Value 0.5
opts.solver?"highs-ds" | "highs-ipm" | "highs" | "interior-point" | "revised simplex"Method used by scipy.optimize.linprog (opens in a new tab) to solve the linear programming formulation. From scipy>=1.6.0, it is recommended to use the highs methods because they are the fastest ones. Solvers “highs-ds”, “highs-ipm” and “highs” support sparse input data and, in fact, always convert to sparse csc. From scipy>=1.11.0, “interior-point” is not available anymore. Default Value 'interior-point'
opts.solver_options?anyAdditional parameters passed to scipy.optimize.linprog (opens in a new tab) as options. If undefined and if solver='interior-point', then {"lstsq": true} is passed to scipy.optimize.linprog (opens in a new tab) for the sake of stability.

Returns

QuantileRegressor

Defined in: generated/linear_model/QuantileRegressor.ts:27 (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/linear_model/QuantileRegressor.ts:133 (opens in a new tab)

fit()

Fit the model according to the given training data.

Signature

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

Parameters

NameTypeDescription
optsobject-
opts.X?ArrayLikeTraining data.
opts.sample_weight?ArrayLikeSample weights.
opts.y?ArrayLikeTarget values.

Returns

Promise<any>

Defined in: generated/linear_model/QuantileRegressor.ts:150 (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/linear_model/QuantileRegressor.ts:201 (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/linear_model/QuantileRegressor.ts:87 (opens in a new tab)

predict()

Predict using the linear model.

Signature

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

Parameters

NameTypeDescription
optsobject-
opts.X?anySamples.

Returns

Promise<any>

Defined in: generated/linear_model/QuantileRegressor.ts:239 (opens in a new tab)

score()

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.

Signature

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

Parameters

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

Returns

Promise<number>

Defined in: generated/linear_model/QuantileRegressor.ts:276 (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/linear_model/QuantileRegressor.ts:329 (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/linear_model/QuantileRegressor.ts:371 (opens in a new tab)

Properties

_isDisposed

boolean = false

Defined in: generated/linear_model/QuantileRegressor.ts:25 (opens in a new tab)

_isInitialized

boolean = false

Defined in: generated/linear_model/QuantileRegressor.ts:24 (opens in a new tab)

_py

PythonBridge

Defined in: generated/linear_model/QuantileRegressor.ts:23 (opens in a new tab)

id

string

Defined in: generated/linear_model/QuantileRegressor.ts:20 (opens in a new tab)

opts

any

Defined in: generated/linear_model/QuantileRegressor.ts:21 (opens in a new tab)

Accessors

coef_

Estimated coefficients for the features.

Signature

coef_(): Promise<any[]>;

Returns

Promise<any[]>

Defined in: generated/linear_model/QuantileRegressor.ts:409 (opens in a new tab)

feature_names_in_

Names of features seen during fit. Defined only when X has feature names that are all strings.

Signature

feature_names_in_(): Promise<ArrayLike>;

Returns

Promise<ArrayLike>

Defined in: generated/linear_model/QuantileRegressor.ts:490 (opens in a new tab)

intercept_

The intercept of the model, aka bias term.

Signature

intercept_(): Promise<number>;

Returns

Promise<number>

Defined in: generated/linear_model/QuantileRegressor.ts:436 (opens in a new tab)

n_features_in_

Number of features seen during fit.

Signature

n_features_in_(): Promise<number>;

Returns

Promise<number>

Defined in: generated/linear_model/QuantileRegressor.ts:463 (opens in a new tab)

n_iter_

The actual number of iterations performed by the solver.

Signature

n_iter_(): Promise<number>;

Returns

Promise<number>

Defined in: generated/linear_model/QuantileRegressor.ts:517 (opens in a new tab)

py

Signature

py(): PythonBridge;

Returns

PythonBridge

Defined in: generated/linear_model/QuantileRegressor.ts:74 (opens in a new tab)

Signature

py(pythonBridge: PythonBridge): void;

Parameters

NameType
pythonBridgePythonBridge

Returns

void

Defined in: generated/linear_model/QuantileRegressor.ts:78 (opens in a new tab)