Search All of the Math Forum:
Views expressed in these public forums are not endorsed by
Drexel University or The Math Forum.



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. Kindly share your answer.
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.310413e003 Mean Squared Error [MSE]formula 2.975099e002
Manual output
p t output Error ErrorSq. 0 0 0.2761 0.2761 0.07623121 1 0.84 0.8399 1E04 1E08 2 0.91 0.9103 0.0003 9E08 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.97E02



