當前位置: 首頁>>代碼示例>>Python>>正文


Python KNNClassifierRegion.getParameter方法代碼示例

本文整理匯總了Python中KNNClassifierRegion.KNNClassifierRegion.getParameter方法的典型用法代碼示例。如果您正苦於以下問題:Python KNNClassifierRegion.getParameter方法的具體用法?Python KNNClassifierRegion.getParameter怎麽用?Python KNNClassifierRegion.getParameter使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在KNNClassifierRegion.KNNClassifierRegion的用法示例。


在下文中一共展示了KNNClassifierRegion.getParameter方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: KNNAnomalyClassifierRegion

# 需要導入模塊: from KNNClassifierRegion import KNNClassifierRegion [as 別名]
# 或者: from KNNClassifierRegion.KNNClassifierRegion import getParameter [as 別名]

#.........這裏部分代碼省略.........

    # Internal Region Values
    self._maxLabelOutputs = 16
    self._activeColumnCount = activeColumnCount
    self._prevPredictedColumns = numpy.array([])
    self._anomalyVectorLength = None
    self._classificationMaxDist = classificationMaxDist
    self._iteration = 0

    # Set to create deterministic classifier
    classifierArgs['SVDDimCount'] = None

    # Parameters
    self.trainRecords = trainRecords
    self.anomalyThreshold = anomalyThreshold
    self.cacheSize = cacheSize
    self.classificationVectorType = classificationVectorType

    self._knnclassifierArgs = classifierArgs
    self._knnclassifier = KNNClassifierRegion(**self._knnclassifierArgs)
    self.labelResults = []
    self.saved_categories = []
    self._recordsCache = []

    self._version = KNNAnomalyClassifierRegion.__VERSION__

    # anomaly
    self._anomaly = Anomaly()

  def initialize(self, dims, splitterMaps):
    assert tuple(dims) == (1,) * len(dims)


  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)


  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)):
開發者ID:pjpan,項目名稱:nupic,代碼行數:70,代碼來源:KNNAnomalyClassifierRegion.py


注:本文中的KNNClassifierRegion.KNNClassifierRegion.getParameter方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。