Filter löschen
Filter löschen

Neural network training accuracy?

2 Ansichten (letzte 30 Tage)
Narges Sedre
Narges Sedre am 4 Dez. 2018
Bearbeitet: Greg Heath am 5 Dez. 2018
i want to make a plot of train accurancy how can i do that?
clc
clear all
close all
filename='FIFA7.xlsx';
A =xlsread(filename);
[m,n]=size(A);
T= A(:,1);
data= A(:,(2:end));
rows80=int32(floor(0.8 * m));
trainingset=A(1:rows80,:);
testset=A(rows80+1:end,:);
t=trainingset(1:rows80,1);
t_test=A(rows80+1:end,1);
% k=10;
%
% cvFolds = crossvalind('Kfold', t, k);
% for i = 1:k
% testIdx = (cvFolds == i);
% trainIdx = ~testIdx ;
% trInd=find(trainIdx)
% tstInd=find(testIdx)
% net.trainFcn = 'trainbr'
% net.trainParam.epochs = 100;
% net.divideFcn = 'divideind';
% net.divideParam.trainInd=trInd
% net.divideParam.testInd=tstInd
% Choose a Performance Function
% net.performFcn = 'mse'; % Mean squared error
% end
k=10
cvFolds = crossvalind('kfold',t,k);
for i =1:k
testIdx = (cvFolds == i);
trainIdx = ~testIdx ;
trInd=find(trainIdx)
tstInd=find(testIdx)
end
net= newff(trainingset',t');
y=sim(net,trainingset');
%net.trainParam.epoch=20;
net= train(net,trainingset',t');
y=sim(net,trainingset');
y_test=sim(net,testset');
p=0;
y1=hardlim(y');
y2= hardlims(y_test);
for(i=1:size(t,1))
if(t(i,:)==y1(i,:))
p=p+1;
end
end
trainerror =100*p/size(trainingset,1);
e=0;
y2=hardlim(y_test');
for(j=1:size(t_test,1))
if(t_test(j,:)==y2(j,:))
e=e+1;
end
end
testerror=100*e/size(t_test,1)
plot( testIdx ,'.');
  1 Kommentar
Greg Heath
Greg Heath am 5 Dez. 2018
Bearbeitet: Greg Heath am 5 Dez. 2018
  1. Does it really make sense to you to post tens of lines of code without a sample of relevant data ???
2. I think the best measures of regression accuracy are
NMSE = mse( t - y ) / mse( t - mean( t ))
and
RSQUARE = 1 - NMSE (See Wikipedia)
3. Then, the goodness of fit in [0 1 ] is IMMEDIATELY recognized !
Greg

Melden Sie sich an, um zu kommentieren.

Antworten (0)

Kategorien

Mehr zu Deep Learning Toolbox finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by