how can i find the best ann architecture?

4 views (last 30 days)
i need some help for building the best performance ann architecture for rainfall forecasting in a village in indonesia with 360 data (months in 30 years). First of all i am a beginner in ann also matlab, i just have a brief understanding of them, just a little bit. iam using nntool in matlab for processing (gui version), i dont even know how to get the syntax from the nntool gui in command window, why am i not using time series ann tools? because its to complicated, just need the simple net to process. Here is the problems and questions:
1.i have a problem for initializing or preparing the data, i.e iam using 2x120 input matrices with 2 inputs and 120 variables, and 1x120 for data target, i just want to predict the data in the next 1 year (it will be 12 data in months), all of the data is rainfall data. My understanding and logic of that kind of data construction is like this "if we have 360 data, and have 2 inputs variables, just divide the data into 3 so it can have same data samples for inputs and targets (cause i think that data target samples must be equal with the input samples), is that logic correct or wrong? just need to know how to prepare our data.
2.the training test of that architecture is really bad (using default training parameters) the mse is around 10^3-10^4, before that i have some questions, is it the performance value in training gui (nntraintool) at the progress table shows the real mse of ann performance? cause i just assume it like that, or if its wrong, how can i get the mse? I just need the mse, the %error and the predicted data for the final conclusion. what is probably the best training parameter for rainfall data (seasonal data)?enter image description here
3.next question is already mentioned in above, is it possible to shows or create the code or syntax from nntool gui? and if it yes how?
for the number of input's nodes, iam using the lagged correlation from the time series scatter plots of the data when it achieve the stasionary (the significant ACF and PACF) and the data divides for training, test and validation using random. iam sorry for my bad explanation (and also english) hope everyone could understand it. Thank you.

Accepted Answer

Greg Heath
Greg Heath on 2 Feb 2016
>why am i not using time series ann tools?
because its to complicated,
Ridiculous.
1. The help and doc documentation will walk you through the basics.
help narnet
doc narnet
2. Other example datasets are available
help nndatasets
doc nndatasets
3. You may have to design multiple nets to mitigate bad sets of random initial weights.
4. I have posted many design examples in the NEWSGROUP and ANSWERS. For example, search using
narnet greg
5. A quick example of an "o"penloop design:
T = simplenar_dataset;
neto = narnet(1:2,10);
[Xo,Xoi,Aoi,To] = preparets(neto,{},{},T);
to = cell2mat(To); varto = var(to,1)% MSE reference
Ntrials = 10
rng('default')
for i = 1:Ntrials
neto = configure(neto,Xo,To);% Random weight init
[ neto tro Yo Eo Xof Aof ] = train(net,Xo,To,Xoi,Aoi);
%[ Yo Xof Aof ] = neto(Xo,Xoi,Aoi);
% Eo = gsubtract(To,Yo);
view(neto)
NMSEo(i,1) = mse(Eo)/varto % Desire < 0.005
end
6. Modify to either save the net with the smallest normalized MSE or to break if NMSEo < 0.005 is encountered.
Post again if help is needed
Hope this helps.
Thank you for formally accepting my answer
Greg
  9 Comments
Greg Heath
Greg Heath on 5 Feb 2016
I looked at the plots, autocorrelation functions and significant lags for all 3 series. I did not consider trn/val/tst datadivision so Ntrn = N = 360 with O =3 outputs yielding Ntrneq = 1080 training equations.
The plots looked noisy and could probably benefit from some smoothing (which I did not do!).
The autocorrelation functions of length N = 360 contained on the order of N/2 = 180 significant lags.
Since I did not use a validation set, I used narnet(1:d,H) with O =3 outputs and tried to minimize the number of unknown weights Nw = (d+1)*H+(H+1)*O subject to the following constraints
Nw < Ntrneq % no overfitting
MSE < 0.005*mean(var(t',1)) % NMSE < 0.005, Rsq > 0.995
Instead of a full-blown 3-loop search over delays d, hidden nodes H and number of random weight initializations, Ntrials, I first set an upperbound on H from the no overfitting upperbound condition
H <= Hub = floor( (Ntrneq-O) / (d+1+O)) = 76
and considered, for d given
Hmin ~ Hub/4, dH ~ 2, Hmax ~ Hub/2
I found that for d = 10, Ntrials = 10 that NMSE < 0.05 for 6 out of 10 trials when H = 26;
I hope this helps.
Note that you should use DIVIDEBLOCK for unbiased results.
Greg
Rita
Rita on 10 Feb 2016
Hi Greg, what happens if in addition to dividing data to 3 sets training /validation /test we also put this condition net.trainParam.goal = 0.005*var(targets,1); Thansks

Sign in to comment.

More Answers (0)

Categories

Find more on Sequence and Numeric Feature Data Workflows 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!