单变量线性回归-04 模型评价

先设置y_test与y_pred的可视化

plt.figure(figsize=(10,6))
t = np.arange(len(X_test))
plt.plot(t,y_test,linewidth=2, label='y_test')
plt.plot(t,y_pred,label='y_pred')
plt.legend()
plt.show()

 

评价方法:

from sklearn import metrics
from sklearn.metrics import r2_score

lr.score(X_test,y_test)
r2_score(y_test,y_halt)

  

posted @ 2020-06-11 00:08  Crazylight  阅读(36)  评论(0)    收藏  举报