ARDRegression
- class sklearn.linear_model.ARDRegression(*, max_iter=300, tol=0.001, alpha_1=1e-06, alpha_2=1e-06, lambda_1=1e-06, lambda_2=, , , , ,
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.
Maximum number of iterations.
Stop the algorithm if w has converged.
Hyper-parameter : shape parameter for the Gamma distribution prior over the alpha parameter.
Hyper-parameter : inverse scale parameter (rate parameter) for the Gamma distribution prior over the alpha parameter.
Hyper-parameter : shape parameter for the Gamma distribution prior over the lambda parameter.
Hyper-parameter : inverse scale parameter (rate parameter) for the Gamma distribution prior over the lambda parameter.
If True, compute the objective function at each step of the model.
Threshold for removing (pruning) weights with high precision from the computation.
Whether 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).
If True, X will be copied; else, it may be overwritten.
Verbose mode when fitting the model.
Coefficients of the regression model (mean of distribution)
estimated precision of the noise.
estimated precisions of the weights.
estimated variance-covariance matrix of the weights
if computed, value of the objective function (to be maximized)
The actual number of iterations to reach the stopping criterion.
D. J. C. MacKay, Bayesian nonlinear modeling for the prediction competition, ASHRAE Transactions, 1994.
R. Salakhutdinov, Lecture notes on Statistical Machine Learning,
http://www.utstat.toronto.edu/~rsalakhu/sta4273/notes/Lecture2.pdf#page=15
Their beta is our self.alpha_
Their alpha is our self.lambda_
ARD is a little different than the slide: only dimensions/features for
which self.lambda_ < self.threshold_lambda are kept and the rest are
discarded.
>>> from sklearn import linear_model
>>> clf = linear_model.ARDRegression()
>>> clf.fit([[0,0], [1, 1], [2, 2]], [0, 1,
Comparing Linear Bayesian Regressors demonstrates ARD Regression.
L1-based models for Sparse Signals showcases ARD Regression alongside Lasso and Elastic-Net for sparse, correlated signals, in the presence of noise.
Fit the model according to the given training data and parameters.
Iterative procedure to maximize the evidence
Training vector, where n_samples is the number of samples and
n_features is the number of features.
Target values (integers). Will be cast to X’s dtype if necessary.
Get metadata routing of this object.
Please check User Guide on how the routing mechanism works.
A MetadataRequest encapsulating
routing information.
Get parameters for this estimator.
If True, will return the parameters for this estimator and contained subobjects that are estimators.
Parameter names mapped to their values.
Predict using the linear model.
In addition to the mean of the predictive distribution, also its standard deviation can be returned.
Samples.
Whether to return the standard deviation of posterior prediction.
Return coefficient of determination on test data.
The coefficient of determination, , is defined as , where is the residual sum of squares and is the total sum of squares . 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 , disregarding the input features, would get a score of 0.0.
Set the parameters of this estimator.
The method works on simple estimators as well as on nested objects
(such as Pipeline). The latter have
parameters of the form <component>__<parameter> so that it’s
possible to update each component of a nested object.
Estimator parameters.
Configure whether metadata should be requested to be passed to the method.
Configure whether metadata should be requested to be passed to the method.
Added in version 1.3.
Independent term in decision function. Set to 0.0 if
fit_intercept = False.
If fit_intercept=True, offset subtracted for centering data to a
zero mean. Set to np.zeros(n_features) otherwise.
Set to np.ones(n_features).
Number of features seen during fit.
n_features_in_,)Names of features seen during fit. Defined only when X
has feature names that are all strings.
Fitted estimator.
Mean of predictive distribution of query points.
Standard deviation of predictive distribution of query points.
((y_true - y_pred)** 2).sum()((y_true - y_true.mean()) ** 2).sum()yTest 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.
True values for X.
Sample weights.
of self.predict(X) w.r.t. y.
The score used when calling score on a regressor uses
multioutput='uniform_average' from version 0.23 to keep consistent
with default value of r2_score.
This influences the score method of all the multioutput
regressors (except for
MultiOutputRegressor).
Estimator instance.
Note that this method is only relevant when this estimator is used as a
sub-estimator within a meta-estimator and metadata routing is enabled
with enable_metadata_routing=True (see sklearn.set_config).
Please check the User Guide on how the routing
mechanism works.
The options for each parameter are:
True: metadata is requested, and passed to predict if provided. The request is ignored if metadata is not provided.
False: metadata is not requested and the meta-estimator will not pass it to predict.
None: metadata is not requested, and the meta-estimator will raise an error if the user provides it.
str: metadata should be passed to the meta-estimator with this given alias instead of the original name.
The default (sklearn.utils.metadata_routing.UNCHANGED) retains the
existing request. This allows you to change the request for some
parameters and not others.
Metadata routing for return_std parameter in predict.
The updated object.
Note that this method is only relevant when this estimator is used as a
sub-estimator within a meta-estimator and metadata routing is enabled
with enable_metadata_routing=True (see sklearn.set_config).
Please check the User Guide on how the routing
mechanism works.
The options for each parameter are:
True: metadata is requested, and passed to score if provided. The request is ignored if metadata is not provided.
False: metadata is not requested and the meta-estimator will not pass it to score.
None: metadata is not requested, and the meta-estimator will raise an error if the user provides it.
str: metadata should be passed to the meta-estimator with this given alias instead of the original name.
The default (sklearn.utils.metadata_routing.UNCHANGED) retains the
existing request. This allows you to change the request for some
parameters and not others.
Metadata routing for sample_weight parameter in score.
The updated object.