from sklearn.datasets import load_boston
boston = load_boston()
from matplotlib import pyplot as plt
plt.scatter(boston.data[:,5], boston.target, color='r')
import numpy as np
x = boston.data[:,5]
x = np.array([[v,1] for v in x])
y = boston.target
(slope, bias),total_error,_,_ = np.linalg.lstsq(x,y)
rmse = np.sqrt(total_error[0] / len(x))
It's a question that shows Boston housing data on a graph during example study, but if you enter the code above,
'rcond' parameter will change to the default of machine precision times ''max(m,n)'' where m and n are the input matrix dimensions.
To use the future default and silence this warning we advise to pass 'rcond=None', to keep using the old, explicitly pass 'rcond=-1'.
That's what it says.
Next, (slope, bias), total_error,_,_ = np.linalg.lstsq(x,y)
Only this is printed
I don't understand what you're saying and why doesn't it show up as a graph?
python regression matplotlib
No problem code.
The message is a warning that appears because of the version difference between the numpy version and the scikit learn. There is no problem with learning.
Try it as below.
from sklearn.datasets import load_boston
boston = load_boston()
from matplotlib import pyplot as plt
plt.scatter(boston.data[:,5], boston.target, color='r')
plt.show()
© 2024 OneMinuteCode. All rights reserved.