def testDataLoop(self): htm = self.htm data = [[1,0,1],[0,0,1]] #2d format, same dimensions as htm (for now) htm.initialize_input(data) htm.execute(flipDataGenerator(htm), ticks=20)
def testPatternTraining(self): 'test that within columns, particular cells dominate when they recognize learned temporal patterns' htm = self.htm #2d format, same dimensions as htm (for now) data = [ [1, 0, 1, 0, 1, 0, 1, 0, 1, 0], [0, 0, 0, 0, 1, 0, 1, 0, 1, 1], [0, 0, 1, 0, 1, 0, 0, 0, 0, 1], [0, 1, 0, 0, 1, 1, 0, 1, 0, 1], [1, 0, 1, 0, 1, 0, 1, 0, 0, 1], [0, 0, 0, 1, 1, 0, 0, 0, 1, 1], ] htm.initialize_input(data) flipDat = flipDataGenerator(htm) htm.execute(flipDat, ticks=100) activeCols = htm.columns_active() #all columns should have learned particular cell patterns by now for col in activeCols: self.assertNotEqual( len(col.cells), len(filter(lambda cell: cell.active, col.cells)))
def testDataLoop(self): htm = self.htm data = [[1, 0, 1], [0, 0, 1]] #2d format, same dimensions as htm (for now) htm.initialize_input(data) htm.execute(flipDataGenerator(htm), ticks=20)
def testStability(self): 'test that repeated patterns get recognized by the same columns after stabilizing' htm = self.htm #2d format, same dimensions as htm (for now) data = [[1,0,1,0,1,0,1,0,1,0],[0,0,0,0,1,0,0,0,0,1]] htm.initialize_input(data) flipDat = flipDataGenerator(htm) htm.execute(flipDat, ticks=50) active = htm.columns_active() htm.execute(flipDat, ticks=1) self.assertEqual(active, htm.columns_active()) htm.execute(flipDat, ticks=1) self.assertEqual(active, htm.columns_active()) #show that stability is non-trivial because it changes at the next time step htm.execute(flipDat, ticks=0) self.assertNotEqual(active, htm.columns_active())
def testStability(self): 'test that repeated patterns get recognized by the same columns after stabilizing' htm = self.htm #2d format, same dimensions as htm (for now) data = [[1, 0, 1, 0, 1, 0, 1, 0, 1, 0], [0, 0, 0, 0, 1, 0, 0, 0, 0, 1]] htm.initialize_input(data) flipDat = flipDataGenerator(htm) htm.execute(flipDat, ticks=50) active = htm.columns_active() htm.execute(flipDat, ticks=1) self.assertEqual(active, htm.columns_active()) htm.execute(flipDat, ticks=1) self.assertEqual(active, htm.columns_active()) #show that stability is non-trivial because it changes at the next time step htm.execute(flipDat, ticks=0) self.assertNotEqual(active, htm.columns_active())
def testPatternTraining(self): 'test that within columns, particular cells dominate when they recognize learned temporal patterns' htm = self.htm #2d format, same dimensions as htm (for now) data = [ [1,0,1,0,1,0,1,0,1,0], [0,0,0,0,1,0,1,0,1,1], [0,0,1,0,1,0,0,0,0,1], [0,1,0,0,1,1,0,1,0,1], [1,0,1,0,1,0,1,0,0,1], [0,0,0,1,1,0,0,0,1,1], ] htm.initialize_input(data) flipDat = flipDataGenerator(htm) htm.execute(flipDat, ticks=100) activeCols = htm.columns_active() #all columns should have learned particular cell patterns by now for col in activeCols: self.assertNotEqual(len(col.cells), len(filter(lambda cell: cell.active, col.cells)))