Beispiel #1
0
 def testColumnForCell2D(self):
     tm = ExtendedTemporalMemory(columnDimensions=[64, 64],
                                 cellsPerColumn=4)
     self.assertEqual(tm.columnForCell(0), 0)
     self.assertEqual(tm.columnForCell(3), 0)
     self.assertEqual(tm.columnForCell(4), 1)
     self.assertEqual(tm.columnForCell(16383), 4095)
Beispiel #2
0
    def testColumnForCellInvalidCell(self):
        tm = ExtendedTemporalMemory(columnDimensions=[64, 64], cellsPerColumn=4)

        try:
            tm.columnForCell(16383)
        except IndexError:
            self.fail("IndexError raised unexpectedly")

        args = [16384]
        self.assertRaises(IndexError, tm.columnForCell, *args)

        args = [-1]
        self.assertRaises(IndexError, tm.columnForCell, *args)
Beispiel #3
0
    def testColumnForCellInvalidCell(self):
        tm = ExtendedTemporalMemory(columnDimensions=[64, 64],
                                    cellsPerColumn=4)

        try:
            tm.columnForCell(16383)
        except IndexError:
            self.fail("IndexError raised unexpectedly")

        args = [16384]
        self.assertRaises(IndexError, tm.columnForCell, *args)

        args = [-1]
        self.assertRaises(IndexError, tm.columnForCell, *args)
Beispiel #4
0
 def testColumnForCell2D(self):
     tm = ExtendedTemporalMemory(columnDimensions=[64, 64], cellsPerColumn=4)
     self.assertEqual(tm.columnForCell(0), 0)
     self.assertEqual(tm.columnForCell(3), 0)
     self.assertEqual(tm.columnForCell(4), 1)
     self.assertEqual(tm.columnForCell(16383), 4095)
Beispiel #5
0
 def testColumnForCell1D(self):
     tm = ExtendedTemporalMemory(columnDimensions=[2048], cellsPerColumn=5)
     self.assertEqual(tm.columnForCell(0), 0)
     self.assertEqual(tm.columnForCell(4), 0)
     self.assertEqual(tm.columnForCell(5), 1)
     self.assertEqual(tm.columnForCell(10239), 2047)
Beispiel #6
0
 def testColumnForCell1D(self):
     tm = ExtendedTemporalMemory(columnDimensions=[2048], cellsPerColumn=5)
     self.assertEqual(tm.columnForCell(0), 0)
     self.assertEqual(tm.columnForCell(4), 0)
     self.assertEqual(tm.columnForCell(5), 1)
     self.assertEqual(tm.columnForCell(10239), 2047)