本文整理汇总了Python中nupic.bindings.algorithms.SpatialPooler._updateDutyCycles方法的典型用法代码示例。如果您正苦于以下问题:Python SpatialPooler._updateDutyCycles方法的具体用法?Python SpatialPooler._updateDutyCycles怎么用?Python SpatialPooler._updateDutyCycles使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类nupic.bindings.algorithms.SpatialPooler
的用法示例。
在下文中一共展示了SpatialPooler._updateDutyCycles方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: testUpdateDutyCycles
# 需要导入模块: from nupic.bindings.algorithms import SpatialPooler [as 别名]
# 或者: from nupic.bindings.algorithms.SpatialPooler import _updateDutyCycles [as 别名]
def testUpdateDutyCycles(self):
sp = SpatialPooler(inputDimensions = [5],
columnDimensions = [5])
initOverlapArr1 = np.array([1, 1, 1, 1, 1], dtype=realDType)
sp.setOverlapDutyCycles(initOverlapArr1);
overlaps = np.array([1, 5, 7, 0, 0], dtype=uintDType)
active = np.array([0, 0, 0, 0, 0], dtype=uintDType)
sp.setIterationNum(2)
sp._updateDutyCycles(overlaps, active);
resultOverlapArr1 = np.zeros(5, dtype=realDType)
sp.getOverlapDutyCycles(resultOverlapArr1)
trueOverlapArr1 = np.array([1, 1, 1, 0.5, 0.5], dtype=realDType)
self.assertEqual(list(resultOverlapArr1), list(trueOverlapArr1))
sp.setOverlapDutyCycles(initOverlapArr1);
sp.setIterationNum(2000);
sp.setUpdatePeriod(1000);
sp._updateDutyCycles(overlaps, active);
resultOverlapArr2 = np.zeros(5, dtype=realDType)
sp.getOverlapDutyCycles(resultOverlapArr2);
trueOverlapArr2 = np.array([1, 1, 1, 0.999, 0.999], dtype=realDType)
self.assertEqual(list(resultOverlapArr2), list(trueOverlapArr2))