Does Hotgym (one gym) prediction example of nupic implements Temporal Memory for prediction

Hi @all,

I’m sorry this is such a stupid question, but I still not understand which algorithm is used for prediction in hot gym (one gym) example in nupic and which part in the source code shows that. Besides, I still have consideration that if HTM is the name for a process of “Encoding -> Spatial Pooling -> Temporal Memory” or it is a name of a concept and it can contains different processes of algorithms. Thank you in advance.



1 Like

The hot gym OPF example in the NuPIC codebase is using an older version of temporal memory that includes some non-biological tricks. We call it the BacktrackingTM. But the hot gym Quick Start uses the proper TM.

1 Like

Here’s where the TM implementation is controlled, in the model params file. If you wanted to use the ‘proper’ TM you’d change ‘temporalImp’ to 'tm_cpp’.

    'tmParams': {
        # TM diagnostic output verbosity control;
        # 0: silent; [1..6]: increasing levels of verbosity
        # (see verbosity in nupic/trunk/py/nupic/research/ and
        'verbosity': 0,

        # Number of cell columns in the cortical region (same number for
        # SP and TM)
        # (see also tpNCellsPerCol)
        'columnCount': 2048,

        # The number of cells (i.e., states), allocated per column.
        'cellsPerColumn': 32,

        'inputWidth': 2048,

        'seed': 1960,

        # Temporal Pooler implementation selector (see _getTPClass in
        'temporalImp': 'cpp',

Here’s where they specify the different ‘temporalImp’ states:

1 Like

hi @sheiser1,

thank you for your answer, but I still have confusion when following the source code. I have some questions that need to be clarified:

  1. There’re 2 encoders “Date Encoder” and “Scalar Encoder” are used. But how the final encoded data stream generated? (union of two encoded or other method?)
  2. Is there any UML structure of the process of how the program perform? From encoding -> spatial pooling -> temporal memory -> predicting.

thank you in advanced.


There’s one vector generated by each encoder, and they are concatenated together to form a total encoding vector.

The total encoding vector (00011000010…0000111000) is fed into the Spatial Pooler, which outputs another larger, sparser vector (an SDR). This SDR (representing which 2% of mini columns have been activated by the SP) is then fed into the Temporal Memory, which generates a set of predicted cells and an anomaly score.

If the model is meant for raw metric forecasting (as opposed to just anomaly detection), the TM output (set of predicted cells) is passed into the SDR Classifier, which maps it to a set of raw metric value(s).

So very basically:

Input = rawdata
Output(s) = anomaly scores; **metric forecast(s)

**if in forecasting mode