本文整理汇总了Python中nupic.research.spatial_pooler.SpatialPooler._overlapDutyCycles方法的典型用法代码示例。如果您正苦于以下问题:Python SpatialPooler._overlapDutyCycles方法的具体用法?Python SpatialPooler._overlapDutyCycles怎么用?Python SpatialPooler._overlapDutyCycles使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类nupic.research.spatial_pooler.SpatialPooler
的用法示例。
在下文中一共展示了SpatialPooler._overlapDutyCycles方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: testBumpUpWeakColumns
# 需要导入模块: from nupic.research.spatial_pooler import SpatialPooler [as 别名]
# 或者: from nupic.research.spatial_pooler.SpatialPooler import _overlapDutyCycles [as 别名]
def testBumpUpWeakColumns(self):
sp = SpatialPooler(inputDimensions=[8],
columnDimensions=[5])
sp._synPermBelowStimulusInc = 0.01
sp._synPermTrimThreshold = 0.05
sp._overlapDutyCycles = numpy.array([0, 0.009, 0.1, 0.001, 0.002])
sp._minOverlapDutyCycles = numpy.array(5*[0.01])
sp._potentialPools = SparseBinaryMatrix(
[[1, 1, 1, 1, 0, 0, 0, 0],
[1, 0, 0, 0, 1, 1, 0, 1],
[0, 0, 1, 0, 1, 1, 1, 0],
[1, 1, 1, 0, 0, 0, 1, 0],
[1, 1, 1, 1, 1, 1, 1, 1]])
sp._permanences = SparseMatrix(
[[0.200, 0.120, 0.090, 0.040, 0.000, 0.000, 0.000, 0.000],
[0.150, 0.000, 0.000, 0.000, 0.180, 0.120, 0.000, 0.450],
[0.000, 0.000, 0.014, 0.000, 0.032, 0.044, 0.110, 0.000],
[0.041, 0.000, 0.000, 0.000, 0.000, 0.000, 0.178, 0.000],
[0.100, 0.738, 0.045, 0.002, 0.050, 0.008, 0.208, 0.034]])
truePermanences = [
[0.210, 0.130, 0.100, 0.000, 0.000, 0.000, 0.000, 0.000],
# Inc Inc Inc Trim - - - -
[0.160, 0.000, 0.000, 0.000, 0.190, 0.130, 0.000, 0.460],
# Inc - - - Inc Inc - Inc
[0.000, 0.000, 0.014, 0.000, 0.032, 0.044, 0.110, 0.000], #unchanged
# - - - - - - - -
[0.051, 0.000, 0.000, 0.000, 0.000, 0.000, 0.188, 0.000],
# Inc Trim Trim - - - Inc -
[0.110, 0.748, 0.055, 0.000, 0.060, 0.000, 0.218, 0.000]]
sp._bumpUpWeakColumns()
for i in xrange(sp._numColumns):
perm = list(sp._permanences.getRow(i))
for j in xrange(sp._numInputs):
self.assertAlmostEqual(truePermanences[i][j], perm[j])