## 用户名 Email 自动登录 找回密码 密码 立即注册
 搜索 热搜: 活动 交友 discuz

# 分享一个MATLAB计算RMSE

1主题 17积分 17 发表于 2016-6-21 11:28:35 | 显示全部楼层 |阅读模式
 抄自mathworks function r = rmse(prediction,estimate) % generalized function from Felix Heder http://www.mathworks.com/matlabc ... rmse/content/rmse.m % Function to calculate root mean square error from a prediction vector or matrix % and the corresponding estimates. % Usage: r = rmse(data,estimate) % Note: predictions and estimates have to be of same size or estimate can be one % number % Example: r = rmse(randn(100,100),randn(100,100)) or r = rmse(randn(100,100),0) if numel(estimate) == 1 && numel(prediction) > 1     % delete records with NaNs in data first     I = ~isnan(prediction); else     % delete records with NaNs in both datasets first     I = ~isnan(prediction) & ~isnan(estimate);     estimate = estimate(I);    end prediction = prediction(I); r = sqrt(mean((prediction( -estimate( ).^2));

 您需要登录后才可以回帖 登录 | 立即注册 本版积分规则 回帖后跳转到最后一页

GMT+8, 2023-12-10 14:14 , Processed in 0.087504 second(s), 20 queries .