How can I use neural network function generated by Matlab?( I use R2015a)

I used GUI to make a NARX network, then load example data set(pH neutralization process), and trained the network, and finally I made a function by use of "MATLAB Function", here is the code made by Matlab:
if true
function [Y,Xf,Af] = myNeuralNetworkFunction(X,Xi,~)
%MYNEURALNETWORKFUNCTION neural network simulation function.
%
% Generated by Neural Network Toolbox function genFunction, 26-Oct-2016 01:51:25.
%
% [Y,Xf,Af] = myNeuralNetworkFunction(X,Xi,~) takes these arguments:
%
% X = 2xTS cell, 2 inputs over TS timsteps
% Each X{1,ts} = 2xQ matrix, input #1 at timestep ts.
% Each X{2,ts} = 1xQ matrix, input #2 at timestep ts.
%
% Xi = 2x2 cell 2, initial 2 input delay states.
% Each Xi{1,ts} = 2xQ matrix, initial states for input #1.
% Each Xi{2,ts} = 1xQ matrix, initial states for input #2.
%
% Ai = 2x0 cell 2, initial 2 layer delay states.
% Each Ai{1,ts} = 10xQ matrix, initial states for layer #1.
% Each Ai{2,ts} = 1xQ matrix, initial states for layer #2.
%
% and returns:
% Y = 1xTS cell of 2 outputs over TS timesteps.
% Each Y{1,ts} = 1xQ matrix, output #1 at timestep ts.
%
% Xf = 2x2 cell 2, final 2 input delay states.
% Each Xf{1,ts} = 2xQ matrix, final states for input #1.
% Each Xf{2,ts} = 1xQ matrix, final states for input #2.
%
% Af = 2x0 cell 2, final 0 layer delay states.
% Each Af{1ts} = 10xQ matrix, final states for layer #1.
% Each Af{2ts} = 1xQ matrix, final states for layer #2.
%
% where Q is number of samples (or series) and TS is the number of timesteps.
end
for complete code see attachment
Now my questions are:
1-how can I use this code for prediction?
2-what are "X, Xi"? actually I don't understand the lines below
if true
X = 2xTS cell, 2 inputs over TS timsteps
% Each X{1,ts} = 2xQ matrix, input #1 at timestep ts.
% Each X{2,ts} = 1xQ matrix, input #2 at timestep ts.
%
% Xi = 2x2 cell 2, initial 2 input delay states.
% Each Xi{1,ts} = 2xQ matrix, initial states for input #1.
% Each Xi{2,ts} = 1xQ matrix, initial states for input #2.
%
% Ai = 2x0 cell 2, initial 2 layer delay states.
% Each Ai{1,ts} = 10xQ matrix, initial states for layer #1.
% Each Ai{2,ts} = 1xQ matrix, initial states for layer #2.
end
if the function do prediction why it need "X{2,ts} = 1xQ matrix" which is the exact answer for "Xi{1,ts} = 2xQ matrix"?
for example If I have a data set with 100 input(a 2*100 matrix), and exact answer of first data, how can I predict the answer for rest of my data.
please help me.

3 Comments

1. Read the command window documentation
help narxnet
doc narxnet
2. Search the Mathworks Website
http://www.mathworks.com/search/site_search.html...
?c%5B%5D=entire_site&q=narxnet
3. Search the NEWSGROUP and ANSWERS for my posts
greg narxnet
Hope this helps.
Greg
Thank you dear Greg, your answer help me a lot. finally I made my network, train it, and get some results. the results are good for my first experience, but not enough. so I'm working to improve the network, what is your suggestion for improving the network? do you know any other network which could model nonlinear systems?
NARXNET is the most general MATLAB timeseries function. The others, TIMEDELAYNET and NARNET are special cases of NARXNET.
In this case it is not the network that is the problem.
It is the data.
I recall not being able to get a satisfactory solution with this data set.
I do not remember the reason. My guess is that the data is not stationary. In other words different sections of data have different means, variances and significant correlations.
When I get time I will see if I can find the corresponding post.
Meanwhile, try other sample datasets using
help nndatasets
and
doc nndatasets
Also, try searching BOTH NEWSGROUP and ANSWERS using
greg ph_dataset
Hope this helps.
Greg

Sign in to comment.

Answers (1)

As stated above, the timeseries is not stationary. See
http://www.mathworks.com/matlabcentral/answers/302908-narxnet-with-multi-input
also
http://www.mathworks.com/matlabcentral/newsreader/view_thread/346212
My advise is to practice on the other sample datasets.
help nndatasets
doc nndatasets
Hope this helps.
Thank you for formally accepting my answer
Greg

Categories

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

Products

Asked:

on 25 Oct 2016

Answered:

on 30 Oct 2016

Community Treasure Hunt

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

Start Hunting!