How can I use neural network time series toolbox to actually make predicts?
조회 수: 5 (최근 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!