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