nupic.pynodes.KNNClassifierNode
index
python2.5/site-packages/nupic/pynodes/KNNClassifierNode.py

## @file
This file defines the k Nearest Neighbor classifier node.

 
Modules
       
nupic.algorithms.KNNClassifier
numpy

 
Classes
       
nupic.pynodes.PyNode.PyNode(__builtin__.object)
KNNClassifierNode

 
class KNNClassifierNode(nupic.pynodes.PyNode.PyNode)
    KNNClassifierNode implements the k Nearest Neighbor classification algorithm.
By default it will implement vanilla 1-nearest neighbor using the L2 (Euclidean)
distance norm.  There are options for using different norms as well as
various ways of sparsifying the input.
 
 
Method resolution order:
KNNClassifierNode
nupic.pynodes.PyNode.PyNode
__builtin__.object

Methods defined here:
__getstate__(self)
Get serializable state.
__init__(self, categoriesOut=None, bestPrototypeIndices=None, k=1, distanceNorm=2.0, distThreshold=0, doBinarization=False, inputThresh=0.5, useSparseMemory=True, sparseThreshold=0.0, relativeThreshold=False, numWinners=0, acceptanceProbability=1.0, seed=None, debugPrinting=False)
@param k -- the k in k-nearest neighbor
@param debugPrinting -- A boolean flag that determines whether or
      not the LinearClassifier will print detailed logging and debugging
      information to stdout.
__setstate__(self, state)
Set state from serialized state.
compute(self, nodeInfo, inputs, outputs)
Process one input sample.
This method is called by the runtime engine.
disableTap(self)
Disable writing of output tap files.
doInference(self, activeInput)
Explicitly run inference on a vector that is passed in and return the
category id. Useful for debugging.
enableTap(self, tapPath)
Begin writing output tap files.
 
@param tapPath -- base name of the output tap files to write.
finishLearning(self)
Does nothing. Kept here for API compatibility
getNodeSpec(self)
Return the NodeSpec for this PyNode.
getParameter(self, parameterName, nodeSet='')
Get the value of the parameter.
 
@param parameterName -- the name of the parameter to retrieve, as defined
        by the Node Spec.
handleLogInput(self, inputs)
Write inputs to output tap file.
handleLogOutput(self, output)
Write outputs to output tap file.
reset(self)
setParameter(self, parameterName, parameterValue, nodeSet='')
Set the value of the parameter.
 
@param parameterName -- the name of the parameter to update, as defined
        by the Node Spec.
@param parameterValue -- the value to which the parameter is to be set.

Data descriptors defined here:
activeOutputCount
categoryCount

Methods inherited from nupic.pynodes.PyNode.PyNode:
execute(self, nodeInfo, nodeSet, *args)
Internal method.
Routes 'execute' requests from NuPIC Tools to appropriate calls to
executeMethod(), getParameter(), setParameter() or executeCode().A
The arguments passed in must be in one of the following forms:
- 'getParameter', 'parameterName'
   Will be routed to a call to getParameter('parameterName')
   The return value will be serialized
   with nupic.bindings.network.SerializeValue() and returned as a string.
- 'setParameter', 'parameterName', 'parameterValue'
   Will be routed to a call to setParameter('parameterName', value),
   where the value is equivalent to the incoming parameter value string
   deserialized with nupic.support.compress.loads().
- 'methodName', 'arg1', 'arg2', ...
   If the first string matches the name of method of this PyNode,
   calls that method using executeMethod().
   The arguments will be first deserialized with
   nupic.support.compress.loads() and then passed to the method.
- 'code block 1', 'code block 2', ...
   Treats each string as a block of pure Python code to be interpreted
   in executeCode(). Responses will be serialized with
   nupic.bindings.network.SerializeValue().
executeCode(self, nodeInfo, code)
Internal method.
Interprets pure Python code passed in and executes it in the context
of this PyNode instance.
'self' and 'nodeInfo' are available variables that the code can refer to.
If the executed code sets a variable named 'response'
or a variable named 'output' (but not both), then the value of that
detected response variable will be returned. Otherwise, None will be
returned.
executeMethod(self, methodName, args)
Executes a method named 'methodName' with the specified arguments.
May be overridden to perform more complex behavior.
Enables compatibility with the Numenta Plugin Node API.
initInNetwork(self, nodeInfo)
Called after construction.
Parameter 'nodeInfo' contains information about the name and id number
associated with this node.

Data descriptors inherited from nupic.pynodes.PyNode.PyNode:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)

 
Data
        RealTypeName = 'NTA_Real'