Itay - 2014-06-21

Experimental temporal pooler : Concepts and pseudo code (Not tested 100% thoroughly)

The experimental temporal pooler is made as an easy and working alternative to the broken OpenHTM temporal pooler. While numenta's original temporal pooler is available in nupic's source code, it is complicated to understand and there is not yet an easy environment to use and test it.

There should be tests done to compare nupic's temporal pooler against the experimental temporal pooler.

This temporal pooler started as my own project after I saw numenta's temporal pooler did not work (in the OpenHTM source code), and while nupic's code is avaliable, it still is my own project and does it in a different way than numenta's original temporal pooler. And that's the reason I'm still developing it.

Purpose : the experimental temporal pooler tracks active columns in time, and activates proper predictions of what columns should be active at the next timestep.
The principle is simple : it captures, like a camera, the state of the active columns, and at the same time, reinforces or de-reinforces patterns of changing active columns.

Limitations :
you can only record a sequence as long as the number of cells in the column you have. and this also limits the number of possible sequences. the number of possible recorded sequences is the number of cells per column.
Cells can not be re-used and can only contain one segment each.
* Sequence loops are not recorded.

Concepts :
The state transformation of active columns is recorded by assigning a new learning cell per every active column. it records the transformation between previous cells who were active before and were also learning cells. The track between previous and current learning cells is extremely important, because this way you can record long sequences while not losing context.
While keeping track of the events of the active columns, it's also modifies the synapses of every predicted cell. and this way increases or decreases more relevant sequences.

Pseudo code :

  1. Manage internal states of cells :
  2. Mark cells who are learning, as were learning in the previous timesteps.
  3. Mark cells who are predicting, as were predicting in the previous timesteps.

  4. Gather a list of all the previous learning cells.

Receiving active columns inputs :
2. Pass on all the columns
- If the column is active, then :
-- If there were cells in the column who were predicted in the previous timestep, then turn them to active cells.
-- If there were no cells in the column who were predicted in the previous timestep, then all the cells in the column are active.
-- For every cell, decrease "new learning cooldown" and increase the cell's age.

Managing learning cells :
3. Pass on all the columns
- If the column is active, then :
-- Select the learning cell as a cell in the column that has no synapses.
-- If all the cells have some synapses, then select a cell from the column based on two keys : The first (and more important key) is the cell with the worst permanence, the second key is the cell's age. (longer age - more chance for the cell to get chosen as learning cell)
-- Once you have a learning cell selected, delete all it's synapses, and gather new synapses by creating random links to previous learning cells in the region. The amount of synapses to add for each learning cell is set by the user. The initial permanence for these synapses is set to the lowest permanence value for synapse connection.
-- For the new learning cell, set it's current state as "learning cell", set it's cooldown to half the number of cells per column, and it's age to 0.

Learning and modifying permanences :
4. Pass on all the columns
4.1. Pass on all the cells in the column :
- If the cell is active and was predicted, then increase all it's synapses permanence.
- If the cell is not active and was predicted twice in a row, then decrease all it's synapses permanence.

Performing predictions for the next timestep :
5. Pass on all the columns :
5.1. Pass on all the cells in the column :
- If the cell has a number of synapses which have been originated from active cells, and this number is bigger than the active segment threshold, then mark this cell as predicting.