MATLAB CODE FOR ANN is not producing the desired output,program code is given .

inputs = [31 9650.00 3300.00 4350.00]; targets = [11 21 31 51];
% Create a Fitting Network hiddenLayerSize = 20; net = fitnet(hiddenLayerSize);
% Setup Division of Data for Training, Validation, Testing % For a list of all data division functions type: help nndivide net.divideFcn = 'dividerand'; % Divide data randomly net.divideMode = 'sample'; % Divide up every sample net.divideParam.trainRatio = 70/100; net.divideParam.valRatio = 15/100; net.divideParam.testRatio = 15/100;
% For help on training function 'trainlm' type: help trainlm % For a list of all training functions type: help nntrain net.trainFcn = 'trainlm'; % Levenberg-Marquardt
% Choose a Performance Function % For a list of all performance functions type: help nnperformance net.performFcn = 'mse'; % Mean squared error
% Choose Plot Functions % For a list of all plot functions type: help nnplot net.plotFcns = {'plotperform','plottrainstate','ploterrhist', ... 'plotregression', 'plotfit'};
% Train the Network [net,tr] = train(net,inputs,targets);
% Test the Network outputs = net(inputs); errors = gsubtract(targets,outputs); performance = perform(net,targets,outputs)
% View the Network view(net) sim(net,outputs) % Plots % Uncomment these lines to enable various plots. %figure, plotperform(tr) %figure, plottrainstate(tr) %figure, plotfit(net,inputs,targets) %figure, plotregression(targets,outputs) %figure, ploterrhist(errors)
THE PROBLEM IS THAT I DONT GET OUTPUTS NEAR TO MY TARGETS

 Risposta accettata

The problem is that you do not have enough training data to sufficiently characterize a net of that size.
inputs = [31 9650.00 3300.00 4350.00];
targets = [11 21 31 51];
% Create a Fitting Network hiddenLayerSize = 20;
H=20
[ I N ] = size(inputs) % [ 1 4 ]
[ O N ] = size(targets) % [ 1 4 ]
Ntst = round(0.15^N) % 1
Nval = Ntst % 1
Ntrn = N-Nval-Ntst % 2
Ntrneq = N*O % 2 = No. of training equations
CORRECTION:
Ntrneq = Ntrn*O % 2 = No. of training equations
Nw = (I+1)*H+(H+1)*O % 61 = No. of unknown weights
Two equations are not enough to estimate 61 unknowns

2 Commenti

sir thnx alot for the answer
sir kindly tell me Nw=(I+1)*h+(h+1)*o
from where this eq has come.. and this Nw eq stands for every code
and ntreq also
Why didn't you search for the first few occurences in the NEWSGROUP and ANSWERS?
neural greg Nw
neural greg Ntrneq
How many training equations result from O output nodes and Ntrn input/target training pairs?
How many input weight/bias connections does each of h hidden nodes have from I input data nodes and 1 input bias node?
How many output weight/bias connections does each of O output nodes have from h hidden nodes and 1 output bias node?
Piece of cake! (just kidding)

Accedi per commentare.

Più risposte (0)

Categorie

Scopri di più su Deep Learning Toolbox in Centro assistenza e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by