I’m currently trying to code my own version of an HTM in c++, as i have different goals and ideas than the community one, plus I like to understand the whole process intricately. I’m going to post my stupid/very specific questions to here rather than make each one its own topic as I go along.
Question 1: for the pseudoCode in the book, There’s this function (segmentsForColumn(column, segments) : Given a set of segments, return the segments that are on a cell in this column.) - When this says “on a cell”, like the segment is coming FROM this column (and spreading its synapses elsewhere), or a SYNAPSE of another dendrite is touching a cell IN this column?
Question 2: for the pseudoCode numActivePotentialSynapses: A “potential synapse” is a synapse with any permanence - Does this include permanence of 0? I’m wondering how the number of PotentialSynapses would decrease
Hi @Jossos, not stupid at all, I just got through the same process myself.
Correct, that count would include permenance of 0.
In this beginner version of your Temporal Memory, I don’t think the number of PotentialSynapses will ever decrease. Pruning out older unused connections is a more advanced feature, you may have to look into the NuPIC source for that.
Question 3: I’m wondering how some of the numbers are decided, and what some of the numbers are. like, why 2048 minicolumns? im not sure how many minicolumns are in an actual cortical column, but i think i read it was about 10x10? and each column had about 100 neurons? I’m guessing that 2048 minicolumns is meant to simulation a large amount of actual columns, since columns tend to be very interconnected?
Question 4: What are good values for the number of Distal Segments per cell? just 1? 100? what would effectively happen if i increased/decreased this number, and why would I want it higher/lower? Also how many synapses do/should segments have each? and how many synapses should I want to have as active threshold to activate a segment? I think i read in the book that it may be good to have 1 distal segment, with 80 synapses, and a threshold of 15 to activate to give it about 4 possible different uses for that neuron. why not have 4 distal segments with 20 synapses each?
Question 5: What’s the deal with layers? is the idea to have a 2048 minicolumn layer of like 4 neurons each, and then have like 4 of these? since each “layer” would output an sdr, would that just get fed in as the proximal/input to the next layer? I thought a 10x10x100 cortical column had the 4 layers in that single column?
In actual cortex the number of mini-columns is vastly greater. The reach of an individual mini-column is about 8 mini-columns, for a diameter of about 15 mini-columns. This works out to a neighborhood of about 220 mini-columns in the cortex.
Each mini-column has something like 100 to 150 cells working together, distributed between layers L2/3, L4, L5, & L6. Each cell has something like 6 dendrites, each festooned with synapses.
Each dendrite is the part that forms the SDR, with the possibility that a single dendrite can form more than one SDR memory.
The HTM model is a simplification that allows the computational power of the cortex to be modeled by the hardware available to the average experimenter. The usual features are:
The number of cell bodies is reduced to 16 in most HTM simulations. This is assumed to model one layer, the best fit to the biology being L4.
The reach of the HTM dendrite is assumed to reach all cell bodies although there is an option called “topology” that is somewhat more realistic.
The number of possible synapse connections is all mini-columns but with sparse connections, the actual number of connections is usually somewhere around 40.
The macro-columns formed are a rough approximation of the topography of cortex but they capture the essential voting nature of cortical columns.
“In actual cortex the number of mini-columns is vastly greater.” - I googled this, and wikipedia says " There are about 100,000,000 cortical minicolumns in the neo-cortex with up to 110 neurons each, giving 1,000,000–2,000,000 cortical columns."
which with simple math gives you 100 mini columns per cortical column. am i reading this wrong? or are cortical columns not really separate entities?
also with distal segments, i thought these were supposed to stretch throughout the entire brain, but you’re saying they only have a connection radius of about 8 minicolumns?
Also Im a bit confused how you would create a program with multiple cortical columns to form a hierarchy. I was thinking 2 cortical columns active cells create 2 sdr’s for the input/proximal connections of a “higher up” cortical column, or does this hierarchy have a different way of working? i imagine you could manually create a hierarchy of cortical columns, with the lower “layer” being the input cortical columns, and then creating a vector of bits of the entire layer maybe (or squash them all into an sdr with the spatial pooler?), and using this as input for columns higher in the hierarchy?
Estimates vary between 100 and 150 cells per column. There is the further complication that the cells are distributed between layers 2/3, 4, 5, and 6. Layers 2/3 & 4 are thought to form the feed-forward direction of processing and layers 5 & 6 are thought to form the feedback pathway.
You can see the actual mini-columns with a microscope. To the best of my knowledge nobody has been able to demonstrate actual macro-columns although the way that lateral connections work are very suggestive and there are important theoretical reasons why they should exist.
I have my own theory that I have been boring everyone here with for a long time - that the local macro-grouping is a hexagonal grid structure. I have a post that outlines why I think this makes sense:
My understanding is that these variables relate to the “ability to detect coincidence”.
A cell with a single segment can only detect a single coincidence amongst it’s synapses (like the Spatial Pooler). Add more segments, and a cell can respond to several different coincidences. In our case, this means opening additional temporal contexts for our input sequences, and making sure cells aren’t being wasted with empty capacity.
Increasing the # of synapses on a segment is like widening the field of view on a single coincidence detector. Having few synapses is like a coincidence spotlight, while having many synapses is more like a coincidence floodlight.
As usual, the ideal numbers will differ depending on your data, and what you’re trying to do. I’m not sure on NuPIC’s settings yet, but that’s the best place to start. Biologically, I recall each cell having between 12 and 24 segments, and each segment having hundreds of synapses.
Yeah, I think you’ve got the basics. One Region could be 2048 minicolumns wide, and 4 neurons tall. And then, you could stack several of those Regions into a Hierarchical network, the output of one being the input to the next.
I’ve lost you on that last line about “10x10x100”, though, sorry.
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
grow and reinforce synapses to previous winner cells
find the cell with the least segments, mark it as a winner cell
(optimization) if there are prev winner cells
add a segment to this winner cell
grow synapses to previous winner cells
if columnMatchingSegments is not None:
numActive = lambda s: numActivePotentialSynapsesForSegment[s.flatIdx]
bestMatchingSegment = max(columnMatchingSegments, key=numActive)
winnerCell = bestMatchingSegment.cell
cls._adaptSegment(connections, bestMatchingSegment, prevActiveCells,
nGrowDesired = maxNewSynapseCount - numActive(bestMatchingSegment)
if nGrowDesired > 0:
cls._growSynapses(connections, random, bestMatchingSegment,
nGrowDesired, prevWinnerCells, initialPermanence,
winnerCell = cls._leastUsedCell(random, cellsForColumn, connections)
nGrowExact = min(maxNewSynapseCount, len(prevWinnerCells))
if nGrowExact > 0:
segment = cls._createSegment(connections,
cls._growSynapses(connections, random, segment, nGrowExact,
There is no ‘growNewSegment’ function, though there are ‘_createSegment’ and ‘_growSynapses’.