Unecessary calls to sp._getColumnNeighborhood()?


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


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.


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)
          if self._isUpdateRound():