RMSE between original and predicted values.

Hi,
If I have thousand samples of my signal in a vector form like 1*1000, and I will predict my signal at each iteration that results into 1*1000 also. Then In this case, how will I find the RMSE of my model?
Many Thanks

 採用された回答

Star Strider
Star Strider 2020 年 1 月 18 日

0 投票

Please see my Comment replying to your Comment.

8 件のコメント

MAT-Magic
MAT-Magic 2020 年 1 月 18 日
Thank you very much Sir again for your kind help.
Star Strider
Star Strider 2020 年 1 月 18 日
As always, my pleasure!
MAT-Magic
MAT-Magic 2020 年 1 月 19 日
編集済み: MAT-Magic 2020 年 1 月 19 日
@ Star Strider, writing below code in for loop for RMSE. Is it correct way? waiting for your reply. Thanks
close all; clear all; clc;
v1 = [0.3 0.6 0.9];
v2 = [0.8 0.9 0.7];
for k = 1:length(v1)
y = v1-v2;
y1 = y.^2;
sumy1 = sum(y1);
end
RMSE = sqrt(sumy1/numel(v1));
Star Strider
Star Strider 2020 年 1 月 19 日
It is correct, however you can write it much more simply:
v1 = [0.3 0.6 0.9];
v2 = [0.8 0.9 0.7];
RMSE = sqrt(mean((v1-v2).^2))
producing:
RMSE =
0.355902608401044
Remembering that ‘RMSE’ means the ‘root of the mean of the squares’.
MAT-Magic
MAT-Magic 2020 年 1 月 20 日
Thanks. But actually, I am accumulating the error inside the loop, so after that, I can take the mean and square root outside the loop to get RMSE of my model.
Star Strider
Star Strider 2020 年 1 月 20 日
The RMSE calculation remains the same. You need to take the diferences, square them, accumulate them, take the mean, and the the square root of that.
MAT-Magic
MAT-Magic 2020 年 1 月 20 日
OK. Thanks alot
Star Strider
Star Strider 2020 年 1 月 20 日
As always, my pleasure!

サインインしてコメントする。

その他の回答 (1 件)

Image Analyst
Image Analyst 2020 年 1 月 18 日

0 投票

Without any other information, the maximum likelihood prediction for every element would be the mean of the entire signal. But it seems you'd rather have the rms, so you'd have
RMSE = rms(yourVector)
predictionVector = RMSE * ones(length(yourVector));

1 件のコメント

MAT-Magic
MAT-Magic 2020 年 1 月 18 日
Thanks for the reply.

サインインしてコメントする。

カテゴリ

ヘルプ センター および File ExchangeMATLAB についてさらに検索

製品

タグ

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by