MATLAB Answers

How to predict future data after training the ANN?

28 views (last 30 days)
Ali Saremi
Ali Saremi on 27 Aug 2017
Commented: adib adib on 19 Oct 2021 at 6:58
My name is Ali. I have trained my network with my input data (wind Speed) and output data (Wave Height) and got good results. Also, i have my future data (Wind Speed) obtained from GSM from 2080 to 2100, so eveything is ready to perdict wave heights from 2080 to 2100. Please take a look at the screen shot attached to see what the codes are. If someone can help me how i can do the final stage, I would really apperciate it.
Kind Regards Ali
  1 Comment
adib adib
adib adib on 19 Oct 2021 at 6:58
Hi Ali,
Can I have your email?
Best Regards,

Sign in to comment.

Accepted Answer

Greg Heath
Greg Heath on 27 Aug 2017
%Just relying on default values:
x = annInput';
t = annTarget';
net = fitnet;
[net tr y e ] = train(net,x,t);
MSE = mse(e)
% Can obtain trn, val and tst subset indices from tr
% to obtain subsets of y and e and corresponding MSEtrn
% MSEval, MSEtst
% For arbitrary X
Y = net(X);
In general, use a search for the smallest successful H (for stability) and
corresponding set of random initial weights.
I use a double for loop approach over the outer loop H = Hmin:dH:Hmax and
inner loop i = 1:Ntrials over random number states to find initial weights that will
yield a sufficiently small value of MSE.
Zillions of examples have been posted on both NEWSGROUP and ANSWERS. Good search words are
Greg Hmin Hmax
Thank you for formally accepting my answer
  1 Comment
lior niss
lior niss on 11 Sep 2017
Hello Greg,
I saw that there were similar questions here, but I could not find a simple answer. I am looking a basic and simple answer. This is my problem : I need to predict stocks targets based on sequential features. I have samples of 595 different cases over 4638 times. For each time sample I have 179 features and a single target. The values of the features and targets are real values between -1.5 to 1.5. I tried number of algorithms, without success and now I'm trying to apply a neural network with Time series app . I train the data using Levenberg-Marquardt and after the training I save the results and I chose the option generate the script. So the question is: after I did training and got a model for my net , How do I get the prediction for another 1000 samples ( each sample is contains 179 features)? How should I use the model I have already created for the prediction problem?
Thank you

Sign in to comment.

More Answers (1)

Greg Heath
Greg Heath on 11 Sep 2017
The first thing you need to do is throw away as many redundant inputs as possible.
I'm not sure of the best way to do it. However, It really is not necessary to find the optimum combination; just a good one.
I would start with 10 simple linear input reduction models using PLSREGRESS and 10 subsets with ~ 18 inputs each.
Hope this helps.

Community Treasure Hunt

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

Start Hunting!