Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
Neural Networks for Predicting Patterns in simple time series

Subject: Neural Networks for Predicting Patterns in simple time series

From: Toviah

Date: 21 Aug, 2013 14:36:06

Message: 1 of 4

Hi,

I'm trying to design an artificial neural network that will learn patterns in simple time series sequences
(such as [1 1 1 2 1 1 1 2 1 1 1 2] or [1 2 3 1 2 3 1 2 3]) and will correctly predict the value of the next value in the sequence based on the pattern. The network should also give a *bad* prediction when the pattern is disrupted, so for example in the second case, if we have [1 2 3 1 2 3 1 1], the network will produce a bad prediction for the final "1" in the sequence because we were expecting a "2" from the 1 2 3 pattern. I would like to use the previous values as the training data; in other words, the only available training data will be the actual values in the time series that precede the one which the network is currently predicting.

I'm a bit of a beginner when it comes to ANNs, so any help would be appreciated in terms of choosing and designing the right kind of ANN for this type of problem. I am also using an old version of Matlab (2007) so I would prefer code samples that would work with the 2007 NN toolbox if possible, but any help would be appreciated.

Many thanks.

Subject: Neural Networks for Predicting Patterns in simple time series

From: Greg Heath

Date: 23 Aug, 2013 00:17:06

Message: 2 of 4

"Toviah" wrote in message <kv2j8m$cgg$1@newscl01ah.mathworks.com>...
> Hi,
>
> I'm trying to design an artificial neural network that will learn patterns in simple time series sequences
> (such as [1 1 1 2 1 1 1 2 1 1 1 2] or [1 2 3 1 2 3 1 2 3]) and will correctly predict the value of the next value in the sequence based on the pattern. The network should also give a *bad* prediction when the pattern is disrupted, so for example in the second case, if we have [1 2 3 1 2 3 1 1], the network will produce a bad prediction for the final "1" in the sequence because we were expecting a "2" from the 1 2 3 pattern. I would like to use the previous values as the training data; in other words, the only available training data will be the actual values in the time series that precede the one which the network is currently predicting.
>
> I'm a bit of a beginner when it comes to ANNs, so any help would be appreciated in terms of choosing and designing the right kind of ANN for this type of problem. I am also using an old version of Matlab (2007) so I would prefer code samples that would work with the 2007 NN toolbox if possible, but any help would be appreciated.
>
> Many thanks.

What are the dimensions of your input and output matrices

size(input) = [ I N ]

size(target) = [ O N ]

Greg

Subject: Neural Networks for Predicting Patterns in simple time series

From: Toviah

Date: 3 Sep, 2013 14:40:10

Message: 3 of 4

"Greg Heath" <heath@alumni.brown.edu> wrote in message <kv69m2$hpo$1@newscl01ah.mathworks.com>...
> "Toviah" wrote in message <kv2j8m$cgg$1@newscl01ah.mathworks.com>...
> > Hi,
> >
> > I'm trying to design an artificial neural network that will learn patterns in simple time series sequences
> > (such as [1 1 1 2 1 1 1 2 1 1 1 2] or [1 2 3 1 2 3 1 2 3]) and will correctly predict the value of the next value in the sequence based on the pattern. The network should also give a *bad* prediction when the pattern is disrupted, so for example in the second case, if we have [1 2 3 1 2 3 1 1], the network will produce a bad prediction for the final "1" in the sequence because we were expecting a "2" from the 1 2 3 pattern. I would like to use the previous values as the training data; in other words, the only available training data will be the actual values in the time series that precede the one which the network is currently predicting.
> >
> > I'm a bit of a beginner when it comes to ANNs, so any help would be appreciated in terms of choosing and designing the right kind of ANN for this type of problem. I am also using an old version of Matlab (2007) so I would prefer code samples that would work with the 2007 NN toolbox if possible, but any help would be appreciated.
> >
> > Many thanks.
>
> What are the dimensions of your input and output matrices
>
> size(input) = [ I N ]
>
> size(target) = [ O N ]
>
> Greg


They could be of any size, but let's say for now they are both 1*30.

Subject: Neural Networks for Predicting Patterns in simple time series

From: Greg Heath

Date: 3 Sep, 2013 16:01:09

Message: 4 of 4

"Toviah" wrote in message <l04sca$pj2$1@newscl01ah.mathworks.com>...
> "Greg Heath" <heath@alumni.brown.edu> wrote in message <kv69m2$hpo$1@newscl01ah.mathworks.com>...
> > "Toviah" wrote in message <kv2j8m$cgg$1@newscl01ah.mathworks.com>...
> > > Hi,
> > >
> > > I'm trying to design an artificial neural network that will learn patterns in simple time series sequences
> > > (such as [1 1 1 2 1 1 1 2 1 1 1 2] or [1 2 3 1 2 3 1 2 3]) and will correctly predict the value of the next value in the sequence based on the pattern. The network should also give a *bad* prediction when the pattern is disrupted, so for example in the second case, if we have [1 2 3 1 2 3 1 1], the network will produce a bad prediction for the final "1" in the sequence because we were expecting a "2" from the 1 2 3 pattern. I would like to use the previous values as the training data; in other words, the only available training data will be the actual values in the time series that precede the one which the network is currently predicting.
> > >
> > > I'm a bit of a beginner when it comes to ANNs, so any help would be appreciated in terms of choosing and designing the right kind of ANN for this type of problem. I am also using an old version of Matlab (2007) so I would prefer code samples that would work with the 2007 NN toolbox if possible, but any help would be appreciated.
> > >
> > > Many thanks.
> >
> > What are the dimensions of your input and output matrices
> >
> > size(input) = [ I N ]
> >
> > size(target) = [ O N ]
> >
> > Greg
>
>
> They could be of any size, but let's say for now they are both 1*30.

I was expecting more info than that. I am confused.

You have used 3 patterns of different sizes (12,9,8) in your question and you only have a data set of length 30? If you go to help nndatasets you will see that the serious time-series examples typically have 100 or more data points and stationary statistics with
modest significant correlation lengths.

Perhaps what you want is a static pattern recognizer (newpr or newff). However, this
requires inputs of fixed length. Therefore, you may have to zeropad.

If this is not what you want, you need to explain your problem in much more detail.

Hope this helps.

Greg.

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us