Scikit-Learn
40
X = rng.randn(n_samples, n_features)
rdg = Ridge(alpha=0.5)
rdg.fit(X, y)
rdg.score(X,y)
Output
0.76294987
The output shows that the above Ridge Regression model gave the score of around 76
percent. For more accuracy, we can increase the number of samples and features.
For the above example, we can get the weight vector with the help of following python
script:
rdg.coef_
Output
array([ 0.32720254, -0.34503436, -0.2913278 , 0.2693125 , -0.22832508,
-0.8635094 , -0.17079403, -0.36288055, -0.17241081, -0.43136046])
Similarly, we can get the value of intercept with the help of following python script:
rdg.intercept_
Dostları ilə paylaş: