当前位置: 首页>>代码示例>>Python>>正文


Python TemporalMemory.numberOfColumns方法代码示例

本文整理汇总了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])
开发者ID:Erichy94,项目名称:nupic,代码行数:32,代码来源:hello_tm.py

示例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)
开发者ID:Erichy94,项目名称:nupic,代码行数:8,代码来源:temporal_memory_test.py


注:本文中的nupic.algorithms.temporal_memory.TemporalMemory.numberOfColumns方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。