Documentation
Classes
ARDRegression

ARDRegression

Bayesian ARD regression.

Fit the weights of a regression model, using an ARD prior. The weights of the regression model are assumed to be in Gaussian distributions. Also estimate the parameters lambda (precisions of the distributions of the weights) and alpha (precision of the distribution of the noise). The estimation is done by an iterative procedures (Evidence Maximization)

Read more in the User Guide.

Python Reference (opens in a new tab)

Constructors

constructor()

Signature

new ARDRegression(opts?: object): ARDRegression;

Parameters

NameTypeDescription
opts?object-
opts.alpha_1?numberHyper-parameter : shape parameter for the Gamma distribution prior over the alpha parameter. Default Value 0.000001
opts.alpha_2?numberHyper-parameter : inverse scale parameter (rate parameter) for the Gamma distribution prior over the alpha parameter. Default Value 0.000001
opts.compute_score?booleanIf true, compute the objective function at each step of the model. Default Value false
opts.copy_X?booleanIf true, X will be copied; else, it may be overwritten. Default Value true
opts.fit_intercept?booleanWhether to calculate the intercept for this model. If set to false, no intercept will be used in calculations (i.e. data is expected to be centered). Default Value true
opts.lambda_1?numberHyper-parameter : shape parameter for the Gamma distribution prior over the lambda parameter. Default Value 0.000001
opts.lambda_2?numberHyper-parameter : inverse scale parameter (rate parameter) for the Gamma distribution prior over the lambda parameter. Default Value 0.000001
opts.max_iter?numberMaximum number of iterations. If undefined, it corresponds to max\_iter=300.
opts.n_iter?numberMaximum number of iterations.
opts.threshold_lambda?numberThreshold for removing (pruning) weights with high precision from the computation. Default Value 10
opts.tol?numberStop the algorithm if w has converged. Default Value 0.001
opts.verbose?booleanVerbose mode when fitting the model. Default Value false

Returns

ARDRegression

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

fit()

Fit the model according to the given training data and parameters.

Iterative procedure to maximize the evidence

Signature

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

Parameters

NameTypeDescription
optsobject-
opts.X?ArrayLike[]Training vector, where n\_samples is the number of samples and n\_features is the number of features.
opts.y?ArrayLikeTarget values (integers). Will be cast to X’s dtype if necessary.

Returns

Promise<any>

Defined in: generated/linear_model/ARDRegression.ts:194 (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/ARDRegression.ts:236 (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/ARDRegression.ts:123 (opens in a new tab)

predict()

Predict using the linear model.

In addition to the mean of the predictive distribution, also its standard deviation can be returned.

Signature

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

Parameters

NameTypeDescription
optsobject-
opts.X?ArrayLikeSamples.
opts.return_std?booleanWhether to return the standard deviation of posterior prediction. Default Value false

Returns

Promise<ArrayLike>

Defined in: generated/linear_model/ARDRegression.ts:273 (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/ARDRegression.ts:317 (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/linear_model/ARDRegression.ts:368 (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/ARDRegression.ts:407 (opens in a new tab)

Properties

_isDisposed

boolean = false

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

_isInitialized

boolean = false

Defined in: generated/linear_model/ARDRegression.ts:22 (opens in a new tab)

_py

PythonBridge

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

id

string

Defined in: generated/linear_model/ARDRegression.ts:18 (opens in a new tab)

opts

any

Defined in: generated/linear_model/ARDRegression.ts:19 (opens in a new tab)

Accessors

X_offset_

If fit\_intercept=True, offset subtracted for centering data to a zero mean. Set to np.zeros(n_features) otherwise.

Signature

X_offset_(): Promise<number>;

Returns

Promise<number>

Defined in: generated/linear_model/ARDRegression.ts:605 (opens in a new tab)

X_scale_

Set to np.ones(n_features).

Signature

X_scale_(): Promise<number>;

Returns

Promise<number>

Defined in: generated/linear_model/ARDRegression.ts:630 (opens in a new tab)

alpha_

estimated precision of the noise.

Signature

alpha_(): Promise<number>;

Returns

Promise<number>

Defined in: generated/linear_model/ARDRegression.ts:465 (opens in a new tab)

coef_

Coefficients of the regression model (mean of distribution)

Signature

coef_(): Promise<ArrayLike>;

Returns

Promise<ArrayLike>

Defined in: generated/linear_model/ARDRegression.ts:442 (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/ARDRegression.ts:680 (opens in a new tab)

intercept_

Independent term in decision function. Set to 0.0 if fit\_intercept \= False.

Signature

intercept_(): Promise<number>;

Returns

Promise<number>

Defined in: generated/linear_model/ARDRegression.ts:580 (opens in a new tab)

lambda_

estimated precisions of the weights.

Signature

lambda_(): Promise<ArrayLike>;

Returns

Promise<ArrayLike>

Defined in: generated/linear_model/ARDRegression.ts:488 (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/ARDRegression.ts:655 (opens in a new tab)

n_iter_

The actual number of iterations to reach the stopping criterion.

Signature

n_iter_(): Promise<number>;

Returns

Promise<number>

Defined in: generated/linear_model/ARDRegression.ts:557 (opens in a new tab)

py

Signature

py(): PythonBridge;

Returns

PythonBridge

Defined in: generated/linear_model/ARDRegression.ts:110 (opens in a new tab)

Signature

py(pythonBridge: PythonBridge): void;

Parameters

NameType
pythonBridgePythonBridge

Returns

void

Defined in: generated/linear_model/ARDRegression.ts:114 (opens in a new tab)

scores_

if computed, value of the objective function (to be maximized)

Signature

scores_(): Promise<number>;

Returns

Promise<number>

Defined in: generated/linear_model/ARDRegression.ts:534 (opens in a new tab)

sigma_

estimated variance-covariance matrix of the weights

Signature

sigma_(): Promise<ArrayLike[]>;

Returns

Promise<ArrayLike[]>

Defined in: generated/linear_model/ARDRegression.ts:511 (opens in a new tab)