Scikit-Learn


Attributes  Followings table consist the attributes used by  BayesianRidge



Yüklə 1,92 Mb.
Pdf görüntüsü
səhifə39/124
tarix23.02.2023
ölçüsü1,92 Mb.
#101394
1   ...   35   36   37   38   39   40   41   42   ...   124
sklearn

Attributes 
Followings table consist the attributes used by 
BayesianRidge
module: 
Attributes 
Description 
coef_
: array, shape = n_features 
This attribute provides the weight vectors.
intercept_
: float
It represents the independent term in decision 
function. 
alpha_
: float 
This attribute provides the estimated precision of 
the noise. 


Scikit-Learn
42 
lambda_
: float 
This attribute provides the estimated precision of 
the weight. 
n_iter_
: int 
It provides the actual number of iterations taken 
by the algorithm to reach the stopping criterion. 
sigma_
: array, shape = (n_features, 
n_features) 
It provides the estimated variance-covariance 
matrix of the weights. 
scores_
: array, shape = (n_iter_+1) 
It provides the value of the log marginal likelihood 
at each iteration of the optimisation. In the 
resulting score, the array starts with the value of 
the log marginal likelihood obtained for the initial 
values of 
𝛼 𝑎𝑛𝑑 𝜆
, and ends with the value obtained 
for estimated 
𝛼 𝑎𝑛𝑑 𝜆

Implementation Example 
Following Python script provides a simple example of fitting Bayesian Ridge Regression 
model using sklearn 
BayesianRidge
module. 
from sklearn import linear_model 
X = [[0, 0], [1, 1], [2, 2], [3, 3]] 
Y = [0, 1, 2, 3] 
BayReg = linear_model.BayesianRidge() 
BayReg.fit(X, Y) 
Output 
BayesianRidge(alpha_1=1e-06, alpha_2=1e-06, compute_score=False, copy_X=True, 
fit_intercept=True, lambda_1=1e-06, lambda_2=1e-06, n_iter=300, 
normalize=False, tol=0.001, verbose=False) 
From the above output, we can check model’s parameters used in the calculation.
Now, once fitted, the model can predict new values as follows: 
BayReg.predict([[1,1]]) 

Yüklə 1,92 Mb.

Dostları ilə paylaş:
1   ...   35   36   37   38   39   40   41   42   ...   124




Verilənlər bazası müəlliflik hüququ ilə müdafiə olunur ©genderi.org 2024
rəhbərliyinə müraciət

    Ana səhifə