如何获得RMSE值

问题描述 投票:0回答:1

我已经满足了等式。现在我想要RMSE值

q3_1=data1[['bedrooms', 'bathrooms', 'sqft_living', 'sqft_lot', 'floors', 'zipcode']]

q3_2=data1[['bedrooms', 'bathrooms', 'sqft_living', 'sqft_lot', 'floors','zipcode','condition','grade','waterfront','view','sqft_above','sqft_basement','yr_built','yr_renovated',              
'lat', 'long','sqft_living15','sqft_lot15']]

reg = LinearRegression()

reg.fit(q3_1,data1.price)

reg.fit(q3_2,data1.price)

我无法从这里继续。在这两种情况下,我都需要RMSE值。

python-3.x machine-learning linear-regression
1个回答
0
投票

据我所知,您正在Google Colab上使用TensorFlow。

我不确定您的LinearRegression对象是什么,但我想它是一个具有单个节点的Keras模型。

因此,我有一个问题,如何使用具有不同架构的数据集训练同一模型(您的reg实例)-一个包含6列,另一个包含16列?

顺便说一句,在训练/拟合过程中,keras可以为您提供时代的MSE,如果提供验证数据集,还可以为您提供验证MSE。最后,您可以使用evaluate方法:

返回模型的损失值和指标值[...]

仅使用“ mean_squared_error”指标。


编辑

在使用evaluate时,您必须自己照顾度量标准。您可以使用scikit-learn方法从训练有素的模型针对数据集获取预测。然后,有predict度量标准可以直接使用。

predict
© www.soinside.com 2019 - 2024. All rights reserved.