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


Python PyRegion.getParameter方法代码示例

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


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

示例1: getParameter

# 需要导入模块: from PyRegion import PyRegion [as 别名]
# 或者: from PyRegion.PyRegion import getParameter [as 别名]
  def getParameter(self, parameterName, index=-1):
    """
      Get the value of a NodeSpec parameter. Most parameters are handled
      automatically by PyRegion's parameter get mechanism. The ones that need
      special treatment are explicitly handled here.
    """

    if parameterName == 'activeOutputCount':
      return self.columnCount
    elif parameterName == 'spatialPoolerInput':
      return list(self._spatialPoolerInput.reshape(-1))
    elif parameterName == 'spatialPoolerOutput':
      return list(self._spatialPoolerOutput)
    elif parameterName == 'spNumActiveOutputs':
      return len(self._spatialPoolerOutput.nonzero()[0])
    elif parameterName == 'spOutputNonZeros':
      return [len(self._spatialPoolerOutput)] + \
              list(self._spatialPoolerOutput.nonzero()[0])
    elif parameterName == 'spInputNonZeros':
      import pdb; pdb.set_trace()
      return [len(self._spatialPoolerInput)] + \
              list(self._spatialPoolerInput.nonzero()[0])
    elif parameterName == 'spLearningStatsStr':
      try:
        return str(self._sfdr.getLearningStats())
      except:
        return str(dict())
    else:
      return PyRegion.getParameter(self, parameterName, index)
开发者ID:NunoEdgarGub1,项目名称:nupic,代码行数:31,代码来源:SPRegion.py

示例2: getParameter

# 需要导入模块: from PyRegion import PyRegion [as 别名]
# 或者: from PyRegion.PyRegion import getParameter [as 别名]
  def getParameter(self, parameterName, index=-1):
    """
      Get the value of a NodeSpec parameter. Most parameters are handled
      automatically by PyRegion's parameter get mechanism. The ones that need
      special treatment are explicitly handled here.
    """

    if parameterName == 'sparseCoincidenceMatrix':
      if not self._sfdr:
        return None
      return self._sfdr.cm
    elif parameterName == 'activeOutputCount':
      return self.columnCount
    elif parameterName == 'spatialPoolerInput':
      return list(self._spatialPoolerInput.reshape(-1))
    elif parameterName == 'spatialPoolerOutput':
      return list(self._spatialPoolerOutput)
    elif parameterName == 'spNumActiveOutputs':
      return len(self._spatialPoolerOutput.nonzero()[0])
    elif parameterName == 'spOverlapDistribution':
      if not self._sfdr:
        return []
      # Get the dense output (will only work if you've done storeDenseOutput)
      try:
        denseOutput = self._sfdr.getDenseOutput()
        if len(denseOutput) == 0:
          raise Exception("storeDenseOutput wasn't set in PY version")
        denseOutput = numpy.array(denseOutput)
      except Exception:
        print "WARNING: You must enable storing dense output in the SP using" \
              "setStoreDenseOutput."
        return []
      winnerIndices = numpy.array(self._spatialPoolerOutput).nonzero()[0]
      overlaps = denseOutput[winnerIndices]

      # Sort descending and convert to list...
      overlaps = sorted(overlaps, reverse=True)

      return overlaps
    elif parameterName == "denseOutput":
      # Must be a list, not a numpy array to make NuPIC happy...
      denseOutput = self._sfdr.getDenseOutput()
      if not isinstance(denseOutput, list):
        assert isinstance(denseOutput, numpy.ndarray)
        denseOutput = list(denseOutput)
      return denseOutput
    elif parameterName == 'spOutputNonZeros':
      return [len(self._spatialPoolerOutput)] + \
              list(self._spatialPoolerOutput.nonzero()[0])
    elif parameterName == 'spInputNonZeros':
      import pdb; pdb.set_trace()
      return [len(self._spatialPoolerInput)] + \
              list(self._spatialPoolerInput.nonzero()[0])
    elif parameterName == 'spLearningStatsStr':
      try:
        return str(self._sfdr.getLearningStats())
      except:
        return str(dict())
    else:
      return PyRegion.getParameter(self, parameterName, index)
开发者ID:ashee,项目名称:nupic,代码行数:62,代码来源:SPRegion.py

示例3: getParameter

