Unecessary calls to sp._getColumnNeighborhood()?


#1

I was poking around in the spatial pooler and noticed that this function really only really needs to be called once per column (per program lifespan).

https://github.com/numenta/nupic/blob/master/src/nupic/research/spatial_pooler.py#L1495-L1517

The only reason to re-call it would be if the column dimensions or inhibition radius changed, which should not happen after construction.

_getColumnNeighborhood is called once per column when updating boost factors, during inhibition, and when updating duty cycles.

Would it not be better to calculate the neighborhoods on SP construction and keep it around as a lookup? We’d take a memory hit, but it might be worth it.


#2

If I am not wrong the local inhibition algorithm also updates the radius of all columns if it is the updating cycle. So that neighborhood changes every X amount of iteration set by the self._updatePeriod variable to help with the columnar competition.

if learn:
          self._adaptSynapses(inputVector, activeColumns)
          self._updateDutyCycles(self._overlaps, activeColumns)
          self._bumpUpWeakColumns()
          self._updateBoostFactors()
          if self._isUpdateRound():
            self._updateInhibitionRadius()
            self._updateMinDutyCycles()