Does the neural net toolbox handle model training/prediction in a future-time-indepenent manner?

3 views (last 30 days)
Does the neural net toolbox handle model training/prediction in a future-time-indepenent manner? I.e. the prediction for x(t) doesn't use a model trained on data from x(t+n)
For a code example:
inputDelays = 1:delays;
feedbackDelays = 1:delays;
hiddenLayerSize = 10;
net = narxnet(inputDelays,feedbackDelays,hiddenLayerSize);
net = removedelay(net);
[inputs,inputStates,layerStates,targets] = preparets(net,tonndata(x,false,false),{},tonndata(y,false,false));
net.divideParam.trainRatio = 70/100;
net.divideParam.valRatio = 15/100;
net.divideParam.testRatio = 15/100;
[net,tr,Ys Es Xf Af] = train(net,inputs,targets,inputStates,layerStates);
outputs = net(inputs,inputStates,layerStates);
Would output(i) only be predicted from a model trained on inputs(1:i-1), and if not, is there a simple function for doing this other than re-training and re-predicting at every time step?

Accepted Answer

Greg Heath
Greg Heath on 11 Mar 2016
About running matlab using MDCS, I would like to ask you 2 questions:
1) It seems that in the beginning matlab starts SMPD in all the workers. Does my code executes in all the workers at the same time or only when I use my parfor cycle? This is because I would expect all the works to communicate when using my parfor cycle.
2) Although I am able to get my job output correctly (the output is a .mat file), I get this error on my cluster .OUT file, whcih is shown by all matlab workers:
%-------------------------------------------------------------------------------------------------------------%
[3]Error using distcomp/getSchedulerUDDConstructor (line 30)
[3]Unable to supply constructor for scheduler . This is an unknown type
[3]Error in distcomp_evaluate_filetask>iCreateSchedulerObject (line 474)
[3]schedulerConstructor = distcomp.getSchedulerUDDConstructor(type);
[3]Error in distcomp_evaluate_filetask>iSetup (line 407)
[3]sched = iCreateSchedulerObject(root, schedulerType, storage);
[3]Error in distcomp_evaluate_filetask (line 41)
[3]runprop = iSetup(handlers, mdceDebugEnabled, varargin);
%-------------------------------------------------------------------------------------------------------------%
I am running my job using this file:
sched = findResource('scheduler', 'type', 'torque');
set(sched, 'ClusterSize', 8);
set(sched, 'ClusterOsType', 'unix');
set(sched, 'RcpCommand', 'scp');
set(sched, 'RshCommand', 'ssh');
set(sched, 'ClusterMatlabRoot', '/vsc-mounts/leuven-apps/matlab/R2011b');
set(sched, 'ResourceTemplate', '-l nodes=2:ppn=6,mem=8gb');
set(sched, 'SubmitArguments', '-l walltime=2:00:00');
set(sched, 'DataLocation', '/user/leuven/306/vsc30684/.matlab/local_scheduler_data/R2011b');
job = createMatlabPoolJob(sched, 'PathDependencies', {'/user/leuven/306/vsc30684/Model Discrimination/CTMI_Schwaab/'});
set(job, 'MinimumNumberOfWorkers', 8);
set(job, 'MaximumNumberOfWorkers', 8);
task = createTask(job, @run, 0, {5,1});
tasks = get(job, 'Tasks');
set(tasks, 'CaptureCommandWindowOutput', true);
submit(job);
waitForState(job, 'finished');
destroy(job);

More Answers (1)

Greg Heath
Greg Heath on 10 Mar 2016
In general
Input delays are nonnegative and increasing but not necessarily consecutive, e.g.,
ID = [ 0:2:4 ]
Significant input delays correspond to statistically significant input/target cross-correlation values.
Feedback delays are positive and increasing but not necessarily consecutive, e.g.,
FD = [ 1:2:5 ]
Significant feedback delays correspond to statistically significant target auto-correlation values.
if id is an input delay, the output at time t will depend on the input at the previous time t-id.
Similarly, if fd is a feedback delay, the output at time t will depend on the past output value at time t-fd.
NOTE: An openloop feedback delay can be zero. However, it will either be ignored or cause an error when the feedback loop is closed.
Typically, delays are chosen to be consecutive and include an adequate number of significant delays.
Hope this helps.
Thank you for formally accepting my answer
Greg
  1 Comment
Vitya V
Vitya V on 10 Mar 2016
Thanks for your response. What I'm asking is slightly askew from this though. I understand how to make a prediction using inputs that are delayed in time, but I'm wondering how to make sure the state of the model used at the time of prediction hasn't been trained on future data yet.
In essence, if I were to brute force it, at every time step "t" I would train an entirely new model based on inputs(1:t) to predict output(t+1), then advance a time step, train a new model on inputs(1:(t+1)) and predict output(t+2), etc. This way at no point would the net contain information pertaining to time it hadn't yet reached.
To put it a different way: I want to simulate a prediction made every day for the following day. That prediction can only be trained on past data, so my simulated network should also only be trained on data existing before each daily prediction. Hopefully I've made my question clearer rather than more confusing...

Sign in to comment.

Categories

Find more on Deep Learning Toolbox in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!