I was trying to create a loop to find out the variations in the accuracy scores of the train and test sets of Boston housing data set fitted with a Ridge regression model.
This was the for loop:
for i in range(1,20):
Ridge(alpha = 1/(10**i)).fit(X_train,y_train)
It showed a warning beginning from i=13.
The warning being:
LinAlgWarning: Ill-conditioned matrix (rcond=6.45912e-17): result may not be accurate.
overwrite_a=True).T
What is the meaning of this warning? And is it possible to get rid of it?
I checked to execute it separately without a loop, still didn't help.
#importing libraries and packages
import mglearn
from sklearn.model_selection import train_test_split
from sklearn.linear_model import Ridge
#importing boston housing dataset from mglearn
X,y = mglearn.datasets.load_extended_boston()
#Splitting the dataset
X_train,X_test,y_train,y_test = train_test_split(X,y,random_state=0)
#Fitting the training data using Ridge model with alpha = 1/(10**13)
rd = Ridge(alpha = 1/(10**13)).fit(X_train,y_train)
Shoudn't display the warning mentioned above for any value of i.