Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

To resolve issues starting MATLAB on Mac OS X 10.10 (Yosemite) visit: http://www.mathworks.com/matlabcentral/answers/159016

changing number of neurons

Asked by FIR on 2 Jul 2013

I a working on neural network,i have trained data and have tested itnow i want to increse the value of neurons,plz tell how to change the number of neurons

http://tinypic.com/r/qnr9mq/5

as above

kindly assist

0 Comments

FIR

Products

No products are associated with this question.

1 Answer

Answer by Greg Heath on 4 Jul 2013
Edited by Greg Heath on 4 Jul 2013
Accepted answer
 close all, clear all, clc
 tic
 [ x, t ] = simplefit_dataset;
 MSE00    = mean(var(t',1)) % Constant output reference
 Hmin     = 0
 dH       = 1
 Hmax     = 5
 Ntrials  = 10 
 j        = 0
 for h = Hmin:dH:Hmax
   j = j+1;
   if h == 0
      net = fitnet([]); % Linear Model
   else
       net = fitnet(h);
   end
   for i = 1: Ntrials
       Hiddennodes    = h
       Trial          = i
       net            = configure( net, x, t);
       [net tr y ]    = train(net, x, t);
       stopcrit{i,j}  = tr.stop;
       bestepoch(i,j) = tr.best_epoch;
       NMSE           = mse(t-y)/MSE00;% Normalization
       R2(i,j)        = 1-NMSE;        % Rsquare: See Wikipedia 
    end
 end
 stopcrit  = stopcrit
 bestepoch = bestepoch
 R2        = R2
 toc

Hope this helps

Thank you for formally accepting my answer

Greg

0 Comments

Greg Heath

Contact us