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


Python PyRegion.setParameter方法代码示例

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


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

示例1: setParameter

# 需要导入模块: from nupic.bindings.regions.PyRegion import PyRegion [as 别名]
# 或者: from nupic.bindings.regions.PyRegion.PyRegion import setParameter [as 别名]
  def setParameter(self, name, index, value):
    """
    Set the value of the parameter.

    @param name -- the name of the parameter to update, as defined
            by the Node Spec.
    @param value -- the value to which the parameter is to be set.
    """
    if name == "learningMode":
      self.learningMode = bool(int(value))
      self._epoch = 0
    elif name == "inferenceMode":
      self._epoch = 0
      if int(value) and not self.inferenceMode:
        self._finishLearning()
      self.inferenceMode = bool(int(value))
    elif name == "distanceNorm":
      self._knn.distanceNorm = value
    elif name == "distanceMethod":
      self._knn.distanceMethod = value
    elif name == "keepAllDistances":
      self.keepAllDistances = bool(value)
      if not self.keepAllDistances:
        # Discard all distances except the latest
        if self._protoScores is not None and self._protoScores.shape[0] > 1:
          self._protoScores = self._protoScores[-1,:]
        if self._protoScores is not None:
          self._protoScoreCount = 1
        else:
          self._protoScoreCount = 0
    elif name == "clVerbosity":
      self.verbosity = value
      self._knn.verbosity = value
    else:
      return PyRegion.setParameter(self, name, index, value)
开发者ID:6779660,项目名称:nupic,代码行数:37,代码来源:KNNClassifierRegion.py

示例2: setParameter

# 需要导入模块: from nupic.bindings.regions.PyRegion import PyRegion [as 别名]
# 或者: from nupic.bindings.regions.PyRegion.PyRegion import setParameter [as 别名]
 def setParameter(self, name, index, value):
   """
   Overrides :meth:`nupic.bindings.regions.PyRegion.PyRegion.setParameter`.
   """
   if name == "learningMode":
     self.learningMode = bool(int(value))
     self._epoch = 0
   elif name == "inferenceMode":
     self._epoch = 0
     if int(value) and not self.inferenceMode:
       self._finishLearning()
     self.inferenceMode = bool(int(value))
   elif name == "distanceNorm":
     self._knn.distanceNorm = value
   elif name == "distanceMethod":
     self._knn.distanceMethod = value
   elif name == "keepAllDistances":
     self.keepAllDistances = bool(value)
     if not self.keepAllDistances:
       # Discard all distances except the latest
       if self._protoScores is not None and self._protoScores.shape[0] > 1:
         self._protoScores = self._protoScores[-1,:]
       if self._protoScores is not None:
         self._protoScoreCount = 1
       else:
         self._protoScoreCount = 0
   elif name == "verbosity":
     self.verbosity = value
     self._knn.verbosity = value
   else:
     return PyRegion.setParameter(self, name, index, value)
开发者ID:vitaly-krugl,项目名称:nupic,代码行数:33,代码来源:knn_classifier_region.py

示例3: setParameter

# 需要导入模块: from nupic.bindings.regions.PyRegion import PyRegion [as 别名]
# 或者: from nupic.bindings.regions.PyRegion.PyRegion import setParameter [as 别名]
 def setParameter(self, name, index, value):
   """
   Overrides :meth:`nupic.bindings.regions.PyRegion.PyRegion.setParameter`.
   """
   if name == "learningMode":
     self.learningMode = bool(int(value))
   elif name == "inferenceMode":
     self.inferenceMode = bool(int(value))
   else:
     return PyRegion.setParameter(self, name, index, value)
开发者ID:Erichy94,项目名称:nupic,代码行数:12,代码来源:sdr_classifier_region.py

示例4: setParameter

# 需要导入模块: from nupic.bindings.regions.PyRegion import PyRegion [as 别名]
# 或者: from nupic.bindings.regions.PyRegion.PyRegion import setParameter [as 别名]
  def setParameter(self, name, index, value):
    """
    Set the value of the parameter.

    @param name -- the name of the parameter to update, as defined
            by the Node Spec.
    @param value -- the value to which the parameter is to be set.
    """
    if name == "learningMode":
      self.learningMode = bool(int(value))
    elif name == "inferenceMode":
      self.inferenceMode = bool(int(value))
    else:
      return PyRegion.setParameter(self, name, index, value)
开发者ID:Allen-smith,项目名称:nupic,代码行数:16,代码来源:CLAClassifierRegion.py

示例5: setParameter

# 需要导入模块: from nupic.bindings.regions.PyRegion import PyRegion [as 别名]
# 或者: from nupic.bindings.regions.PyRegion.PyRegion import setParameter [as 别名]
  def setParameter(self, name, index, value):
    """
    Set the value of the parameter.

    @param name -- the name of the parameter to update, as defined
            by the Node Spec.
    @param value -- the value to which the parameter is to be set.
    """
    if name == "trainRecords":
      # Ensure that the trainRecords can only be set to minimum of the ROWID in
      # the saved states
      if not (isinstance(value, float) or isinstance(value, int)):
        raise CLAModelInvalidArgument("Invalid argument type \'%s\'. threshold "
          "must be a number." % (type(value)))

      if len(self._recordsCache) > 0 and value < self._recordsCache[0].ROWID:
        raise CLAModelInvalidArgument("Invalid value. autoDetectWaitRecord "
          "value must be valid record within output stream. Current minimum "
          " ROWID in output stream is %d." % (self._recordsCache[0].ROWID))

      self.trainRecords = value
      # Remove any labels before the first cached record (wont be used anymore)
      self._deleteRangeFromKNN(0, self._recordsCache[0].ROWID)
      # Reclassify all states
      self.classifyStates()
    elif name == "anomalyThreshold":
      if not (isinstance(value, float) or isinstance(value, int)):
        raise CLAModelInvalidArgument("Invalid argument type \'%s\'. threshold "
          "must be a number." % (type(value)))
      self.anomalyThreshold = value
      self.classifyStates()
    elif name == "classificationMaxDist":
      if not (isinstance(value, float) or isinstance(value, int)):
        raise CLAModelInvalidArgument("Invalid argument type \'%s\'. "
          "classificationMaxDist must be a number." % (type(value)))
      self._classificationMaxDist = value
      self.classifyStates()
    elif name == "activeColumnCount":
      self._activeColumnCount = value
    else:
      return PyRegion.setParameter(self, name, index, value)
开发者ID:GYGit,项目名称:nupic,代码行数:43,代码来源:KNNAnomalyClassifierRegion.py


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