y_preditc=reg.predict(x_test) #reg是模型
mse_test=np.sum((y_preditc-y_test)**2)/len(y_test)
2:RMSE:
rmse_test=mse_test ** 0.5
3:MAE:
mae_test=np.sum(np.absolute(y_preditc-y_test))/len(y_test)
4:R2:
from sklearn.metrics import r2_score
r2_score(y_plot,RF_predict)'
5: scikit-learn:
from sklearn.metrics import mean_squared_error #均方误差
from sklearn.metrics import mean_absolute_error #平方绝对误差
from sklearn.metrics import r2_score#R square
#调用
mean_squared_error(y_test,y_predict)
mean_absolute_error(y_test,y_predict)
r2_score(y_test,y_predict)