本文整理汇总了Python中nupic.algorithms.temporal_memory.TemporalMemory.numberOfColumns方法的典型用法代码示例。如果您正苦于以下问题:Python TemporalMemory.numberOfColumns方法的具体用法?Python TemporalMemory.numberOfColumns怎么用?Python TemporalMemory.numberOfColumns使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类nupic.algorithms.temporal_memory.TemporalMemory
的用法示例。
在下文中一共展示了TemporalMemory.numberOfColumns方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: TM
# 需要导入模块: from nupic.algorithms.temporal_memory import TemporalMemory [as 别名]
# 或者: from nupic.algorithms.temporal_memory.TemporalMemory import numberOfColumns [as 别名]
tm = TM(columnDimensions = (50,),
cellsPerColumn=2,
initialPermanence=0.5,
connectedPermanence=0.5,
minThreshold=8,
maxNewSynapseCount=20,
permanenceIncrement=0.1,
permanenceDecrement=0.0,
activationThreshold=8,
)
# Step 2: create input vectors to feed to the temporal memory. Each input vector
# must be numberOfCols wide. Here we create a simple sequence of 5 vectors
# representing the sequence A -> B -> C -> D -> E
x = numpy.zeros((5, tm.numberOfColumns()), dtype="uint32")
x[0, 0:10] = 1 # Input SDR representing "A", corresponding to columns 0-9
x[1, 10:20] = 1 # Input SDR representing "B", corresponding to columns 10-19
x[2, 20:30] = 1 # Input SDR representing "C", corresponding to columns 20-29
x[3, 30:40] = 1 # Input SDR representing "D", corresponding to columns 30-39
x[4, 40:50] = 1 # Input SDR representing "E", corresponding to columns 40-49
# Step 3: send this simple sequence to the temporal memory for learning
# We repeat the sequence 10 times
for i in range(10):
# Send each letter in the sequence in order
for j in range(5):
activeColumns = set([i for i, j in zip(count(), x[j]) if j == 1])
示例2: testNumberOfColumns
# 需要导入模块: from nupic.algorithms.temporal_memory import TemporalMemory [as 别名]
# 或者: from nupic.algorithms.temporal_memory.TemporalMemory import numberOfColumns [as 别名]
def testNumberOfColumns(self):
tm = TemporalMemory(
columnDimensions=[64, 64],
cellsPerColumn=32
)
self.assertEqual(tm.numberOfColumns(), 64 * 64)