我正在尝试使用pandas数据框计算一个指标。特别地,我得到了一个结果对象。
prediction = results.predict(start=1,end=len(test),exog=test)
实际的值在一个数据框中给出。
test['actual'].
我需要计算两个东西:
How can I compute the sum of squares of errors? So basically, I would be doing an element by element subtraction and then summing the squares of these.
How can I compute the sum of squares of the predicted minus the mean of the actual values? So it would be
(x1-mean_actual)^2 + (x2-mean_actual)^2...+(xn-mean_actual)^2
sum(...)
比.sum()
慢?使用np.sum(...)
可以正确地执行吗? - Roman Pekar