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


Python SpatialPooler.isActive方法代码示例

本文整理汇总了Python中nupic.research.spatial_pooler.SpatialPooler.isActive方法的典型用法代码示例。如果您正苦于以下问题:Python SpatialPooler.isActive方法的具体用法?Python SpatialPooler.isActive怎么用?Python SpatialPooler.isActive使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在nupic.research.spatial_pooler.SpatialPooler的用法示例。


在下文中一共展示了SpatialPooler.isActive方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: runSaveTest

# 需要导入模块: from nupic.research.spatial_pooler import SpatialPooler [as 别名]
# 或者: from nupic.research.spatial_pooler.SpatialPooler import isActive [as 别名]
def runSaveTest():
  inputSize = 600
  outputSize = 2048

  sp = SP(
    inputDimensions=(inputSize,),
    columnDimensions=(outputSize,),
    potentialRadius=16,
    potentialPct=0.85,
    globalInhibition=True,
    localAreaDensity=-1.0,
    numActiveColumnsPerInhArea=40.0,
    stimulusThreshold=1,
    synPermInactiveDec=0.008,
    synPermActiveInc=0.05,
    synPermConnected=0.10,
    minPctOverlapDutyCycle=0.001,
    minPctActiveDutyCycle=0.001,
    dutyCyclePeriod=1000,
    maxBoost=2.0,
    seed=-1,
    spVerbosity=0,
    wrapAround=True
  )
  # Totally nukes any SP History data that exists in Redis.
  spHistory.nuke()
  # Create a facade around the SP that saves history as it runs.
  sp = spHistory.create(sp)
  # If the SP Facade is "active" that means it has a life spatial pooler. If it
  # is not active, it cannot compute, only playback the history.
  assert sp.isActive()
  for _ in range(0, 10):
    encoding = np.zeros(shape=(inputSize,))
    for j, _ in enumerate(encoding):
      if random() < 0.1:
        encoding[j] = 1
    # For each compute cycle, save the SP state to Redis for playback later.
    sp.compute(encoding, learn=True, save=True)
  # This SP's history can be retrieved with an id.
  return sp.getId()
开发者ID:oxtopus,项目名称:nupic-history-server,代码行数:42,代码来源:test1.py


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