Search All of the Math Forum:

Views expressed in these public forums are not endorsed by NCTM or The Math Forum.

Notice: We are no longer accepting new posts, but the forums will continue to be readable.

Topic: neural network
Replies: 1   Last Post: Apr 22, 2014 5:11 AM

 Messages: [ Previous | Next ]
 Murugan Solaiyappan Posts: 53 Registered: 12/4/10
neural network
Posted: Apr 17, 2014 6:34 PM

Dear matlab friends,

While I am training the net, the mse value is differ.
I want to know the working principles of mse function in matlab tool.
I am writing the code with mse function and without using mse function (i.e. fromula)

But, the output is differ.

Here is my code

clc;
clear;
close all;
p = [0 1 2 3 4 5 6 7 8 9];
t = [0 0.84 0.91 0.14 -0.77 -0.96 -0.28 0.66 0.99 0.77];

net = newff(p,t,10);
net.trainParam.epochs = 50;
net.trainParam.goal = 0.01;
[net tr Y E] = train(net,p,t);
y1 = sim(net,p);

%calculating MSE system call
fprintf('Mean Squared Error [MSE] %d\n',mse(E));

%Calculating MSE by using formula');

sum_mse=0;

for i=1:6
e(i)=t(i)-y1(i);
temp=(e(i)*e(i));
sum_mse=sum_mse+temp ;
end
fprintf('Mean Squared Error [MSE] formula %d\n',sum_mse/6);

the output is,

Mean Squared Error [MSE] 1.310413e-003
Mean Squared Error [MSE]formula 2.975099e-002

Manual output

p t output Error ErrorSq.
0 0 -0.2761 0.2761 0.07623121
1 0.84 0.8399 1E-04 1E-08
2 0.91 0.9103 -0.0003 9E-08
3 0.14 0.4473 -0.3073 0.09443329
4 -0.77 -0.6961 -0.0739 0.00546121
5 -0.96 -1.0083 0.0483 0.00233289
6 -0.28
7 0.66
8 0.99
9 0.77
mse= 2.97E-02

Date Subject Author
4/17/14 Murugan Solaiyappan
4/22/14 Greg Heath