Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
calculate root mean square error

Subject: calculate root mean square error

From: david

Date: 14 Mar, 2011 16:57:04

Message: 1 of 5

Hello all,
I have a question about how to calculate the root meas square error when we have a time series and we want to predict one step a head by a neural network:
for example ;
let we have y =(1 , 2 , 3 , 4 , 85 , 6 , 7 , 8 , 9 ,10 , 11 , 12 , 13 , 14 , 15 ,16)
as time series and we divded it into two sets : training set trset=(1,2,......10) and a test set =(11,12,...16). After I have constructed my neural network and traind it i want to evaluate the generalisation error on the test set so I calculated yhat as the neural network outputs on the test set. now to calculate the RMSE error :
root mean square error= ((sum((yhat-y(1,trset+1:16)).^2))/(16 -trset))^.5
or by this relation :
 root mean square error= ((sum((yhat-y(1,trset+1:16)).^2))/(16))^.5
what is the correct relation ? the first where we divide by (16-trset= 16-10=6) or the second where we divide by 16 .

Thanks in advance

david

Subject: calculate root mean square error

From: david

Date: 15 Mar, 2011 08:43:04

Message: 2 of 5

??

Subject: calculate root mean square error

From: Nasser M. Abbasi

Date: 15 Mar, 2011 09:15:47

Message: 3 of 5

On 3/15/2011 1:43 AM, david wrote:
> ??

Just use the definition:

--------------------
N = 10;
A = rand(N,1);

rms = sqrt(sum(A.^2)/N)
-----------------

--Nasser

Subject: calculate root mean square error

From: Nasser M. Abbasi

Date: 15 Mar, 2011 09:22:35

Message: 4 of 5

On 3/15/2011 2:15 AM, Nasser M. Abbasi wrote:
> On 3/15/2011 1:43 AM, david wrote:
>> ??


I found one on matlab central which is probably what you want

http://www.mathworks.com/matlabcentral/fileexchange/21383-rmse

"calculates root mean square error from data vector or matrix and the corresponding estimates."


--Nasser

Subject: calculate root mean square error

From: Greg Heath

Date: 21 Mar, 2011 06:31:12

Message: 5 of 5

On Mar 14, 12:57 pm, "david " <david.sabine...@gmail.com> wrote:
> Hello all,
> I have a question about how to calculate the root meas square error when we have a time series and we want to predict one step a head by aneuralnetwork:
> for example ;
> let we have y =(1 , 2 , 3 , 4 , 85 , 6 , 7 , 8 , 9 ,10 , 11 , 12 , 13 , 14 , 15 ,16)
> as time series and we divded it into two sets : training set trset=(1,2,......10)

Here you have defined trset as a sequence, not as a length.

and a test set =(11,12,...16). After I have constructed
myneuralnetwork and traind it i want to evaluate the generalisation
error on the test set so I calculated yhat as theneuralnetwork outputs
on the test set. now to  calculate the RMSE error :

ptrn = y(1:9);
ttrn = y(2:10);
Ntrn = length(ptrn) % 9

ptst = y(10:15);
ttst = y(11:16);

ytst = sim(net,ptst);
etst = ttst-ytst;
MSEtst = mse(etst)
RMSEtst = sqrt(MSEtst)

> root mean square error= ((sum((yhat-y(1,trset+1:16)).^2))/(16 -trset))^.5
> or by this relation :
>  root mean square error= ((sum((yhat-y(1,trset+1:16)).^2))/(16))^.5
> what is the correct relation ? the first where we divide by (16-trset= 16-10=6) or the second where we divide by 16  .
>
> Thanks in advance
>
> david

See above.

Hope this helps.

Greg

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us