sklearn.linear model.BayesianRidge
Jump to navigation
Jump to search
A sklearn.linear_model.BayesianRidge is a Bayesian Ridge Regression System within sklearn.linear_model
class.
- AKA: BayesianRidge, linear_model.BayesianRidge.
- Context
- Usage:
- 1) Import Bayesian Ridge Regression model from scikit-learn :
from sklearn.linear_model import BayesianRidge
- 2) Create design matrix
X
and response vectorY
- 3) Create BayesianRidge object:
BRreg=BayesianRidge([n_iter=300, tol=0.001, alpha_1=1e-06, alpha_2=1e-06, lambda_1=1e-06, lambda_2=1e-06, compute_score=False, fit_intercept=True, normalize=False, copy_X=True, verbose=False])
- 4) Choose method(s):
- Fit the BayesianRidge model to the dataset:
BRreg.fit(X, Y[, check_input]))
- Predict Y using the linear model with estimated coefficients:
Y_pred = BREreg.predict(X)
- Return coefficient of determination (R^2) of the prediction:
BRreg.score(X,Y[, sample_weight=w])
- Get estimator parameters:
BRreg.get_params([deep])
- Set estimator parameters:
BRreg.set_params(**params)
- Fit the BayesianRidge model to the dataset:
- 1) Import Bayesian Ridge Regression model from scikit-learn :
- Example(s):
Input: | Output: |
#Importing modules
#Calculaton of RMSE and Explained Variances
# Printing Results
#plotting real vs predicted data pl.figure(1) pl.plot(yp, y,'ro') pl.plot(yp_cv, y,'bo', alpha=0.25, label='10-folds CV') pl.xlabel('predicted') pl.title('BR Regression') pl.ylabel('real') pl.grid(True) pl.show() |
|
- Counter-Example(s):
- See: Regression System, Regularization Task, Ridge Regression Task, Bayesian Analysis.
References
2017
- http://scikit-learn.org/stable/modules/generated/sklearn.linear_model.BayesianRidge.html
- QUOTE:
class sklearn.linear_model.BayesianRidge(n_iter=300, tol=0.001, alpha_1=1e-06, alpha_2=1e-06, lambda_1=1e-06, lambda_2=1e-06, compute_score=False, fit_intercept=True, normalize=False, copy_X=True, verbose=False)
Bayesian ridge regression
Fit a Bayesian ridge model and optimize the regularization parameters lambda (precision of the weights) and alpha (precision of the noise).
- QUOTE: