コード例 #1
0
  def testInhibitColumnsGlobal(self):
    sp = SpatialPooler(inputDimensions = [10],
                       columnDimensions = [10],
                       globalInhibition = True,
                       numActiveColumnsPerInhArea = 10)

    overlaps = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
    expectedActive = set([5, 6, 7, 8, 9])

    active = sp._inhibitColumns(np.array(overlaps, dtype=realDType))
    active = set(active)

    self.assertSetEqual(active, expectedActive,
                        "Input: {0}\tExpected: {1}\tActual: {2}".format(
                          overlaps, expectedActive, active))
コード例 #2
0
    def testInhibitColumnsGlobal(self):
        sp = SpatialPooler(inputDimensions=[10],
                           columnDimensions=[10],
                           globalInhibition=True,
                           numActiveColumnsPerInhArea=10)

        overlaps = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
        expectedActive = set([5, 6, 7, 8, 9])

        active = sp._inhibitColumns(np.array(overlaps, dtype=realDType))
        active = set(active)

        self.assertSetEqual(
            active, expectedActive,
            "Input: {0}\tExpected: {1}\tActual: {2}".format(
                overlaps, expectedActive, active))