MATLAB Answers

Please I need help on how to demonstrate a reliable prediction (best ANN arch) without bias.

1 view (last 30 days)
Ikechukwu Ejim
Ikechukwu Ejim on 20 Feb 2020
I have my correlation coefficient for (validation, training and testing) and also trained between 10 - 30 neurons. I need help on how to predict using the best ANN architecture.
I saw error percentage difference in literature but can't seen to understand the code.
its %y (diff) = { ( t(i) - y(i) ) / y(i) } * 100
Any help would be appreciated.
load ('t.mat');
load ('x.mat');
x = input';
t = Target';
%% x = 18x100 double
%% t = 6x100 double
% Choose a Training Function
% For a list of all 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.
% Levenberg-Marquardt backpropagation.
trainFcn = 'trainlm';
%% Create a Fitting Network
hiddenLayerSize = 10;
net = fitnet(hiddenLayerSize,trainFcn);
%% Setup Division of Data for Training, Validation, Testing
[trainInd,valInd,testInd] = divideint(x,0.70,0.15,0.15);
%% Train the Network
net.performParam.regularization = 0.0001;
[net,tr] = train(net,x,t);
%% Number of validation checks
net.trainParam.min_grad
nntraintool
%%
% Test the Network
y = net(x);
e = gsubtract(t,y);
performance = perform(net,t,y);
perf = mse(net, t, y, 'regularization', 0.01);
perf = crossentropy(net,t,y,{1},'regularization',0.01);
%% Calculate network perfomance on test
tInd = tr.testInd
tsty = net(x(:,tInd))
tstPerform = perform(net,t(:,tInd),tsty)
%% Check train records
tr
%% View the Network diagram
view(net)
%% Plots
% Uncomment these lines to enable various plots.
trOut = y(tr.trainInd)
vOut = y(tr.valInd)
tsOut = y(tr.testInd)
trTarg = t(tr.trainInd)
vTarg = t(tr.valInd)
tsTarg = t(tr.testInd)
%% performance figure,
figure
plotperform(tr);
%% trainstate figure,
figure
plottrainstate(tr);
%% Errorhistogram figure,
figure
ploterrhist(e);
%% Regression figure,
figure
plotregression(trTarg, trOut, 'Train', vTarg, vOut, 'Validation', tsTarg, tsOut, 'Test', t,y, 'All');
%% Load nwc dat
newData_x=[20.79;69.71;0.02;0.9;37;0.6;0.5;0.002;62;14.7;7.20;63400909;87.4;1;585.15;82.53;146.59;-0.10947];
% Load Actual data
newData_y=[11.83;21.22;42.45;0.00085;24.24;0.2449];
% Train network with actual data data
Predicted_newData = sim(net,newData_x);

Answers (0)

Community Treasure Hunt

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

Start Hunting!