def __executeOne(self, learning): from numenta.htm import pool_spatial, pool_temporal for cell in self.cells: cell.clockTick() pool_spatial(self) pool_temporal(self, learning=True)
def __executeOne(self, learning): from numenta.htm import pool_spatial, pool_temporal for cell in self.cells: cell.clockTick() pool_spatial(self) self._updateSegments = pool_temporal(self, self._updateSegments, learning=learning) #non-Numenta optimization: #track whether cell is predicted next #penalize near segments for failing immediately if EXTENSION_NEXT_STEP_PENALTY: for cell in self.cells: #mark prediction of immediate next step cell.predictingNext = False for segment in cell.segmentsNear: if segment.active: cell.predictingNext = True if cell.predictedNext and not cell.active: #penalize only active near segments otherSynapseStates = [] for synapses in self._updateSegments[cell]: if len(synapses) and synapses[0].segment == segment: Segment.adapt_down(synapses) else: otherSynapseStates.append(synapses) self._updateSegments.reset(cell) self._updateSegments.addAll(cell, otherSynapseStates)