http://www.mathworks.com/matlabcentral/newsreader/view_thread/299991
MATLAB Central Newsreader  neural network: out of memory error
Feed for thread: neural network: out of memory error
enus
©19942014 by MathWorks, Inc.
webmaster@mathworks.com
MATLAB Central Newsreader
http://blogs.law.harvard.edu/tech/rss
60
MathWorks
http://www.mathworks.com/images/membrane_icon.gif

Sun, 02 Jan 2011 17:18:05 +0000
neural network: out of memory error
http://www.mathworks.com/matlabcentral/newsreader/view_thread/299991#808926
pietro
Hi, <br>
<br>
I'm using neural network toolbox 7, in particular the tool for predicting time series (ntstool). I have a neural network with 20 neurons, 25 delay, but I get out of memory error. In this link <br>
<a href="http://www.mathworks.com/help/toolbox/nnet/backpro6.html">http://www.mathworks.com/help/toolbox/nnet/backpro6.html</a><br>
I think the network dimensions are too high for my pc. <br>
I have found that is possible to solve this using this problem throught the setting of parameter net.effficiency.memoryReduction to a value upper than 1. I have tried with the following code, but I get an error.<br>
<br>
CODE<br>
% Solve an InputOutput TimeSeries Problem with a Time Delay Neural Network<br>
% Script generated by NTSTOOL.<br>
% Created Mon Dec 27 11:25:43 CET 2010<br>
%<br>
% This script assumes these variables are defined:<br>
%<br>
% input  input time series.<br>
% target  target time series.<br>
<br>
inputSeries = tonndata(input,false,false);<br>
targetSeries = tonndata(target,false,false);<br>
<br>
% Create a Time Delay Network<br>
inputDelays = 0:20;<br>
hiddenLayerSize = 10;<br>
net = timedelaynet(inputDelays,hiddenLayerSize);<br>
net.Efficiency.memoryReduction=2;<br>
<br>
% Prepare the Data for Training and Simulation<br>
% The function PREPARETS prepares timeseries data for a particular network,<br>
% shifting time by the minimum amount to fill input states and layer states.<br>
% Using PREPARETS allows you to keep your original time series data unchanged, while<br>
% easily customizing it for networks with differing numbers of delays, with<br>
% open loop or closed loop feedback modes.<br>
[inputs,inputStates,layerStates,targets] = preparets(net,inputSeries,targetSeries);<br>
<br>
% Setup Division of Data for Training, Validation, Testing<br>
net.divideParam.trainRatio = 80/100;<br>
net.divideParam.valRatio = 10/100;<br>
net.divideParam.testRatio = 10/100;<br>
<br>
<br>
% Train the Network<br>
[net,tr] = train(net,inputs,targets,inputStates,layerStates);<br>
<br>
% Test the Network<br>
outputs = net(inputs,inputStates,layerStates);<br>
errors = gsubtract(targets,outputs);<br>
performance = perform(net,targets,outputs)<br>
<br>
% View the Network<br>
view(net)<br>
<br>
% Plots<br>
% Uncomment these lines to enable various plots.<br>
%figure, plotperform(tr)<br>
%figure, plottrainstate(tr)<br>
figure, plotresponse(targets,outputs)<br>
figure, ploterrcorr(errors)<br>
figure, plotinerrcorr(inputs,errors)<br>
<br>
% Early Prediction Network<br>
% For some applications it helps to get the prediction a timestep early.<br>
% The original network returns predicted y(t+1) at the same time it is given x(t+1).<br>
% For some applications such as decision making, it would help to have predicted<br>
% y(t+1) once x(t) is available, but before the actual y(t+1) occurs.<br>
% The network can be made to return its output a timestep early by removing one delay<br>
% so that its minimal tap delay is now 0 instead of 1. The new network returns the<br>
% same outputs as the original network, but outputs are shifted left one timestep.<br>
nets = removedelay(net);<br>
[xs,xis,ais,ts] = preparets(nets,inputSeries,targetSeries);<br>
ys = nets(xs,xis,ais);<br>
earlyPredictPerformance = perform(net,tc,yc)<br>
<br>
<br>
ERROR<br>
??? Index exceeds matrix dimensions.<br>
<br>
Error in ==> getsamples at 8<br>
y{j} = x{j}(:,ind);<br>
<br>
Error in ==> split_data at 13<br>
split.Pd = nnfast.getsamples(data.Pd,indices);<br>
<br>
Error in ==> perfs_jejj>splitcalc at 40<br>
split = nntraining.split_data(data,indices);<br>
<br>
Error in ==> perfs_jejj at 11<br>
[trainPerfy,trainN,valPerfy,~,testPerfy,~,JEy,JJy] =<br>
splitcalc(net,data,fcns);<br>
<br>
Error in ==> trainlm>train_network at 199<br>
[perf,vperf,tperf,je,jj,gradient] = nntraining.perfs_jejj(net,data,fcns);<br>
<br>
Error in ==> trainlm at 113<br>
[net,tr] = train_network(net,tr,data,fcns,param);<br>
<br>
Error in ==> network.train at 107<br>
[net,tr] = feval(net.trainFcn,net,X,T,Xi,Ai,EW,net.trainParam);<br>
<br>
Error in ==> rete_neurale_simple at 35<br>
[net,tr] = train(net,inputs,targets,inputStates,layerStates);<br>
<br>
With net.Efficiency.memoryReduction=1; I don't get this error. What do you suggest me for figuring out the network parameters?<br>
Thanks<br>
<br>
Pietro

