SP / TM connectivity questions

Dear @rhyolight @marty1885 @sheiser1 and all!

we can install & run the Nupic. When compare to Necortex/HTM theory, i still have question. Hope anyone help explain.

In NUPIC , in TM we use 2048 minicolums and 32 cell per colums that means we have totally 2048 * 32=65536 cells.

But every cell has only 128 dendrite segments ( for prediction), and each segment has maximum 32 synapes ( maxSegmentsPerCell=128,
maxSynapsesPerSegment=32) => each cell has only 128*32=4096 synapes .

That means each cell can not connect ( has synapes) to all other cells ( 65535 cells) in TM.

So the questions is:

  1. Which 4096 cells that a cell connect to for prediction ( etablish synapes) ?
  2. These synapses ( between a cell to 4096 orther cells) are fixed or changed everytime has a new feedforward ?

Thank you very much.

Hi

Which 4096 cells that a cell connect to for prediction ( etablish synapes) ?

The Temporal Memory layer learns the connection on the fly. To be particular, in every time step, segments can grow up-to maxNewSynapse synapses to previous winning cells.

These synapses ( between a cell to 4096 orther cells) are fixed or changed everytime has a new feedforward ?

They grow as time goes on can decays if the relation turns out to be false.

Thank you @marty1885 for quick help . But i still dont understand

Yes, every cell can only go up to 32 synapses per segment. That’s the limit. Synapses doesn’t grow in that segment anymore. Though it can grow in others if it choose to.

yes. because of every cell has a limited synapes ( 4096) so that cell has to choose which cells to connect ( has synapes) ??

Ex: HTM has 65536 cell. I assume :smile:

1st cell
2nd cell


65536nd cell

So In Nupic Algorithm, the 1st cell has synapes to whịch cells in 65535 cells above ?

Thank you very much.

Indeed, a single cell does not connect to all of them. It connects sparsely, only to those that are relevant.

To one from a subset of those which were active at previous step, when it is time for this cell to “predict” that it will fire next. This works because activations are sparse, and a subset of a sparse vector is sufficient to identify another sparse vector with huge probability. So
 in effect, only those synapses are required to be remembered for the TM to learn a sequence of events.
Connecting all of them would be self defeating. For TM and
 for brains.

1 Like

thank you @gmirey, i can understand that in the neocortex theory . But in the NUPIC, i mean in programming algorithm, it has to be defined clearly. So how can NUPIC choose the cells to make synapses to ?? ( random or near cells or 
?) do you know that ? pls show me. thank you.

Oh, okay.
Well, I have a limited knowledge of python and current NuPIC implementation, but after a quick search, I found that each post-synaptic cell in NuPIC has a map of its synapses per pre-synaptic cell. When one asks whether a cell had distal segments considered “activated” (hence cell should be predictive), seems like NuPIC runs this:

in https://github.com/htm-community/nupic.py/blob/master/src/nupic/algorithms/connections.py

[384] for cell in activePresynapticCells:
  for synapse in self._synapsesForPresynapticCell[cell]:
    flatIdx = synapse.segment.flatIdx
    numActivePotentialSynapsesForSegment[flatIdx] += 1
    if synapse.permanence > threshold:
      numActiveConnectedSynapsesForSegment[flatIdx] += 1

it’s quite backwards as compared to how I envision that myself, but it should work for the purpose of identifying which particular cells a synapse is connected to, right? either presynaptic cell is an existing key to the “_synapsesForPresynapticCell” map for that post-synaptic cell (and map carries seg index and permanence for it), or it is not.

in https://github.com/htm-community/nupic.py/blob/master/src/nupic/algorithms/temporal_memory.py
something along those lines:

[595] Pseudocode:
mark all cells as active
if there are any matching distal dendrite segments
  find the most active matching segment
  mark its cell as a winner cell
  (learning)
    grow and reinforce synapses to previous winner cells
else
  find the cell with the least segments, mark it as a winner cell
  (learning)
    (optimization) if there are prev winner cells
      add a segment to this winner cell
      grow synapses to previous winner cells

(this learning algorithm applies to a bursting “column”: one which did not predict it would fire, where you’ll see most of the segment or synaptic growth occurring).

2 Likes

thank you @gmirey . i also found this

Implementation details: in our software implementation, we make some simplifying assumptions that greatly speed up simulation time for larger networks. Instead of explicitly initializing a complete set of synapses across every segment and every cell, we greedily create segments on a random cell and initialize potential synapses on that segment by sampling from currently active cells. This happens only when there is no match to any existing segment. In our simulations N = 2048, M = 32, k = 40. We typically randomly connect between 20 and 40 synapses on a segment, and ξ is around 15. Permanence values vary from 0 to 1 with a connection threshold of 0.5. p+ and p− are small values that are tuned based on the individual dataset but typically less than 0.1. The full source code for the implementation is available on Github at GitHub - numenta/nupic-legacy: Numenta Platform for Intelligent Computing is an implementation of Hierarchical Temporal Memory (HTM), a theory of intelligence based strictly on the neuroscience of the neocortex..

Full in this link https://www.frontiersin.org/articles/10.3389/fncir.2016.00023/full

But i still hope find a intuitive and easier document to undestand what method that Nupic Core use for choose synapes, dendrite segments (in phases initialization, learning+updating, 
)

thank you

I had to create visualizations of the SP and TM to really understand it. Then I made this. This is the best I can hope to explain it today. :man_shrugging:

Imagine this picture of distal connections to the same layer (Temporal Memory):

But each cell has multiple segments (in this pic each cell has only one).

4 Likes

@rhyolight: thank you very much. Tonight i will see these your video clip . and ask you more.

have a nice day or night .