机器学习模型问题
作者:互联网
划分train
from sklearn.model_selection import train_test_split
X_train, X_test, y_train, y_test = train_test_split(train, target, random_state=1)
构造LinearRegression的模型
from sklearn import linear_model ridgeRegression = linear_model.Ridge()
ridgeRegression.fit(X_train, y_train)
预测
y_pred = ridgeRegression.predict(X_test)
mean_squared_error值
msn = np.sqrt(mean_squared_error(y_test, y_pred))
mean_squared_error越小越好
标签:机器,ridgeRegression,模型,squared,学习,train,error,test,mean 来源: https://www.cnblogs.com/wzwi/p/10862120.html