# 需要导入模块: from PyRegion import PyRegion [as 别名]
# 或者: from PyRegion.PyRegion import getParameter [as 别名]
  def getParameter(self, name, index=-1):
    """
    Get the value of the parameter.

    @param name -- the name of the parameter to retrieve, as defined
            by the Node Spec.
    """
    if name == "patternCount":
      return self._knn._numPatterns
    elif name == "patternMatrix":
      return self._getPatternMatrix()
    elif name == "k":
      return self._knn.k
    elif name == "distanceNorm":
      return self._knn.distanceNorm
    elif name == "distanceMethod":
      return self._knn.distanceMethod
    elif name == "distThreshold":
      return self._knn.distThreshold
    elif name == "inputThresh":
      return self._knn.binarizationThreshold
    elif name == "doBinarization":
      return self._knn.doBinarization
    elif name == "useSparseMemory":
      return self._knn.useSparseMemory
    elif name == "sparseThreshold":
      return self._knn.sparseThreshold
    elif name == "winnerCount":
      return self._knn.numWinners
    elif name == "relativeThreshold":
      return self._knn.relativeThreshold
    elif name == "SVDSampleCount":
      v = self._knn.numSVDSamples
      return v if v is not None else 0
    elif name == "SVDDimCount":
      v = self._knn.numSVDDims
      return v if v is not None else 0
    elif name == "fractionOfMax":
      v = self._knn.fractionOfMax
      return v if v is not None else 0
    elif name == "useAuxiliary":
      return self._useAuxiliary
    elif name == "justUseAuxiliary":
      return self._justUseAuxiliary
    elif name == "doSphering":
      return self._doSphering
    elif name == "cellsPerCol":
      return self._knn.cellsPerCol
    elif name == "maxStoredPatterns":
      return self.maxStoredPatterns
    elif name == 'categoryRecencyList':
      return self._knn._categoryRecencyList
    else:
      # If any spec parameter name is the same as an attribute, this call
      # will get it automatically, e.g. self.learningMode
      return PyRegion.getParameter(self, name, index)
开发者ID:08s011003,项目名称:nupic,代码行数:58,代码来源:KNNClassifierRegion.py

示例4: getParameter

# 需要导入模块: from PyRegion import PyRegion [as 别名]
# 或者: from PyRegion.PyRegion import getParameter [as 别名]
  def getParameter(self, name, index=-1):
    """
    Get the value of the parameter.

    @param name -- the name of the parameter to retrieve, as defined
            by the Node Spec.
    """
    # If any spec parameter name is the same as an attribute, this call
    # will get it automatically, e.g. self.learningMode
    return PyRegion.getParameter(self, name, index)
开发者ID:NunoEdgarGub1,项目名称:nupic,代码行数:12,代码来源:CLAClassifierRegion.py

示例5: getParameter

# 需要导入模块: from PyRegion import PyRegion [as 别名]
# 或者: from PyRegion.PyRegion import getParameter [as 别名]
  def getParameter(self, parameterName, index=-1):
    """
      Get the value of a parameter. Most parameters are handled automatically by
      PyRegion's parameter get mechanism. The ones that need special treatment
      are explicitly handled here.
    """

    if parameterName in self._temporalArgNames:
      return getattr(self._tfdr, parameterName)
    else:
      return PyRegion.getParameter(self, parameterName, index)
开发者ID:ARK1988,项目名称:nupic,代码行数:13,代码来源:TPRegion.py

示例6: getParameter

# 需要导入模块: from PyRegion import PyRegion [as 别名]
# 或者: from PyRegion.PyRegion import getParameter [as 别名]
  def getParameter(self, name, index=-1):
    """
    Get the value of the parameter.

    @param name -- the name of the parameter to retrieve, as defined
            by the Node Spec.
    """
    if name == "trainRecords":
      return self.trainRecords
    elif name == "anomalyThreshold":
      return self.anomalyThreshold
    elif name == "activeColumnCount":
      return self._activeColumnCount
    elif name == "classificationMaxDist":
      return self._classificationMaxDist
    else:
      # If any spec parameter name is the same as an attribute, this call
      # will get it automatically, e.g. self.learningMode
      return PyRegion.getParameter(self, name, index)
开发者ID:pjpan,项目名称:nupic,代码行数:21,代码来源:KNNAnomalyClassifierRegion.py

示例7: getParameter

# 需要导入模块: from PyRegion import PyRegion [as 别名]
# 或者: from PyRegion.PyRegion import getParameter [as 别名]
  def getParameter(self, name, index=-1):
    """
    Get the value of a parameter.

    Note: this method may be overridden by derived classes, but if so, then
    the derived class should invoke this base method if 'name'
    is unknown to the derived class.

    @param name -- the name of the parameter to retrieve, as defined
            by the Node Spec.
    """
    if name == "SVDSampleCount":
      return self._SVDSampleCount
    elif name == "SVDDimCount":
      return self._SVDDimCount
    elif name == "fractionOfMax":
      return self._fractionOfMax
    elif name == "trainingSampleCount":
      return self.gettrainingSampleCount()
    else:
      # If any spec parameter name is the same as an attribute, this call
      # will get it automatically, e.g. self.learningMode
      return PyRegion.getParameter(self, name, index)
开发者ID:AI-Cdrone,项目名称:nupic,代码行数:25,代码来源:PCANode.py


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