jeudi 9 janvier 2020

Why accuracy vary when I re-train Neural Network in Matlab using nprtool

Can anyone help me about Artificial Neural Network in Matlab. I run Neural Network using nprtool in Matlab. but why I got vary in accuracy (with range 40% - 88%) when I re-train. So, i still confused why which accuracy that i take ? because it has range 40% - 88%. and how to solve it?

here my data and this is my code :

    % Solve a Pattern Recognition Problem with a Neural Network
% Script generated by Neural Pattern Recognition app
% Created 30-Dec-2019 19:38:14
clc
clear all
% This script assumes these variables are defined:
%
%   data - input data.
%   label - target data.
I=xlsread('data_NN_85.xlsx');
t=I(17,:);
x=I(1:16,:);
% x = data;
% t = label;
load net50.mat

% Choose a Training Functio
% For a list of aMll training functions type: help nntrain
% 'trainlm' is usually fastest.
% 'trainbr' takes longer but may be better for challenging problems.
% 'trainscg' uses less memory. Suitable in low memory situations.
trainFcn = 'trainlm';  % Scaled conjugate gradient backpropagation.

% Create a Pattern Recognition Network
hiddenLayerSize = [10];
net = patternnet(hiddenLayerSize, trainFcn);

% Setup Division of Data for Training, Validation, Testing
net.divideParam.trainRatio = 70/100;
net.divideParam.valRatio = 15/100;
net.divideParam.testRatio = 15/100;

% Train the Network
[net,tr] = train(net,x,t);

% Test the Network
y = net(x);
e = gsubtract(t,y)
performance = perform(net,t,y)
tind = vec2ind(t)
yind = vec2ind(y)
percentErrors = sum(tind ~= yind)/numel(tind)

% View the Network
view(net)

% Plots
% Uncomment these lines to enable various plots.
%figure, plotperform(tr)
%figure, plottrainstate(tr)
%figure, ploterrhist(e)
%figure, plotconfusion(t,y)
%figure, plotroc(t,y)

Aucun commentaire:

Enregistrer un commentaire