Class: 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.
Constructors
new QuantileRegressor()
new QuantileRegressor(
opts
?):QuantileRegressor
Parameters
Parameter | Type | Description |
---|---|---|
opts ? | object | - |
opts.alpha ? | number | Regularization constant that multiplies the L1 penalty term. |
opts.fit_intercept ? | boolean | Whether or not to fit the intercept. |
opts.quantile ? | number | The 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. |
opts.solver ? | "highs-ds" | "highs-ipm" | "highs" | "interior-point" | "revised simplex" | Method used by scipy.optimize.linprog 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. |
opts.solver_options ? | any | Additional parameters passed to scipy.optimize.linprog as options. If undefined and if solver='interior-point' , then {"lstsq": true} is passed to scipy.optimize.linprog for the sake of stability. |
Returns QuantileRegressor
Defined in generated/linear_model/QuantileRegressor.ts:27
Properties
Property | Type | Default value | Defined in |
---|---|---|---|
_isDisposed | boolean | false | generated/linear_model/QuantileRegressor.ts:25 |
_isInitialized | boolean | false | generated/linear_model/QuantileRegressor.ts:24 |
_py | PythonBridge | undefined | generated/linear_model/QuantileRegressor.ts:23 |
id | string | undefined | generated/linear_model/QuantileRegressor.ts:20 |
opts | any | undefined | generated/linear_model/QuantileRegressor.ts:21 |
Accessors
coef_
Get Signature
get coef_():
Promise
<any
[]>
Estimated coefficients for the features.
Returns Promise
<any
[]>
Defined in generated/linear_model/QuantileRegressor.ts:387
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/linear_model/QuantileRegressor.ts:468
intercept_
Get Signature
get intercept_():
Promise
<number
>
The intercept of the model, aka bias term.
Returns Promise
<number
>
Defined in generated/linear_model/QuantileRegressor.ts:414
n_features_in_
Get Signature
get n_features_in_():
Promise
<number
>
Number of features seen during fit.
Returns Promise
<number
>
Defined in generated/linear_model/QuantileRegressor.ts:441
n_iter_
Get Signature
get n_iter_():
Promise
<number
>
The actual number of iterations performed by the solver.
Returns Promise
<number
>
Defined in generated/linear_model/QuantileRegressor.ts:495
py
Get Signature
get py():
PythonBridge
Returns PythonBridge
Set Signature
set py(
pythonBridge
):void
Parameters
Parameter | Type |
---|---|
pythonBridge | PythonBridge |
Returns void
Defined in generated/linear_model/QuantileRegressor.ts:74
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/linear_model/QuantileRegressor.ts:128
fit()
fit(
opts
):Promise
<any
>
Fit the model according to the given training data.
Parameters
Parameter | Type | Description |
---|---|---|
opts | object | - |
opts.sample_weight ? | ArrayLike | Sample weights. |
opts.X ? | ArrayLike | Training data. |
opts.y ? | ArrayLike | Target values. |
Returns Promise
<any
>
Defined in generated/linear_model/QuantileRegressor.ts:145
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 MetadataRequest encapsulating routing information. |
Returns Promise
<any
>
Defined in generated/linear_model/QuantileRegressor.ts:191
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/linear_model/QuantileRegressor.ts:87
predict()
predict(
opts
):Promise
<any
>
Predict using the linear model.
Parameters
Parameter | Type | Description |
---|---|---|
opts | object | - |
opts.X ? | any | Samples. |
Returns Promise
<any
>
Defined in generated/linear_model/QuantileRegressor.ts:227
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/linear_model/QuantileRegressor.ts:263
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/linear_model/QuantileRegressor.ts:311
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
>