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).