计算r中的相对RMSE [英] Calculate relative RMSE in r

查看:49
本文介绍了计算r中的相对RMSE的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

为了获得我的预测模型和真实值的相对RMSE,我使用了代码

To get the relative RMSE of my predicted model and true values,I used the code

ratio<-prediction1/ISEtrain  

rRMSE1<-sqrt(mean((1-ratio)^2))

但是我失败了,输出为"[1] Inf".我的代码有什么问题?

but I failed , with the output "[1] Inf". What is wrong with my code?

谢谢!

推荐答案

由于除以零,因此得到 Inf .

You are getting Inf because you are dividing by zero.

遵循Wikipedia对标准化RMSE的定义( https://en.wikipedia.org/wiki/Root-mean-square_deviation ),您可能需要:

Following Wikipedia's definition of the normalized RMSE (https://en.wikipedia.org/wiki/Root-mean-square_deviation), you probably want:

sqrt( mean( (prediction1-ISEtrain)^2) ) / ( max(ISEtrain)-min(ISEtrain) )

这篇关于计算r中的相对RMSE的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