Union Pooler Psuedocode - numenta/htmresearch GitHub Wiki
Union Pooler Algorithm Pseudocode
Note: This algorithm is a work in progress. (5.11.15)
Data Structures
activeInput - Binary vector representing active cells from Temporal Memory
predictedActiveInput - Binary vector representing correctly predicted active cells from Temporal Memory
poolingActivation - A vector of scalar activation values for each cell in the Union Pooler
Parameters
activeOverlapWeight - Weight given to overlap due to activeInput
predictedActiveOverlapWeight - Weight given to overlap due to predictedActiveInput
activationFunction - A function that updates a pooling activation value based on an excitation or a decay. Possible forms include linear, exponential, or logistic.
maxUnionActivity - Maximum allowed size of the union SDR as a percentage of the number of Union Pooler cells
Algorithm
# Compute current active cells based on current input
activeOverlaps = calcOverlap(activeInput)
predictedActiveOverlaps = calcOverlap(predictedActiveInput)
totalOverlap = (activeOverlaps * activeOverlapWeight + predictedActiveOverlaps *
predictedActiveOverlapWeight)
boostedOverlaps = boost * totalOverlap if learn else totalOverlap
activeCells = inhibitColumns(boostedOverlaps)
# Perform Spatial Pooler learning algorithm with boosting
adaptSynapses(activeInput, activeCells)
updateDutyCycles(totalOverlap, activeCells)
bumpUpWeakColumns()
updateBoostFactors()
if isUpdateRound():
updateInhibitionRadius()
updateMinDutyCycles()
# Update Union SDR based on new set of active cells; decrement pooling activation of all cells
decayFunction.decay(poolingActivation)
# Add to the poolingActivation of those active Union Pooler cells receiving active inputs
addToPoolingActivation(activeCells, activeOverlaps)
# Same for Union Pooler cells receiving active-predicted inputs
addToPoolingActivation(activeCells, predictedActiveOverlaps)
# Compute the current most salient cells in terms of poolingActivation.
# Cells with zero poolingActivation cannot win.
unionSDR = getMostActiveCells(poolingActivation, columnCount * maxUnionActivity)
return unionSDR