在计算平均误差之前,我应该将值正常化吗?

发布于 2025-02-02 15:43:33 字数 363 浏览 3 评论 0原文

我有一些数据,其中包括有关某种鱼类的宽度和重量的信息。我正在使用线性回归模型来预测重量输入宽度,我想计算模型的平方误差。

如果我使用 mean_squared_error scikit-learn 库提供的 y__test 列表的值和预测值的值, :

mse = metrics.mean_squared_error(y_test, preds)

我得到的平方误差约为5679.0812,这是超高的。但是,如果我在计算MSE之前将两个数组的值都归一化,则我将获得约7.3843e-05的可接受值。

在计算MSE之前将值归一化是一个好习惯吗?

谢谢。

I have some data that includes information about the width and weight of a certain species of fish. I'm using a linear regression model to predict the weight input width, and I wanted to compute the mean squared error of the model.

If I use the function mean_squared_error provided by the Scikit-learn library with the values of the y_test list and the values of the predictions, like so:

mse = metrics.mean_squared_error(y_test, preds)

I get a mean squared error of about 5679.0812, which is super high. However, if I normalize the values of both arrays before computing the MSE I get a much more acceptable value of about 7.3843e-05.

Is it a good practice to normalize the values before computing the MSE?

Thanks.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

和影子一齐双人舞 2025-02-09 15:43:33

在训练该算法之前,要归一化是一种很好的做法。

正常的正方形误差正常化正在操纵结果。您并没有以这种方式获得更好的分数。

It is a good practice to normalize before you train the algorithm.

Normalizing the mean square error is manipulating the results actually. Your are not getting a better score in that way.

大海や 2025-02-09 15:43:33

简短的答案是,在更改误差量表时,您不应该标准化数据,尤其是Y值。

MSE的平方根是预测的标准误差,这是对现实生活中使用此模型时将遇到的平均错误的估计,但是当您正常于Y值时,您只是在扩展标准误差预测,因此失去其含义。

short answer is you shouldn't standardize your data when it comes to linear regression, especially not the y values, as you are changing the error scale.

the square root of the MSE is the standard error of prediction, which is an estimate of the average error you will get when you use this model in real life, however when you are normalizing the y values, you are simply scaling your standard error of prediction, so it loses its meaning.

葵雨 2025-02-09 15:43:33

您应该意识到像MSE这样的错误度量是相对的。标准化后,您获得较低的MSE可能是因为y_testpreds中的实际值更大。

您的任务是解释MSE来评估您获得的价值是否适合您的特定问题。

祝你好运!

You should realise that an error measure like MSE is relative. You get a lower MSE after normalising probably because the actual values in y_test and preds are way larger.

It's your task to interpret the MSE to evaluate whether or not the value you get is reasonable for you specific problem.

Good luck!

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文