Clear Filters
Clear Filters

How to prepare target vector in matlab?

4 views (last 30 days)
I am developing time series forecasting using feedforwarenet in matlab. But I don't know 1. what is a target vector 2. how to prepare target vector 3. How can I choose data for a target vector(if needed)
Below I have sample excel data if it is useful to prepare target data (Sorry I don't know about it) Thank you. and please help me

Accepted Answer

Greg Heath
Greg Heath on 20 Mar 2015
Neural networks are models of functions. There are 4 basic types. The types and corresponding MATLAB functions are
1. FITNET: Curve-fitting & regression
2. PATTERNNET: Pattern-Recognition & Classification
3. KMEANS: Clustering
4. NARXNET: Time-series Prediction
When training nets, there is a matrix of input column vectors and a target matrix of corresponding output column vectors.
Although the double output syntax, [ x, t] works for MATLAB example data, e.g.,
help nndatasets
doc nndatasets
You may have to use the single output syntax twice for other data.
Hope this helps.
Thank you for formally accepting my answer

More Answers (1)

Greg Heath
Greg Heath on 21 Mar 2015
Time-series forecasting involves predicting future outputs given a subset of the present input, delayed past inputs and delayed past outputs.
Design of a time-series net uses pairs of input vectors and corresponding output target vectors to determine the weights and delays of the net.
See the time-series documentation on
Also see the specific documentation
help narxnet
doc narxnet
and numerous examples posted on both NEWSGROUP and ANSWERS.Search with
greg narxnet
Hope this helps.
Thank you for formally accepting my answer
Synthia Nongkhlaw
Synthia Nongkhlaw on 18 Feb 2016
Hi. I am working on neural network and i am facing the same problem - how to choose data for a target vector. If you know the answer please let me know. Thank you.
Greg Heath
Greg Heath on 18 Feb 2016
Each column "O"utput target vector of length O is associated with an I dimensional "I"nput vector.
So all you have to do is quantify what you would like to see when each input vector is presented. However, this is not necessarily a simple task.
For example, in classifying an input into one of c = 10 classes or categories, a neophyte might just use the class indices 1:c as targets.
However, since the difference between classes is not usually ordinal (e.g., features of class a are always greater than the corresponding features of class b just because a > b.)
Common practice now uses nominal outputs that are columns of the unit matrix eye(c).
For example, if c = 5
trueclassindices = [ 1 3 5 4 2] are converted to
target = full(ind2vec(trueclassindices))
Then if the output is a contaminated verion of the target, say,
output = target + 0.01*randn(5)
Then the estimated class indices are recovered via
estimatedclassindices = vec2ind(output)
Hope this helps.

Sign in to comment.


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!