【发布时间】:2017-03-18 13:49:29
【问题描述】:
我相信我在纯 python 中计算 RMSE 时出错了。下面是代码。
y_true = [3, -0.5, 2, 7]
y_pred = [2.5, 0.0, 2, 8]
e = abs(np.matrix(y_pred) - np.matrix(y_true)).A1
ee = np.dot(e,e)
np.sqrt(ee.sum()/3)
This returns: 0.707
但是当我尝试使用 Sklearn 时
mean_squared_error(np.matrix(y_true),np.matrix(y_pred))**0.5
This returns: 0.612
知道发生了什么吗?很确定我的python代码是正确的。
【问题讨论】:
标签: python pandas numpy statistics scikit-learn