2、衡量是否拟合了足够的信息:R²,越接近1越好
1) from sklearn.metrics import r2_score
r2_score(ytest,yhat)
2) reg.score(xtest,ytest)
3) cross_val_score(reg,x,y,cv=10,scoring="r2").mean()
R²为负说明模型拟合十分糟糕
2、衡量是否拟合了足够的信息:R²,越接近1越好
1) from sklearn.metrics import r2_score
r2_score(ytest,yhat)
2) reg.score(xtest,ytest)
3) cross_val_score(reg,x,y,cv=10,scoring="r2").mean()
R²为负说明模型拟合十分糟糕