how can use static feedforward neural network to predict futre observation

 Accepted Answer

The generic NEWFF and special cases that call it (e.g., NEWFIT(regression/curvefitting) and NEWPR(Classification/pattern-recognition) ) are obsolete.
Use the current special cases FITNET(regression/curvefitting) and PATTERNNET(Classification/pattern-recognition,...) that call the generic FEEDFORWARDNET.
In your case it looks like FITNET.
However, why don't you want to use a dynamic net?
Hope this helps.
Thank you for formally accepting my answer
Greg

5 Comments

Thanks a lot Greg for your precious help.
I have used Narnet as a dynamic net, my work consists on comparing static and dynamic neural network to predict next observation. For this reason,I will compare dynamic to FITNET.
can you put some code using fitnet, I have only one input vector (3000 observations), I need to decompose the set into three sets train(70%), validation (10%)and 20% for testing as the same sample decomposition employed in the dynamic net.
I have a better idea:
Why don't YOU put together some code, test it on one of the example datasets from
help nndatasets
doc nndatasets
Then I will make constructive comments.
Greg
Dear Greg, I used FITNET to predict future value by assuming only one delay (lag) as the network is static.
this assumption is right?
Thanks
I try to predict next value of index using fitnet.
my data representing 3263 observations.
I have defined the input as the first 3262 observations (P=data(1:3262) while target is defined as (T=data(2:3263)).
this data partition is right?
Also I have used these code, can you verify with me.
P=data(1:3262);
T=data(2:3263);
inputs = P';
targets = T'; hiddenLayerSize = 10;
net = fitnet(hiddenLayerSize);
net.inputs{1}.processFcns = {'removeconstantrows','mapminmax'};
net.outputs{2}.processFcns = {'removeconstantrows','mapminmax'};
net.divideFcn = 'divideblock'; % Divide data randomly
net.divideMode = 'sample'; % Divide up every sample
net.divideParam.trainRatio = 70/100;
net.divideParam.valRatio = 10/100;
net.divideParam.testRatio = 20/100;
net.trainFcn = 'trainlm';
net.performFcn = 'mse';
[net,tr] = train(net,inputs,targets);
outputs = net(inputs);
errors = gsubtract(targets,outputs);
performance = perform(net,targets,outputs)

Sign in to comment.

More Answers (2)

Use one of these
help nndatasets (Also see : doc nndatasets)
Single time-series prediction involves predicting the next value of a time-series given its past values.
simplenar_dataset - Simple single series prediction dataset.
chickenpox_dataset - Monthly chickenpox instances dataset.
ice_dataset - Gobal ice volume dataset.
laser_dataset - Chaotic far-infrared laser dataset.
oil_dataset - Monthly oil price dataset.
river_dataset - River flow dataset.
solar_dataset - Sunspot activity dataset
Unlike the datasets for FITNET, PATTERNNET and NARXNET, I have not posted these NARNET data set sizes in the NEWSGROUP.
Word to the wise:
ALWAYS begin using ALL of the defaults. This will simplify your code so much that you will think that you know what you are doing. To see what I mean see the documentation examples at
help fitnet % default H = 10
doc fitnet
and
help narnet % defaults FD = 1:2, H = 10
doc narnet
TYPICALLY, the only default you may have to change is, H, the number of hidden nodes!
However, if that doesn't work you may have to
1. Design 10 or more nets to mitigate unfortunate choices of random initial weights and random data divisions.
2. Determine the statistically significant lags from the target autocorrelation function as I have posted in the NEWSGROUP.
Hope this helps
If you want to accept this answer instead of the previous one, I don't mind
Greg

1 Comment

Thank you Greg.
In fact, I have no problem to define optimal hidden neurons ( using trial and error) for fitnet model.
I want just to verify if my input and target vectors are right???
I have defined the input as the first 3262 observations (P=data(1:3262) while target is defined as (T=data(2:3263)).
this data partition is right?

Sign in to comment.

If you want to use the static net FITNET to predict d timesteps ahead of a single N timestep timeseries, use defaults and double ( NOT CELL ) variables
input = data( 1:N-d); % No transpose;
target = data( 1+d : N );
MSE00 = var(target',1) % Reference MSE
net = fitnet; % default H = 10
net.divideParam.valRatio = 10/100;
net.divideParam.testRatio = 20/100;
[net tr output error ] = train(net, input, target);
%output = net(input); error = target - output;
NMSE = mse(error)/MSE00 % Range [ 0 1 ]
R2 = 1- NMSE
% Rsquared = fraction of target variance modeled by the net
Hope this helps.
Greg

11 Comments

thank you Greg.
d is the timesteps ahead?
I want to predict the next value of index therefore d=1.
As we consider that there is only one lag/delay???
But I think that we must add the normalization (mapminmax)??
Because by using the same data sample:
https://www.dropbox.com/s/gik6nfuduvbukz6/DATA.txt?oref=e
And your above code I found error=0 and R2=1!!!!! illogical!!!!
noo sorry Greg, I found NMSE=0.3943 and R2=0.6057.
logical finding.
so using Narnet is much better for this task.
I want to know if in this case we can use timedelaynet??
What is the difference between narnet and timedelaynet? And what is the most appropriate for this task??
> NMSE=0.3943 and R2=0.6057.
I get very similar results from 10 trials: 0.568(thrice),0.602 (thrice),0.604(once)&0.611(thrice).
After looking at the plot of data I'm not surprised.
There is no reason why NARNET will be any better than fitnet.
Timedelaynet and Narxnet are for separate inputs and outputs.
Next, consider increasing the number of lags and hidden nodes.
Ntrneq ~ 0.7*3263 ~ 2283 No. training equations
Nw ~ (1+1+1)*10+11*1 = 41 unknown weights
Ntrneq can easily support a factor of 50 increase in weights.
Hope this helps.
Greg
Yes Greg,
For narnet model, I have trial and error method to determine optimal hidden nodes I have found that 14 neurons is the best one and 31 is best lags which explain the dynamics of the system.
with these parameters I have found MSE=0.0705 is by far better results than fitnet which assume only one lag.
what do you think??
I think that using narnet is better than usin fitnet for timeseries because you can close the loop and predict well beyond the time of the target.

Sign in to comment.

Categories

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

Asked:

on 29 May 2015

Commented:

on 8 Sep 2016

Community Treasure Hunt

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

Start Hunting!