Sun, 02 Jan 2011 19:55:47 +0000
Re: neural network: out of memory error
http://www.mathworks.com/matlabcentral/newsreader/view_thread/299991#808939
Greg Heath
On Jan 2, 12:18 pm, "pietro " <bracard...@email.it> wrote:<br>
> Hi,<br>
><br>
> I'm using neural network toolbox 7, in particular the tool for predicting time series (ntstool). I have a neural network with 20 neurons, 25 delay, but I get out of memory error. In this link<a href="http://www.mathworks.com/help/toolbox/nnet/backpro6.html">http://www.mathworks.com/help/toolbox/nnet/backpro6.html</a><br>
> I think the network dimensions are too high for my pc.<br>
<br>
In fact, both values may be unnecessarily high for a good<br>
solution to the problem.<br>
<br>
See my recent 4 post thread for determining both d (the<br>
number of delays) from the autocorrelation function and<br>
the minimum reasonable value for H (the number of hidden<br>
nodes).<br>
<br>
<a href="http://groups.google.com/group/comp.softsys.matlab/msg/c9643c9642095dd5">http://groups.google.com/group/comp.softsys.matlab/msg/c9643c9642095dd5</a><br>
<br>
Hope this helps.<br>
<br>
Greg

Mon, 03 Jan 2011 14:33:05 +0000
Re: neural network: out of memory error
http://www.mathworks.com/matlabcentral/newsreader/view_thread/299991#809126
pietro
Greg Heath <heath@alumni.brown.edu> wrote in message <0a4cb41a35124591a8a6b573a99ce9d6@p38g2000vbn.googlegroups.com>...<br>
> On Jan 2, 12:18 pm, "pietro " <bracard...@email.it> wrote:<br>
> > Hi,<br>
> ><br>
> > I'm using neural network toolbox 7, in particular the tool for predicting time series (ntstool). I have a neural network with 20 neurons, 25 delay, but I get out of memory error. In this link<a href="http://www.mathworks.com/help/toolbox/nnet/backpro6.html">http://www.mathworks.com/help/toolbox/nnet/backpro6.html</a><br>
> > I think the network dimensions are too high for my pc.<br>
> <br>
> In fact, both values may be unnecessarily high for a good<br>
> solution to the problem.<br>
> <br>
> See my recent 4 post thread for determining both d (the<br>
> number of delays) from the autocorrelation function and<br>
> the minimum reasonable value for H (the number of hidden<br>
> nodes).<br>
> <br>
> <a href="http://groups.google.com/group/comp.softsys.matlab/msg/c9643c9642095dd5">http://groups.google.com/group/comp.softsys.matlab/msg/c9643c9642095dd5</a><br>
> <br>
> Hope this helps.<br>
> <br>
> Greg<br>
<br>
Hi Greg, <br>
<br>
it is very interesting your post thread, but I have found some difficulties to apply it in my case. I need a neural network for predicting the response of mechanical system, so I have measured the input signal and the output signal and from this I want to estimate the system transfer function. The signal sampling rate is 500Hz. I have triend to use the xcorr like you have mentioned in your example, in this way:<br>
<br>
acf = xcorr(input,output);<br>
acfss = acf(N:end)/max(acf);<br>
[maxacf1 d] = max(acfss(2:end)) <br>
<br>
but I get <br>
maxacf1 =<br>
<br>
1<br>
<br>
<br>
d =<br>
<br>
1816<br>
<br>
What does it mean this delay? I need a neural network with 1816 number of delays?<br>
Moreover I haven't understood the principle ideas for selecting the hidden neurons number. May you give me further explanations? <br>
I hope to have well explained my doubts, if not, don't hesitate to ask me. <br>
<br>
Thank you Greg<br>
<br>
bye <br>
<br>
Pietro

