示例#1
0
文件: htm.py 项目: arashgithub/pyHTM
 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)
示例#2
0
文件: htm.py 项目: Sandy4321/pyHTM-1
    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)))
示例#3
0
文件: htm.py 项目: Sandy4321/pyHTM-1
    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)
示例#4
0
文件: htm.py 项目: arashgithub/pyHTM
 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())
示例#5
0
文件: htm.py 项目: Sandy4321/pyHTM-1
    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())
示例#6
0
文件: htm.py 项目: arashgithub/pyHTM
 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)))