# Temporal classification

**URL:** <https://discourse.numenta.org/t/temporal-classification/2104>\
**Category:** NuPIC\
**Tags:** classification\
**Created:** [April 5, 2017, 6:15pm UTC](https://discourse.numenta.org/t/temporal-classification/2104 "2017-04-05T18:15:59Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![breznak](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.numenta.org/breznak/32/1935_2.png) [@breznak](https://discourse.numenta.org/u/breznak)\
**Post date:** [April 5, 2017, 6:15pm UTC](https://discourse.numenta.org/t/temporal-classification/2104/1 "2017-04-05T18:15:59Z")

</div>

# Description of Temporal classification

Temporal classification is a task of classification of sequences (time series data) into given categories.  
For more see [https://en.wikipedia.org/wiki/Time\_series#Classification](https://en.wikipedia.org/wiki/Time_series#Classification)

# Methods to do Temporal Classification in NuPIC

## Old: temporal classification model (obsolete)

Was used by NuPIC, but now is mentioned unused (and not sure to work)

> <https://github.com/numenta/nupic/blob/4723a4616fdaa9f3a78c6b851d8bfa855f0fb44c/nupic/frameworks/opf/clamodel.py#L407>

  

> <https://github.com/numenta/nupic/blob/4723a4616fdaa9f3a78c6b851d8bfa855f0fb44c/nupic/frameworks/opf/clamodel.py#L546>

TODO: please explain how it used to work, why was it abandoned?

## Current: compare multiple models (prototypes)

As nowadays no method for temporal classification is directly provided, we can “fallback” to `multiple models`, training each for one of the classes, the each model serves as a `prototype` for the given class.

### Training:

Separate the data (sequences) by class, and train a model on data of only one class.

### Classification:

Sequence to be tested is fed into both (all) models, and the best performant model is selected as a class for the tested sample.

### Results:

(just my unofficial experience, I had very good results with this method on EEG binary classification (healthy/ill), compared to complex multi layer NNs.

## (Soonish)Future: Temporal Memory

Temporal memory will transform a sequence to a single SDR. This way temporal classification could easily be made.

### Training:

Create your model something like: `data->SP->TP->TM-->SP2`  
where spatial pooler SP2 will receive (more stable) output from the TM (SDR representing the current sequence) + the class for given sequence (all the time data from the given sentence is fed, the belonging class is passed).

### Classification:

Run all your datapoints for one sequence through TP-\>TM, obtain SDR describing the sequence, feed it into the SP2 and look which of the classes has the most bits ON, that is the label.

### Improvement:

Difference to the model above is that TM creates a stable pattern for the whole sequence (or parts of it) and that SP2 has notion of both the classes, so it can discriminate better.

# Usecases

- ECG/EEG classification
- TODO …