Mon, 03 Jan 2011 16:22:44 +0000
Re: neural network: out of memory error
http://www.mathworks.com/matlabcentral/newsreader/view_thread/299991#809174
Greg Heath
On Jan 3, 9:33 am, "pietro " <bracard...@email.it> wrote:<br>
> Greg Heath <he...@alumni.brown.edu> wrote in message <0a4cb41a35124591a8a6b573a99ce...@p38g2000vbn.googlegroups.com>...<br>
> > On Jan 2, 12:18 pm, "pietro " <bracard...@email.it> wrote:<br>
> > > Hi,<br>
><br>
> > > I'm using neural network toolbox 7, in particular the tool for predicting time series (ntstool). I have a neural network with 20 neurons, 25 delay, but I get out of memory error. In this link<a href="http://www.mathworks.com/help/toolbox/nnet/backpro6.html">http://www.mathworks.com/help/toolbox/nnet/backpro6.html</a><br>
> > > I think the network dimensions are too high for my pc.<br>
><br>
> > In fact, both values may be unnecessarily high for a good<br>
> > solution to the problem.<br>
><br>
> > See my recent 4 post thread for determining both d (the<br>
> > number of delays) from the autocorrelation function and<br>
> > the minimum reasonable value for H (the number of hidden<br>
> > nodes).<br>
><br>
> ><a href="http://groups.google.com/group/comp.softsys.matlab/msg/c9643c9642095dd5">http://groups.google.com/group/comp.softsys.matlab/msg/c9643c9642095dd5</a><br>
><br>
> > Hope this helps.<br>
><br>
> > Greg<br>
><br>
> Hi Greg,<br>
><br>
> it is very interesting your post thread, but I have found some difficulties to apply it in my case. I need a neural network for predicting the response of mechanical system, so I have measured the input signal and the output signal and from this I want to estimate the system transfer function.<br>
<br>
Please implement carriage returns so that your paragraphs<br>
are not single lines when cut and pasted into Windows Notepad.<br>
<br>
Tranfer functions are only defined for linear systems.<br>
If you have a linear system, you don't need a neural network<br>
model.<br>
<br>
So,... I am guessing that you have a nonlinear system and<br>
want to model the I/O characteristics with a NN.<br>
<br>
<br>
>The signal sampling rate is 500Hz.<br>
<br>
Insufficient information. How long is your signal?<br>
<br>
>I have triend to use the xcorr like you have mentioned in your example, in this way:<br>
><br>
> acf = xcorr(input,output);<br>
> acfss = acf(N:end)/max(acf);<br>
> [maxacf1 d] = max(acfss(2:end))<br>
><br>
> but I get<br>
> maxacf1 =<br>
><br>
> 1<br>
><br>
> d =<br>
><br>
> 1816<br>
><br>
> What does it mean this delay? I need a neural network with 1816 number of delays?<br>
<br>
Insuffient information.<br>
<br>
It could indicate periodicity.<br>
What is N?<br>
What does your plot of acfss look like?<br>
Can you post it on a website so I can see it?<br>
Can you send me input and output in a text file?<br>
<br>
><br>
> Moreover I haven't understood the principle ideas for selecting the hidden neurons number. May you give me further explanations?<br>
> I hope to have well explained my doubts, if not, don't hesitate to ask me.<br>
<br>
Reference your questions about choosing H<br>
w.r.t. my code statements.<br>
<br>
Also search in the CSSM archives using<br>
<br>
greg heath Neq Nw<br>
<br>
Hope this helps.<br>
<br>
Greg

