MAKHFI.COM
Fascinating World of Neural Nets  
Neural Network Forums
Home PageHome Page : General Neural Networks Topics : Pattern Recognition Slow Training
  You are currently not logged in. You can view the forums, but cannot post messages. | HOME | Log In | Register | Search | Help
Post a Reply on This Topic Post a Reply on This Topic

Author Topic: Pattern Recognition Slow Training
jleeman Posted: 16-Apr-11 11:38
  Edit Edit
 
Email the Author Mail   View Author's Profile Profile  
Hello all. I'm new to the matlab neural network toolbox, but I have encountered a topic I can find no documentation on. I can use the nprtool and easily classify my dataset. Training using this tool just takes about 15-30 seconds. At the end of the run I ask it to produce the matlab code file. When I run the code produced the network will not train in under 45 minutes and my computer works very hard. I need to automate the training of the network as I will be running many configurations. Any ideas on why this is occurring? I am using matlab 2010b on a macbook pro running snow leopard. code is attached below.

<code>

% Solve a Pattern Recognition Problem with a Neural Network
% Script generated by NPRTOOL
% Created Thu Apr 14 17:11:25 CDT 2011
%
% This script assumes these variables are defined:
%
% inputvector_10x2C20x2C3a0x2C3b0x2C40x2C5 - input data.
% outputvector_10x2C20x2C3a0x2C3b0x2C40x2C5 - target data.

inputs = inputvector_10x2C20x2C3a0x2C3b0x2C40x2C5';
targets = outputvector_10x2C20x2C3a0x2C3b0x2C40x2C5';

% Create a Pattern Recognition Network
hiddenLayerSize = 15;
net = patternnet(hiddenLayerSize);

% Choose Input and Output Pre/Post-Processing Functions
% For a list of all processing functions type: help nnprocess
net.inputs{1}.processFcns = {'removeconstantrows','mapminmax'};
net.outputs{2}.processFcns = {'removeconstantrows','mapminmax'};


% 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 = 65/100;
net.divideParam.valRatio = 15/100;
net.divideParam.testRatio = 20/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)

% Recalculate Training, Validation and Test Performance
trainTargets = targets .* tr.trainMask{1};
valTargets = targets .* tr.valMask{1};
testTargets = targets .* tr.testMask{1};
trainPerformance = perform(net,trainTargets,outputs)
valPerformance = perform(net,valTargets,outputs)
testPerformance = perform(net,testTargets,outputs)

% View the Network
view(net)

% Plots
% Uncomment these lines to enable various plots.
%figure, plotperform(tr)
%figure, plottrainstate(tr)
%figure, plotconfusion(targets,outputs)
%figure, ploterrhist(errors)
</code>
 

Post a Reply on This Topic Post a Reply on This Topic
 

Copyright © 2001-2003 Pejman Makhfi. All rights Reserved.