How can I use neural network time series toolbox to actually make predicts?
4 次查看(过去 30 天)
显示 更早的评论
Hello,
I am trying to train a neural network to make predictions about the trajectory of a ball. So I have an excel spreadsheet with about 20 trajectories (time, x, y, z for each of them) and I am trying to train it so that it can predict an entire trajectory based upon the initial condition given to it (initial time is 0 for all of them, as is initial x since they are all starting at the same spot).
I have been doing the following :
nnstart --> Time Series App --> Nar --> Load data --> train.
I create the Matlab Matrix only function and then the simple script. But how can I actually use this to make predictions? All of the manuals and tutorials are very vague at this part. They pretty much show you how to train it and validate that it works on data it hasn't seen, but doesn't actually tell you how to use it to make predictions, even in the examples that it gives. Ideally I would like to give it the initial state (time = 0, x = 0, y = y0, z = z0) and then it populates the rest of the trajectory until it reaches x=10. I can give it data for delay states if needed
Thank you so much!
回答(1 个)
Sanjana Ramakrishnan
2017-5-3
Refer the below example code for predicting using Neural Network:
1) Load the simple time-series prediction data and create a NAR network.
T = simplenar_dataset;
net = narnet(1:2,10);
2)Prepare the time series data using preparets and train the network:
[Xs,Xi,Ai,Ts] = preparets(net,{},{},T);
net = train(net,Xs,Ts,Xi,Ai);
view(net)
3)Calculate the network performance.
[Y,Xf,Af] = net(Xs,Xi,Ai);
perf = perform(net,Ts,Y)
4)To predict the output for the next 20 time steps, first simulate the network in closed loop form.
[netc,Xic,Aic] = closeloop(net,Xf,Af);
view(netc)
5)To simulate the network 20 time steps ahead, input an empty cell array of length 20. The network requires only the initial conditions given in Xic and Aic.
y2 = netc(cell(0,20),Xic,Aic)
2 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Sequence and Numeric Feature Data Workflows 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!