Tue, 04 Jan 2011 10:07:04 +0000
Re: neural network: out of memory error
http://www.mathworks.com/matlabcentral/newsreader/view_thread/299991#809411
pietro
Greg Heath <heath@alumni.brown.edu> wrote in message <175cc70aaeb145a2adee10e4d29282ad@g26g2000vba.googlegroups.com>...<br>
> On Jan 3, 9:33 am, "pietro " <bracard...@email.it> wrote:<br>
> > Greg Heath <he...@alumni.brown.edu> wrote in message <0a4cb41a35124591a8a6b573a99ce...@p38g2000vbn.googlegroups.com>...<br>
> > > On Jan 2, 12:18 pm, "pietro " <bracard...@email.it> wrote:<br>
> > > > Hi,<br>
> ><br>
> > > > I'm using neural network toolbox 7, in particular the tool for predicting time series (ntstool). I have a neural network with 20 neurons, 25 delay, but I get out of memory error. In this link<a href="http://www.mathworks.com/help/toolbox/nnet/backpro6.html">http://www.mathworks.com/help/toolbox/nnet/backpro6.html</a><br>
> > > > I think the network dimensions are too high for my pc.<br>
> ><br>
> > > In fact, both values may be unnecessarily high for a good<br>
> > > solution to the problem.<br>
> ><br>
> > > See my recent 4 post thread for determining both d (the<br>
> > > number of delays) from the autocorrelation function and<br>
> > > the minimum reasonable value for H (the number of hidden<br>
> > > nodes).<br>
> ><br>
> > ><a href="http://groups.google.com/group/comp.softsys.matlab/msg/c9643c9642095dd5">http://groups.google.com/group/comp.softsys.matlab/msg/c9643c9642095dd5</a><br>
> ><br>
> > > Hope this helps.<br>
> ><br>
> > > Greg<br>
> ><br>
> > Hi Greg,<br>
> ><br>
> > it is very interesting your post thread, but I have found some difficulties to apply it in my case. I need a neural network for predicting the response of mechanical system, so I have measured the input signal and the output signal and from this I want to estimate the system transfer function.<br>
> <br>
> Please implement carriage returns so that your paragraphs<br>
> are not single lines when cut and pasted into Windows Notepad.<br>
> <br>
> Tranfer functions are only defined for linear systems.<br>
> If you have a linear system, you don't need a neural network<br>
> model.<br>
> <br>
> So,... I am guessing that you have a nonlinear system and<br>
> want to model the I/O characteristics with a NN.<br>
> <br>
Yes you are on right, sorry for my mistake.<br>
<br>
> <br>
> >The signal sampling rate is 500Hz.<br>
> <br>
> Insufficient information. How long is your signal?<br>
> <br>
my signal has 12096 samples<br>
<br>
> >I have triend to use the xcorr like you have mentioned in your example, in this way:<br>
> ><br>
> > acf = xcorr(input,output);<br>
> > acfss = acf(N:end)/max(acf);<br>
> > [maxacf1 d] = max(acfss(2:end))<br>
> ><br>
> > but I get<br>
> > maxacf1 =<br>
> ><br>
> > 1<br>
> ><br>
> > d =<br>
> ><br>
> > 1816<br>
> ><br>
> > What does it mean this delay? I need a neural network with 1816 number of delays?<br>
> <br>
> Insuffient information.<br>
> <br>
> It could indicate periodicity.<br>
<br>
<br>
> What is N?<br>
<br>
12096<br>
<br>
> What does your plot of acfss look like?<br>
> Can you post it on a website so I can see it?<br>
<br>
In this link, you may find the requested plot:<br>
<a href="http://img152.imageshack.us/f/crosscorr.png/">http://img152.imageshack.us/f/crosscorr.png/</a><br>
<a href="http://img29.imageshack.us/f/inputcorrelation.png/">http://img29.imageshack.us/f/inputcorrelation.png/</a><br>
<a href="http://img525.imageshack.us/f/outcorrelation.png/">http://img525.imageshack.us/f/outcorrelation.png/</a><br>
<br>
<br>
<br>
> Can you send me input and output in a text file?<br>
<br>
In this link you may find the input and output signal<br>
<a href="http://www.megaupload.com/?d=4WYBJTZN">http://www.megaupload.com/?d=4WYBJTZN</a><br>
<br>
> <br>
> ><br>
> > Moreover I haven't understood the principle ideas for selecting the hidden neurons number. May you give me further explanations?<br>
> > I hope to have well explained my doubts, if not, don't hesitate to ask me.<br>
> <br>
> Reference your questions about choosing H<br>
> w.r.t. my code statements.<br>
> <br>
> Also search in the CSSM archives using<br>
> <br>
> greg heath Neq Nw<br>
> <br>
> Hope this helps.<br>
> <br>
> Greg<br>
I will try search<br>
<br>
I hope to have well explained my doubts, if not, don't hesitate to ask me.<br>
<br>
<br>
thank you Greg<br>
<br>
Pietro