partition
stringclasses
3 values
func_name
stringlengths
1
134
docstring
stringlengths
1
46.9k
path
stringlengths
4
223
original_string
stringlengths
75
104k
code
stringlengths
75
104k
docstring_tokens
listlengths
1
1.97k
repo
stringlengths
7
55
language
stringclasses
1 value
url
stringlengths
87
315
code_tokens
listlengths
19
28.4k
sha
stringlengths
40
40
valid
Configuration.setCustomProperties
Set multiple custom properties and persist them to the custom configuration store. Parameters: ---------------------------------------------------------------- properties: a dict of property name/value pairs to set
src/nupic/swarming/hypersearch/support.py
def setCustomProperties(cls, properties): """ Set multiple custom properties and persist them to the custom configuration store. Parameters: ---------------------------------------------------------------- properties: a dict of property name/value pairs to set """ _getLogger().info("Setting...
def setCustomProperties(cls, properties): """ Set multiple custom properties and persist them to the custom configuration store. Parameters: ---------------------------------------------------------------- properties: a dict of property name/value pairs to set """ _getLogger().info("Setting...
[ "Set", "multiple", "custom", "properties", "and", "persist", "them", "to", "the", "custom", "configuration", "store", "." ]
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/swarming/hypersearch/support.py#L572-L586
[ "def", "setCustomProperties", "(", "cls", ",", "properties", ")", ":", "_getLogger", "(", ")", ".", "info", "(", "\"Setting custom configuration properties=%r; caller=%r\"", ",", "properties", ",", "traceback", ".", "format_stack", "(", ")", ")", "_CustomConfiguration...
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
Configuration.clear
Clear all configuration properties from in-memory cache, but do NOT alter the custom configuration file. Used in unit-testing.
src/nupic/swarming/hypersearch/support.py
def clear(cls): """ Clear all configuration properties from in-memory cache, but do NOT alter the custom configuration file. Used in unit-testing. """ # Clear the in-memory settings cache, forcing reload upon subsequent "get" # request. super(Configuration, cls).clear() # Reset in-memory cu...
def clear(cls): """ Clear all configuration properties from in-memory cache, but do NOT alter the custom configuration file. Used in unit-testing. """ # Clear the in-memory settings cache, forcing reload upon subsequent "get" # request. super(Configuration, cls).clear() # Reset in-memory cu...
[ "Clear", "all", "configuration", "properties", "from", "in", "-", "memory", "cache", "but", "do", "NOT", "alter", "the", "custom", "configuration", "file", ".", "Used", "in", "unit", "-", "testing", "." ]
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/swarming/hypersearch/support.py#L589-L598
[ "def", "clear", "(", "cls", ")", ":", "# Clear the in-memory settings cache, forcing reload upon subsequent \"get\"", "# request.", "super", "(", "Configuration", ",", "cls", ")", ".", "clear", "(", ")", "# Reset in-memory custom configuration info.", "_CustomConfigurationFileW...
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
Configuration.resetCustomConfig
Clear all custom configuration settings and delete the persistent custom configuration store.
src/nupic/swarming/hypersearch/support.py
def resetCustomConfig(cls): """ Clear all custom configuration settings and delete the persistent custom configuration store. """ _getLogger().info("Resetting all custom configuration properties; " "caller=%r", traceback.format_stack()) # Clear the in-memory settings cache, fo...
def resetCustomConfig(cls): """ Clear all custom configuration settings and delete the persistent custom configuration store. """ _getLogger().info("Resetting all custom configuration properties; " "caller=%r", traceback.format_stack()) # Clear the in-memory settings cache, fo...
[ "Clear", "all", "custom", "configuration", "settings", "and", "delete", "the", "persistent", "custom", "configuration", "store", "." ]
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/swarming/hypersearch/support.py#L601-L614
[ "def", "resetCustomConfig", "(", "cls", ")", ":", "_getLogger", "(", ")", ".", "info", "(", "\"Resetting all custom configuration properties; \"", "\"caller=%r\"", ",", "traceback", ".", "format_stack", "(", ")", ")", "# Clear the in-memory settings cache, forcing reload up...
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
_CustomConfigurationFileWrapper.clear
If persistent is True, delete the temporary file Parameters: ---------------------------------------------------------------- persistent: if True, custom configuration file is deleted
src/nupic/swarming/hypersearch/support.py
def clear(cls, persistent=False): """ If persistent is True, delete the temporary file Parameters: ---------------------------------------------------------------- persistent: if True, custom configuration file is deleted """ if persistent: try: os.unlink(cls.getPath()) exce...
def clear(cls, persistent=False): """ If persistent is True, delete the temporary file Parameters: ---------------------------------------------------------------- persistent: if True, custom configuration file is deleted """ if persistent: try: os.unlink(cls.getPath()) exce...
[ "If", "persistent", "is", "True", "delete", "the", "temporary", "file" ]
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/swarming/hypersearch/support.py#L656-L672
[ "def", "clear", "(", "cls", ",", "persistent", "=", "False", ")", ":", "if", "persistent", ":", "try", ":", "os", ".", "unlink", "(", "cls", ".", "getPath", "(", ")", ")", "except", "OSError", ",", "e", ":", "if", "e", ".", "errno", "!=", "errno"...
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
_CustomConfigurationFileWrapper.getCustomDict
Returns a dict of all temporary values in custom configuration file
src/nupic/swarming/hypersearch/support.py
def getCustomDict(cls): """ Returns a dict of all temporary values in custom configuration file """ if not os.path.exists(cls.getPath()): return dict() properties = Configuration._readConfigFile(os.path.basename( cls.getPath()), os.path.dirname(cls.getPath())) values = dict() for ...
def getCustomDict(cls): """ Returns a dict of all temporary values in custom configuration file """ if not os.path.exists(cls.getPath()): return dict() properties = Configuration._readConfigFile(os.path.basename( cls.getPath()), os.path.dirname(cls.getPath())) values = dict() for ...
[ "Returns", "a", "dict", "of", "all", "temporary", "values", "in", "custom", "configuration", "file" ]
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/swarming/hypersearch/support.py#L675-L690
[ "def", "getCustomDict", "(", "cls", ")", ":", "if", "not", "os", ".", "path", ".", "exists", "(", "cls", ".", "getPath", "(", ")", ")", ":", "return", "dict", "(", ")", "properties", "=", "Configuration", ".", "_readConfigFile", "(", "os", ".", "path...
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
_CustomConfigurationFileWrapper.edit
Edits the XML configuration file with the parameters specified by properties Parameters: ---------------------------------------------------------------- properties: dict of settings to be applied to the custom configuration store (key is property name, value is value)
src/nupic/swarming/hypersearch/support.py
def edit(cls, properties): """ Edits the XML configuration file with the parameters specified by properties Parameters: ---------------------------------------------------------------- properties: dict of settings to be applied to the custom configuration store (key is property nam...
def edit(cls, properties): """ Edits the XML configuration file with the parameters specified by properties Parameters: ---------------------------------------------------------------- properties: dict of settings to be applied to the custom configuration store (key is property nam...
[ "Edits", "the", "XML", "configuration", "file", "with", "the", "parameters", "specified", "by", "properties" ]
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/swarming/hypersearch/support.py#L693-L772
[ "def", "edit", "(", "cls", ",", "properties", ")", ":", "copyOfProperties", "=", "copy", "(", "properties", ")", "configFilePath", "=", "cls", ".", "getPath", "(", ")", "try", ":", "with", "open", "(", "configFilePath", ",", "'r'", ")", "as", "fp", ":"...
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
_CustomConfigurationFileWrapper._setPath
Sets the path of the custom configuration file
src/nupic/swarming/hypersearch/support.py
def _setPath(cls): """ Sets the path of the custom configuration file """ cls._path = os.path.join(os.environ['NTA_DYNAMIC_CONF_DIR'], cls.customFileName)
def _setPath(cls): """ Sets the path of the custom configuration file """ cls._path = os.path.join(os.environ['NTA_DYNAMIC_CONF_DIR'], cls.customFileName)
[ "Sets", "the", "path", "of", "the", "custom", "configuration", "file" ]
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/swarming/hypersearch/support.py#L775-L779
[ "def", "_setPath", "(", "cls", ")", ":", "cls", ".", "_path", "=", "os", ".", "path", ".", "join", "(", "os", ".", "environ", "[", "'NTA_DYNAMIC_CONF_DIR'", "]", ",", "cls", ".", "customFileName", ")" ]
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
Particle.getState
Get the particle state as a dict. This is enough information to instantiate this particle on another worker.
src/nupic/swarming/hypersearch/particle.py
def getState(self): """Get the particle state as a dict. This is enough information to instantiate this particle on another worker.""" varStates = dict() for varName, var in self.permuteVars.iteritems(): varStates[varName] = var.getState() return dict(id=self.particleId, genId...
def getState(self): """Get the particle state as a dict. This is enough information to instantiate this particle on another worker.""" varStates = dict() for varName, var in self.permuteVars.iteritems(): varStates[varName] = var.getState() return dict(id=self.particleId, genId...
[ "Get", "the", "particle", "state", "as", "a", "dict", ".", "This", "is", "enough", "information", "to", "instantiate", "this", "particle", "on", "another", "worker", "." ]
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/swarming/hypersearch/particle.py#L258-L268
[ "def", "getState", "(", "self", ")", ":", "varStates", "=", "dict", "(", ")", "for", "varName", ",", "var", "in", "self", ".", "permuteVars", ".", "iteritems", "(", ")", ":", "varStates", "[", "varName", "]", "=", "var", ".", "getState", "(", ")", ...
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
Particle.initStateFrom
Init all of our variable positions, velocities, and optionally the best result and best position from the given particle. If newBest is true, we get the best result and position for this new generation from the resultsDB, This is used when evoloving a particle because the bestResult and position as sto...
src/nupic/swarming/hypersearch/particle.py
def initStateFrom(self, particleId, particleState, newBest): """Init all of our variable positions, velocities, and optionally the best result and best position from the given particle. If newBest is true, we get the best result and position for this new generation from the resultsDB, This is used when...
def initStateFrom(self, particleId, particleState, newBest): """Init all of our variable positions, velocities, and optionally the best result and best position from the given particle. If newBest is true, we get the best result and position for this new generation from the resultsDB, This is used when...
[ "Init", "all", "of", "our", "variable", "positions", "velocities", "and", "optionally", "the", "best", "result", "and", "best", "position", "from", "the", "given", "particle", "." ]
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/swarming/hypersearch/particle.py#L270-L295
[ "def", "initStateFrom", "(", "self", ",", "particleId", ",", "particleState", ",", "newBest", ")", ":", "# Get the update best position and result?", "if", "newBest", ":", "(", "bestResult", ",", "bestPosition", ")", "=", "self", ".", "_resultsDB", ".", "getPartic...
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
Particle.copyVarStatesFrom
Copy specific variables from particleState into this particle. Parameters: -------------------------------------------------------------- particleState: dict produced by a particle's getState() method varNames: which variables to copy
src/nupic/swarming/hypersearch/particle.py
def copyVarStatesFrom(self, particleState, varNames): """Copy specific variables from particleState into this particle. Parameters: -------------------------------------------------------------- particleState: dict produced by a particle's getState() method varNames: which variab...
def copyVarStatesFrom(self, particleState, varNames): """Copy specific variables from particleState into this particle. Parameters: -------------------------------------------------------------- particleState: dict produced by a particle's getState() method varNames: which variab...
[ "Copy", "specific", "variables", "from", "particleState", "into", "this", "particle", "." ]
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/swarming/hypersearch/particle.py#L332-L366
[ "def", "copyVarStatesFrom", "(", "self", ",", "particleState", ",", "varNames", ")", ":", "# Set this to false if you don't want the variable to move anymore", "# after we set the state", "allowedToMove", "=", "True", "for", "varName", "in", "particleState", "[", "'varStates...
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
Particle.getPosition
Return the position of this particle. This returns a dict() of key value pairs where each key is the name of the flattened permutation variable and the value is its chosen value. Parameters: -------------------------------------------------------------- retval: dict() of flattened permutation c...
src/nupic/swarming/hypersearch/particle.py
def getPosition(self): """Return the position of this particle. This returns a dict() of key value pairs where each key is the name of the flattened permutation variable and the value is its chosen value. Parameters: -------------------------------------------------------------- retval: dic...
def getPosition(self): """Return the position of this particle. This returns a dict() of key value pairs where each key is the name of the flattened permutation variable and the value is its chosen value. Parameters: -------------------------------------------------------------- retval: dic...
[ "Return", "the", "position", "of", "this", "particle", ".", "This", "returns", "a", "dict", "()", "of", "key", "value", "pairs", "where", "each", "key", "is", "the", "name", "of", "the", "flattened", "permutation", "variable", "and", "the", "value", "is", ...
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/swarming/hypersearch/particle.py#L368-L381
[ "def", "getPosition", "(", "self", ")", ":", "result", "=", "dict", "(", ")", "for", "(", "varName", ",", "value", ")", "in", "self", ".", "permuteVars", ".", "iteritems", "(", ")", ":", "result", "[", "varName", "]", "=", "value", ".", "getPosition"...
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
Particle.getPositionFromState
Return the position of a particle given its state dict. Parameters: -------------------------------------------------------------- retval: dict() of particle position, keys are the variable names, values are their positions
src/nupic/swarming/hypersearch/particle.py
def getPositionFromState(pState): """Return the position of a particle given its state dict. Parameters: -------------------------------------------------------------- retval: dict() of particle position, keys are the variable names, values are their positions """ result =...
def getPositionFromState(pState): """Return the position of a particle given its state dict. Parameters: -------------------------------------------------------------- retval: dict() of particle position, keys are the variable names, values are their positions """ result =...
[ "Return", "the", "position", "of", "a", "particle", "given", "its", "state", "dict", "." ]
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/swarming/hypersearch/particle.py#L384-L396
[ "def", "getPositionFromState", "(", "pState", ")", ":", "result", "=", "dict", "(", ")", "for", "(", "varName", ",", "value", ")", "in", "pState", "[", "'varStates'", "]", ".", "iteritems", "(", ")", ":", "result", "[", "varName", "]", "=", "value", ...
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
Particle.agitate
Agitate this particle so that it is likely to go to a new position. Every time agitate is called, the particle is jiggled an even greater amount. Parameters: -------------------------------------------------------------- retval: None
src/nupic/swarming/hypersearch/particle.py
def agitate(self): """Agitate this particle so that it is likely to go to a new position. Every time agitate is called, the particle is jiggled an even greater amount. Parameters: -------------------------------------------------------------- retval: None """ for (varName,...
def agitate(self): """Agitate this particle so that it is likely to go to a new position. Every time agitate is called, the particle is jiggled an even greater amount. Parameters: -------------------------------------------------------------- retval: None """ for (varName,...
[ "Agitate", "this", "particle", "so", "that", "it", "is", "likely", "to", "go", "to", "a", "new", "position", ".", "Every", "time", "agitate", "is", "called", "the", "particle", "is", "jiggled", "an", "even", "greater", "amount", "." ]
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/swarming/hypersearch/particle.py#L398-L410
[ "def", "agitate", "(", "self", ")", ":", "for", "(", "varName", ",", "var", ")", "in", "self", ".", "permuteVars", ".", "iteritems", "(", ")", ":", "var", ".", "agitate", "(", ")", "self", ".", "newPosition", "(", ")" ]
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
Particle.newPosition
Choose a new position based on results obtained so far from all other particles. Parameters: -------------------------------------------------------------- whichVars: If not None, only move these variables retval: new position
src/nupic/swarming/hypersearch/particle.py
def newPosition(self, whichVars=None): # TODO: incorporate data from choice variables.... # TODO: make sure we're calling this when appropriate. """Choose a new position based on results obtained so far from all other particles. Parameters: ------------------------------------------------------...
def newPosition(self, whichVars=None): # TODO: incorporate data from choice variables.... # TODO: make sure we're calling this when appropriate. """Choose a new position based on results obtained so far from all other particles. Parameters: ------------------------------------------------------...
[ "Choose", "a", "new", "position", "based", "on", "results", "obtained", "so", "far", "from", "all", "other", "particles", "." ]
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/swarming/hypersearch/particle.py#L412-L465
[ "def", "newPosition", "(", "self", ",", "whichVars", "=", "None", ")", ":", "# TODO: incorporate data from choice variables....", "# TODO: make sure we're calling this when appropriate.", "# Get the global best position for this swarm generation", "globalBestPosition", "=", "None", "...
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
DiscreteProposal.propose
Generates a random sample from the discrete probability distribution and returns its value, the log of the probability of sampling that value and the log of the probability of sampling the current value (passed in).
src/nupic/math/proposal.py
def propose(self, current, r): """Generates a random sample from the discrete probability distribution and returns its value, the log of the probability of sampling that value and the log of the probability of sampling the current value (passed in). """ stay = (r.uniform(0, 1) < self.kernel) if ...
def propose(self, current, r): """Generates a random sample from the discrete probability distribution and returns its value, the log of the probability of sampling that value and the log of the probability of sampling the current value (passed in). """ stay = (r.uniform(0, 1) < self.kernel) if ...
[ "Generates", "a", "random", "sample", "from", "the", "discrete", "probability", "distribution", "and", "returns", "its", "value", "the", "log", "of", "the", "probability", "of", "sampling", "that", "value", "and", "the", "log", "of", "the", "probability", "of"...
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/math/proposal.py#L207-L222
[ "def", "propose", "(", "self", ",", "current", ",", "r", ")", ":", "stay", "=", "(", "r", ".", "uniform", "(", "0", ",", "1", ")", "<", "self", ".", "kernel", ")", "if", "stay", ":", "logKernel", "=", "numpy", ".", "log", "(", "self", ".", "k...
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
PoissonProposal.propose
Generates a random sample from the Poisson probability distribution with with location and scale parameter equal to the current value (passed in). Returns the value of the random sample, the log of the probability of sampling that value, and the log of the probability of sampling the current value if th...
src/nupic/math/proposal.py
def propose(self, current, r): """Generates a random sample from the Poisson probability distribution with with location and scale parameter equal to the current value (passed in). Returns the value of the random sample, the log of the probability of sampling that value, and the log of the probability o...
def propose(self, current, r): """Generates a random sample from the Poisson probability distribution with with location and scale parameter equal to the current value (passed in). Returns the value of the random sample, the log of the probability of sampling that value, and the log of the probability o...
[ "Generates", "a", "random", "sample", "from", "the", "Poisson", "probability", "distribution", "with", "with", "location", "and", "scale", "parameter", "equal", "to", "the", "current", "value", "(", "passed", "in", ")", ".", "Returns", "the", "value", "of", ...
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/math/proposal.py#L262-L273
[ "def", "propose", "(", "self", ",", "current", ",", "r", ")", ":", "curLambda", "=", "current", "+", "self", ".", "offset", "x", ",", "logProb", "=", "PoissonDistribution", "(", "curLambda", ")", ".", "sample", "(", "r", ")", "logBackward", "=", "Poiss...
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
ModelFactory.__getLogger
Get the logger for this object. :returns: (Logger) A Logger object.
src/nupic/frameworks/opf/model_factory.py
def __getLogger(cls): """ Get the logger for this object. :returns: (Logger) A Logger object. """ if cls.__logger is None: cls.__logger = opf_utils.initLogger(cls) return cls.__logger
def __getLogger(cls): """ Get the logger for this object. :returns: (Logger) A Logger object. """ if cls.__logger is None: cls.__logger = opf_utils.initLogger(cls) return cls.__logger
[ "Get", "the", "logger", "for", "this", "object", "." ]
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/frameworks/opf/model_factory.py#L46-L53
[ "def", "__getLogger", "(", "cls", ")", ":", "if", "cls", ".", "__logger", "is", "None", ":", "cls", ".", "__logger", "=", "opf_utils", ".", "initLogger", "(", "cls", ")", "return", "cls", ".", "__logger" ]
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
ModelFactory.create
Create a new model instance, given a description dictionary. :param modelConfig: (dict) A dictionary describing the current model, `described here <../../quick-start/example-model-params.html>`_. :param logLevel: (int) The level of logging output that should be generated :raises Exc...
src/nupic/frameworks/opf/model_factory.py
def create(modelConfig, logLevel=logging.ERROR): """ Create a new model instance, given a description dictionary. :param modelConfig: (dict) A dictionary describing the current model, `described here <../../quick-start/example-model-params.html>`_. :param logLevel: (int) The level of...
def create(modelConfig, logLevel=logging.ERROR): """ Create a new model instance, given a description dictionary. :param modelConfig: (dict) A dictionary describing the current model, `described here <../../quick-start/example-model-params.html>`_. :param logLevel: (int) The level of...
[ "Create", "a", "new", "model", "instance", "given", "a", "description", "dictionary", "." ]
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/frameworks/opf/model_factory.py#L57-L85
[ "def", "create", "(", "modelConfig", ",", "logLevel", "=", "logging", ".", "ERROR", ")", ":", "logger", "=", "ModelFactory", ".", "__getLogger", "(", ")", "logger", ".", "setLevel", "(", "logLevel", ")", "logger", ".", "debug", "(", "\"ModelFactory returning...
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
ModelFactory.loadFromCheckpoint
Load saved model. :param savedModelDir: (string) Directory of where the experiment is to be or was saved :returns: (:class:`nupic.frameworks.opf.model.Model`) The loaded model instance.
src/nupic/frameworks/opf/model_factory.py
def loadFromCheckpoint(savedModelDir, newSerialization=False): """ Load saved model. :param savedModelDir: (string) Directory of where the experiment is to be or was saved :returns: (:class:`nupic.frameworks.opf.model.Model`) The loaded model instance. """ if newSerializati...
def loadFromCheckpoint(savedModelDir, newSerialization=False): """ Load saved model. :param savedModelDir: (string) Directory of where the experiment is to be or was saved :returns: (:class:`nupic.frameworks.opf.model.Model`) The loaded model instance. """ if newSerializati...
[ "Load", "saved", "model", "." ]
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/frameworks/opf/model_factory.py#L88-L99
[ "def", "loadFromCheckpoint", "(", "savedModelDir", ",", "newSerialization", "=", "False", ")", ":", "if", "newSerialization", ":", "return", "HTMPredictionModel", ".", "readFromCheckpoint", "(", "savedModelDir", ")", "else", ":", "return", "Model", ".", "load", "(...
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
TemporalMemory.compute
Perform one time step of the Temporal Memory algorithm. This method calls :meth:`activateCells`, then calls :meth:`activateDendrites`. Using :class:`TemporalMemory` via its :meth:`compute` method ensures that you'll always be able to call :meth:`getPredictiveCells` to get predictions for the next ti...
src/nupic/algorithms/temporal_memory.py
def compute(self, activeColumns, learn=True): """ Perform one time step of the Temporal Memory algorithm. This method calls :meth:`activateCells`, then calls :meth:`activateDendrites`. Using :class:`TemporalMemory` via its :meth:`compute` method ensures that you'll always be able to call :me...
def compute(self, activeColumns, learn=True): """ Perform one time step of the Temporal Memory algorithm. This method calls :meth:`activateCells`, then calls :meth:`activateDendrites`. Using :class:`TemporalMemory` via its :meth:`compute` method ensures that you'll always be able to call :me...
[ "Perform", "one", "time", "step", "of", "the", "Temporal", "Memory", "algorithm", "." ]
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/algorithms/temporal_memory.py#L181-L195
[ "def", "compute", "(", "self", ",", "activeColumns", ",", "learn", "=", "True", ")", ":", "self", ".", "activateCells", "(", "sorted", "(", "activeColumns", ")", ",", "learn", ")", "self", ".", "activateDendrites", "(", "learn", ")" ]
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
TemporalMemory.activateCells
Calculate the active cells, using the current active columns and dendrite segments. Grow and reinforce synapses. :param activeColumns: (iter) A sorted list of active column indices. :param learn: (bool) If true, reinforce / punish / grow synapses. **Pseudocode:** :: for each c...
src/nupic/algorithms/temporal_memory.py
def activateCells(self, activeColumns, learn=True): """ Calculate the active cells, using the current active columns and dendrite segments. Grow and reinforce synapses. :param activeColumns: (iter) A sorted list of active column indices. :param learn: (bool) If true, reinforce / punish / grow syna...
def activateCells(self, activeColumns, learn=True): """ Calculate the active cells, using the current active columns and dendrite segments. Grow and reinforce synapses. :param activeColumns: (iter) A sorted list of active column indices. :param learn: (bool) If true, reinforce / punish / grow syna...
[ "Calculate", "the", "active", "cells", "using", "the", "current", "active", "columns", "and", "dendrite", "segments", ".", "Grow", "and", "reinforce", "synapses", "." ]
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/algorithms/temporal_memory.py#L198-L261
[ "def", "activateCells", "(", "self", ",", "activeColumns", ",", "learn", "=", "True", ")", ":", "prevActiveCells", "=", "self", ".", "activeCells", "prevWinnerCells", "=", "self", ".", "winnerCells", "self", ".", "activeCells", "=", "[", "]", "self", ".", ...
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
TemporalMemory.activateDendrites
Calculate dendrite segment activity, using the current active cells. :param learn: (bool) If true, segment activations will be recorded. This information is used during segment cleanup. **Pseudocode:** :: for each distal dendrite segment with activity >= activationThreshold ...
src/nupic/algorithms/temporal_memory.py
def activateDendrites(self, learn=True): """ Calculate dendrite segment activity, using the current active cells. :param learn: (bool) If true, segment activations will be recorded. This information is used during segment cleanup. **Pseudocode:** :: for each distal dendrite...
def activateDendrites(self, learn=True): """ Calculate dendrite segment activity, using the current active cells. :param learn: (bool) If true, segment activations will be recorded. This information is used during segment cleanup. **Pseudocode:** :: for each distal dendrite...
[ "Calculate", "dendrite", "segment", "activity", "using", "the", "current", "active", "cells", "." ]
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/algorithms/temporal_memory.py#L264-L307
[ "def", "activateDendrites", "(", "self", ",", "learn", "=", "True", ")", ":", "(", "numActiveConnected", ",", "numActivePotential", ")", "=", "self", ".", "connections", ".", "computeActivity", "(", "self", ".", "activeCells", ",", "self", ".", "connectedPerma...
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
TemporalMemory.reset
Indicates the start of a new sequence. Clears any predictions and makes sure synapses don't grow to the currently active cells in the next time step.
src/nupic/algorithms/temporal_memory.py
def reset(self): """ Indicates the start of a new sequence. Clears any predictions and makes sure synapses don't grow to the currently active cells in the next time step. """ self.activeCells = [] self.winnerCells = [] self.activeSegments = [] self.matchingSegments = []
def reset(self): """ Indicates the start of a new sequence. Clears any predictions and makes sure synapses don't grow to the currently active cells in the next time step. """ self.activeCells = [] self.winnerCells = [] self.activeSegments = [] self.matchingSegments = []
[ "Indicates", "the", "start", "of", "a", "new", "sequence", ".", "Clears", "any", "predictions", "and", "makes", "sure", "synapses", "don", "t", "grow", "to", "the", "currently", "active", "cells", "in", "the", "next", "time", "step", "." ]
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/algorithms/temporal_memory.py#L310-L318
[ "def", "reset", "(", "self", ")", ":", "self", ".", "activeCells", "=", "[", "]", "self", ".", "winnerCells", "=", "[", "]", "self", ".", "activeSegments", "=", "[", "]", "self", ".", "matchingSegments", "=", "[", "]" ]
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
TemporalMemory.activatePredictedColumn
Determines which cells in a predicted column should be added to winner cells list, and learns on the segments that correctly predicted this column. :param column: (int) Index of bursting column. :param columnActiveSegments: (iter) Active segments in this column. :param columnMatchingSegments: (iter) ...
src/nupic/algorithms/temporal_memory.py
def activatePredictedColumn(self, column, columnActiveSegments, columnMatchingSegments, prevActiveCells, prevWinnerCells, learn): """ Determines which cells in a predicted column should be added to winner cells list, and learns on the segments that...
def activatePredictedColumn(self, column, columnActiveSegments, columnMatchingSegments, prevActiveCells, prevWinnerCells, learn): """ Determines which cells in a predicted column should be added to winner cells list, and learns on the segments that...
[ "Determines", "which", "cells", "in", "a", "predicted", "column", "should", "be", "added", "to", "winner", "cells", "list", "and", "learns", "on", "the", "segments", "that", "correctly", "predicted", "this", "column", "." ]
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/algorithms/temporal_memory.py#L327-L355
[ "def", "activatePredictedColumn", "(", "self", ",", "column", ",", "columnActiveSegments", ",", "columnMatchingSegments", ",", "prevActiveCells", ",", "prevWinnerCells", ",", "learn", ")", ":", "return", "self", ".", "_activatePredictedColumn", "(", "self", ".", "co...
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
TemporalMemory.punishPredictedColumn
Punishes the Segments that incorrectly predicted a column to be active. :param column: (int) Index of bursting column. :param columnActiveSegments: (iter) Active segments for this column, or None if there aren't any. :param columnMatchingSegments: (iter) Matching segments for this column, or ...
src/nupic/algorithms/temporal_memory.py
def punishPredictedColumn(self, column, columnActiveSegments, columnMatchingSegments, prevActiveCells, prevWinnerCells): """ Punishes the Segments that incorrectly predicted a column to be active. :param column: (int) Index of bursting column. :p...
def punishPredictedColumn(self, column, columnActiveSegments, columnMatchingSegments, prevActiveCells, prevWinnerCells): """ Punishes the Segments that incorrectly predicted a column to be active. :param column: (int) Index of bursting column. :p...
[ "Punishes", "the", "Segments", "that", "incorrectly", "predicted", "a", "column", "to", "be", "active", "." ]
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/algorithms/temporal_memory.py#L391-L412
[ "def", "punishPredictedColumn", "(", "self", ",", "column", ",", "columnActiveSegments", ",", "columnMatchingSegments", ",", "prevActiveCells", ",", "prevWinnerCells", ")", ":", "self", ".", "_punishPredictedColumn", "(", "self", ".", "connections", ",", "columnMatchi...
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
TemporalMemory.createSegment
Create a :class:`~nupic.algorithms.connections.Segment` on the specified cell. This method calls :meth:`~nupic.algorithms.connections.Connections.createSegment` on the underlying :class:`~nupic.algorithms.connections.Connections`, and it does some extra bookkeeping. Unit tests should call this metho...
src/nupic/algorithms/temporal_memory.py
def createSegment(self, cell): """ Create a :class:`~nupic.algorithms.connections.Segment` on the specified cell. This method calls :meth:`~nupic.algorithms.connections.Connections.createSegment` on the underlying :class:`~nupic.algorithms.connections.Connections`, and it does some extra boo...
def createSegment(self, cell): """ Create a :class:`~nupic.algorithms.connections.Segment` on the specified cell. This method calls :meth:`~nupic.algorithms.connections.Connections.createSegment` on the underlying :class:`~nupic.algorithms.connections.Connections`, and it does some extra boo...
[ "Create", "a", ":", "class", ":", "~nupic", ".", "algorithms", ".", "connections", ".", "Segment", "on", "the", "specified", "cell", ".", "This", "method", "calls", ":", "meth", ":", "~nupic", ".", "algorithms", ".", "connections", ".", "Connections", ".",...
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/algorithms/temporal_memory.py#L415-L431
[ "def", "createSegment", "(", "self", ",", "cell", ")", ":", "return", "self", ".", "_createSegment", "(", "self", ".", "connections", ",", "self", ".", "lastUsedIterationForSegment", ",", "cell", ",", "self", ".", "iteration", ",", "self", ".", "maxSegmentsP...
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
TemporalMemory._activatePredictedColumn
:param connections: (Object) Connections for the TM. Gets mutated. :param random: (Object) Random number generator. Gets mutated. :param columnActiveSegments: (iter) Active segments in this column. :param prevActiveCells: (list) Active cells in `t-1`. :param prevWinnerCells: (list) ...
src/nupic/algorithms/temporal_memory.py
def _activatePredictedColumn(cls, connections, random, columnActiveSegments, prevActiveCells, prevWinnerCells, numActivePotentialSynapsesForSegment, maxNewSynapseCount, initialPermanence, permanen...
def _activatePredictedColumn(cls, connections, random, columnActiveSegments, prevActiveCells, prevWinnerCells, numActivePotentialSynapsesForSegment, maxNewSynapseCount, initialPermanence, permanen...
[ ":", "param", "connections", ":", "(", "Object", ")", "Connections", "for", "the", "TM", ".", "Gets", "mutated", "." ]
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/algorithms/temporal_memory.py#L448-L525
[ "def", "_activatePredictedColumn", "(", "cls", ",", "connections", ",", "random", ",", "columnActiveSegments", ",", "prevActiveCells", ",", "prevWinnerCells", ",", "numActivePotentialSynapsesForSegment", ",", "maxNewSynapseCount", ",", "initialPermanence", ",", "permanenceI...
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
TemporalMemory._burstColumn
:param connections: (Object) Connections for the TM. Gets mutated. :param random: (Object) Random number generator. Gets mutated. :param lastUsedIterationForSegment: (list) Last used iteration for each segment, indexed by the segment's flatIdx. Gets mutated. :param column: (int) Index...
src/nupic/algorithms/temporal_memory.py
def _burstColumn(cls, connections, random, lastUsedIterationForSegment, column, columnMatchingSegments, prevActiveCells, prevWinnerCells, cellsForColumn, numActivePotentialSynapsesForSegment, iteration, maxNewSynapseCount, initialPermanence, pe...
def _burstColumn(cls, connections, random, lastUsedIterationForSegment, column, columnMatchingSegments, prevActiveCells, prevWinnerCells, cellsForColumn, numActivePotentialSynapsesForSegment, iteration, maxNewSynapseCount, initialPermanence, pe...
[ ":", "param", "connections", ":", "(", "Object", ")", "Connections", "for", "the", "TM", ".", "Gets", "mutated", "." ]
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/algorithms/temporal_memory.py#L529-L635
[ "def", "_burstColumn", "(", "cls", ",", "connections", ",", "random", ",", "lastUsedIterationForSegment", ",", "column", ",", "columnMatchingSegments", ",", "prevActiveCells", ",", "prevWinnerCells", ",", "cellsForColumn", ",", "numActivePotentialSynapsesForSegment", ",",...
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
TemporalMemory._punishPredictedColumn
:param connections: (Object) Connections for the TM. Gets mutated. :param columnMatchingSegments: (iter) Matching segments for this column. :param prevActiveCells: (list) Active cells in `t-1`. :param predictedSegmentDecrement: (float) Amount by which segments are punished for incorrect p...
src/nupic/algorithms/temporal_memory.py
def _punishPredictedColumn(cls, connections, columnMatchingSegments, prevActiveCells, predictedSegmentDecrement): """ :param connections: (Object) Connections for the TM. Gets mutated. :param columnMatchingSegments: (iter) Matching segments for this column. :param ...
def _punishPredictedColumn(cls, connections, columnMatchingSegments, prevActiveCells, predictedSegmentDecrement): """ :param connections: (Object) Connections for the TM. Gets mutated. :param columnMatchingSegments: (iter) Matching segments for this column. :param ...
[ ":", "param", "connections", ":", "(", "Object", ")", "Connections", "for", "the", "TM", ".", "Gets", "mutated", "." ]
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/algorithms/temporal_memory.py#L639-L661
[ "def", "_punishPredictedColumn", "(", "cls", ",", "connections", ",", "columnMatchingSegments", ",", "prevActiveCells", ",", "predictedSegmentDecrement", ")", ":", "if", "predictedSegmentDecrement", ">", "0.0", "and", "columnMatchingSegments", "is", "not", "None", ":", ...
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
TemporalMemory._createSegment
Create a segment on the connections, enforcing the maxSegmentsPerCell parameter.
src/nupic/algorithms/temporal_memory.py
def _createSegment(cls, connections, lastUsedIterationForSegment, cell, iteration, maxSegmentsPerCell): """ Create a segment on the connections, enforcing the maxSegmentsPerCell parameter. """ # Enforce maxSegmentsPerCell. while connections.numSegments(cell) >= maxSegmentsPe...
def _createSegment(cls, connections, lastUsedIterationForSegment, cell, iteration, maxSegmentsPerCell): """ Create a segment on the connections, enforcing the maxSegmentsPerCell parameter. """ # Enforce maxSegmentsPerCell. while connections.numSegments(cell) >= maxSegmentsPe...
[ "Create", "a", "segment", "on", "the", "connections", "enforcing", "the", "maxSegmentsPerCell", "parameter", "." ]
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/algorithms/temporal_memory.py#L665-L692
[ "def", "_createSegment", "(", "cls", ",", "connections", ",", "lastUsedIterationForSegment", ",", "cell", ",", "iteration", ",", "maxSegmentsPerCell", ")", ":", "# Enforce maxSegmentsPerCell.", "while", "connections", ".", "numSegments", "(", "cell", ")", ">=", "max...
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
TemporalMemory._destroyMinPermanenceSynapses
Destroy nDestroy synapses on the specified segment, but don't destroy synapses to the "excludeCells".
src/nupic/algorithms/temporal_memory.py
def _destroyMinPermanenceSynapses(cls, connections, random, segment, nDestroy, excludeCells): """ Destroy nDestroy synapses on the specified segment, but don't destroy synapses to the "excludeCells". """ destroyCandidates = sorted( (synapse for synapse in c...
def _destroyMinPermanenceSynapses(cls, connections, random, segment, nDestroy, excludeCells): """ Destroy nDestroy synapses on the specified segment, but don't destroy synapses to the "excludeCells". """ destroyCandidates = sorted( (synapse for synapse in c...
[ "Destroy", "nDestroy", "synapses", "on", "the", "specified", "segment", "but", "don", "t", "destroy", "synapses", "to", "the", "excludeCells", "." ]
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/algorithms/temporal_memory.py#L696-L722
[ "def", "_destroyMinPermanenceSynapses", "(", "cls", ",", "connections", ",", "random", ",", "segment", ",", "nDestroy", ",", "excludeCells", ")", ":", "destroyCandidates", "=", "sorted", "(", "(", "synapse", "for", "synapse", "in", "connections", ".", "synapsesF...
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
TemporalMemory._leastUsedCell
Gets the cell with the smallest number of segments. Break ties randomly. :param random: (Object) Random number generator. Gets mutated. :param cells: (list) Indices of cells. :param connections: (Object) Connections instance for the TM. :returns: (int) Cell index.
src/nupic/algorithms/temporal_memory.py
def _leastUsedCell(cls, random, cells, connections): """ Gets the cell with the smallest number of segments. Break ties randomly. :param random: (Object) Random number generator. Gets mutated. :param cells: (list) Indices of cells. :param connections: (Object) Connections instance...
def _leastUsedCell(cls, random, cells, connections): """ Gets the cell with the smallest number of segments. Break ties randomly. :param random: (Object) Random number generator. Gets mutated. :param cells: (list) Indices of cells. :param connections: (Object) Connections instance...
[ "Gets", "the", "cell", "with", "the", "smallest", "number", "of", "segments", ".", "Break", "ties", "randomly", "." ]
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/algorithms/temporal_memory.py#L726-L755
[ "def", "_leastUsedCell", "(", "cls", ",", "random", ",", "cells", ",", "connections", ")", ":", "leastUsedCells", "=", "[", "]", "minNumSegments", "=", "float", "(", "\"inf\"", ")", "for", "cell", "in", "cells", ":", "numSegments", "=", "connections", ".",...
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
TemporalMemory._growSynapses
Creates nDesiredNewSynapes synapses on the segment passed in if possible, choosing random cells from the previous winner cells that are not already on the segment. :param connections: (Object) Connections instance for the tm :param random: (Object) TM object used to generate random ...
src/nupic/algorithms/temporal_memory.py
def _growSynapses(cls, connections, random, segment, nDesiredNewSynapes, prevWinnerCells, initialPermanence, maxSynapsesPerSegment): """ Creates nDesiredNewSynapes synapses on the segment passed in if possible, choosing random cells from the previous winner cells that are not already...
def _growSynapses(cls, connections, random, segment, nDesiredNewSynapes, prevWinnerCells, initialPermanence, maxSynapsesPerSegment): """ Creates nDesiredNewSynapes synapses on the segment passed in if possible, choosing random cells from the previous winner cells that are not already...
[ "Creates", "nDesiredNewSynapes", "synapses", "on", "the", "segment", "passed", "in", "if", "possible", "choosing", "random", "cells", "from", "the", "previous", "winner", "cells", "that", "are", "not", "already", "on", "the", "segment", "." ]
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/algorithms/temporal_memory.py#L759-L797
[ "def", "_growSynapses", "(", "cls", ",", "connections", ",", "random", ",", "segment", ",", "nDesiredNewSynapes", ",", "prevWinnerCells", ",", "initialPermanence", ",", "maxSynapsesPerSegment", ")", ":", "candidates", "=", "list", "(", "prevWinnerCells", ")", "for...
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
TemporalMemory._adaptSegment
Updates synapses on segment. Strengthens active synapses; weakens inactive synapses. :param connections: (Object) Connections instance for the tm :param segment: (int) Segment to adapt :param prevActiveCells: (list) Active cells in `t-1` :param permanenceIncrement: ...
src/nupic/algorithms/temporal_memory.py
def _adaptSegment(cls, connections, segment, prevActiveCells, permanenceIncrement, permanenceDecrement): """ Updates synapses on segment. Strengthens active synapses; weakens inactive synapses. :param connections: (Object) Connections instance for the tm :param segment:...
def _adaptSegment(cls, connections, segment, prevActiveCells, permanenceIncrement, permanenceDecrement): """ Updates synapses on segment. Strengthens active synapses; weakens inactive synapses. :param connections: (Object) Connections instance for the tm :param segment:...
[ "Updates", "synapses", "on", "segment", ".", "Strengthens", "active", "synapses", ";", "weakens", "inactive", "synapses", "." ]
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/algorithms/temporal_memory.py#L801-L837
[ "def", "_adaptSegment", "(", "cls", ",", "connections", ",", "segment", ",", "prevActiveCells", ",", "permanenceIncrement", ",", "permanenceDecrement", ")", ":", "# Destroying a synapse modifies the set that we're iterating through.", "synapsesToDestroy", "=", "[", "]", "fo...
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
TemporalMemory.columnForCell
Returns the index of the column that a cell belongs to. :param cell: (int) Cell index :returns: (int) Column index
src/nupic/algorithms/temporal_memory.py
def columnForCell(self, cell): """ Returns the index of the column that a cell belongs to. :param cell: (int) Cell index :returns: (int) Column index """ self._validateCell(cell) return int(cell / self.cellsPerColumn)
def columnForCell(self, cell): """ Returns the index of the column that a cell belongs to. :param cell: (int) Cell index :returns: (int) Column index """ self._validateCell(cell) return int(cell / self.cellsPerColumn)
[ "Returns", "the", "index", "of", "the", "column", "that", "a", "cell", "belongs", "to", "." ]
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/algorithms/temporal_memory.py#L840-L850
[ "def", "columnForCell", "(", "self", ",", "cell", ")", ":", "self", ".", "_validateCell", "(", "cell", ")", "return", "int", "(", "cell", "/", "self", ".", "cellsPerColumn", ")" ]
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
TemporalMemory.cellsForColumn
Returns the indices of cells that belong to a column. :param column: (int) Column index :returns: (list) Cell indices
src/nupic/algorithms/temporal_memory.py
def cellsForColumn(self, column): """ Returns the indices of cells that belong to a column. :param column: (int) Column index :returns: (list) Cell indices """ self._validateColumn(column) start = self.cellsPerColumn * column end = start + self.cellsPerColumn return range(start, e...
def cellsForColumn(self, column): """ Returns the indices of cells that belong to a column. :param column: (int) Column index :returns: (list) Cell indices """ self._validateColumn(column) start = self.cellsPerColumn * column end = start + self.cellsPerColumn return range(start, e...
[ "Returns", "the", "indices", "of", "cells", "that", "belong", "to", "a", "column", "." ]
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/algorithms/temporal_memory.py#L853-L865
[ "def", "cellsForColumn", "(", "self", ",", "column", ")", ":", "self", ".", "_validateColumn", "(", "column", ")", "start", "=", "self", ".", "cellsPerColumn", "*", "column", "end", "=", "start", "+", "self", ".", "cellsPerColumn", "return", "range", "(", ...
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
TemporalMemory.mapCellsToColumns
Maps cells to the columns they belong to. :param cells: (set) Cells :returns: (dict) Mapping from columns to their cells in `cells`
src/nupic/algorithms/temporal_memory.py
def mapCellsToColumns(self, cells): """ Maps cells to the columns they belong to. :param cells: (set) Cells :returns: (dict) Mapping from columns to their cells in `cells` """ cellsForColumns = defaultdict(set) for cell in cells: column = self.columnForCell(cell) cellsForColum...
def mapCellsToColumns(self, cells): """ Maps cells to the columns they belong to. :param cells: (set) Cells :returns: (dict) Mapping from columns to their cells in `cells` """ cellsForColumns = defaultdict(set) for cell in cells: column = self.columnForCell(cell) cellsForColum...
[ "Maps", "cells", "to", "the", "columns", "they", "belong", "to", "." ]
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/algorithms/temporal_memory.py#L886-L900
[ "def", "mapCellsToColumns", "(", "self", ",", "cells", ")", ":", "cellsForColumns", "=", "defaultdict", "(", "set", ")", "for", "cell", "in", "cells", ":", "column", "=", "self", ".", "columnForCell", "(", "cell", ")", "cellsForColumns", "[", "column", "]"...
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
TemporalMemory.getPredictiveCells
Returns the indices of the predictive cells. :returns: (list) Indices of predictive cells.
src/nupic/algorithms/temporal_memory.py
def getPredictiveCells(self): """ Returns the indices of the predictive cells. :returns: (list) Indices of predictive cells. """ previousCell = None predictiveCells = [] for segment in self.activeSegments: if segment.cell != previousCell: predictiveCells.append(segment.cell) ...
def getPredictiveCells(self): """ Returns the indices of the predictive cells. :returns: (list) Indices of predictive cells. """ previousCell = None predictiveCells = [] for segment in self.activeSegments: if segment.cell != previousCell: predictiveCells.append(segment.cell) ...
[ "Returns", "the", "indices", "of", "the", "predictive", "cells", "." ]
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/algorithms/temporal_memory.py#L912-L924
[ "def", "getPredictiveCells", "(", "self", ")", ":", "previousCell", "=", "None", "predictiveCells", "=", "[", "]", "for", "segment", "in", "self", ".", "activeSegments", ":", "if", "segment", ".", "cell", "!=", "previousCell", ":", "predictiveCells", ".", "a...
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
TemporalMemory.write
Writes serialized data to proto object. :param proto: (DynamicStructBuilder) Proto object
src/nupic/algorithms/temporal_memory.py
def write(self, proto): """ Writes serialized data to proto object. :param proto: (DynamicStructBuilder) Proto object """ # capnp fails to save a tuple. Let's force columnDimensions to list. proto.columnDimensions = list(self.columnDimensions) proto.cellsPerColumn = self.cellsPerColumn ...
def write(self, proto): """ Writes serialized data to proto object. :param proto: (DynamicStructBuilder) Proto object """ # capnp fails to save a tuple. Let's force columnDimensions to list. proto.columnDimensions = list(self.columnDimensions) proto.cellsPerColumn = self.cellsPerColumn ...
[ "Writes", "serialized", "data", "to", "proto", "object", "." ]
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/algorithms/temporal_memory.py#L1134-L1197
[ "def", "write", "(", "self", ",", "proto", ")", ":", "# capnp fails to save a tuple. Let's force columnDimensions to list.", "proto", ".", "columnDimensions", "=", "list", "(", "self", ".", "columnDimensions", ")", "proto", ".", "cellsPerColumn", "=", "self", ".", ...
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
TemporalMemory.read
Reads deserialized data from proto object. :param proto: (DynamicStructBuilder) Proto object :returns: (:class:TemporalMemory) TemporalMemory instance
src/nupic/algorithms/temporal_memory.py
def read(cls, proto): """ Reads deserialized data from proto object. :param proto: (DynamicStructBuilder) Proto object :returns: (:class:TemporalMemory) TemporalMemory instance """ tm = object.__new__(cls) # capnp fails to save a tuple, so proto.columnDimensions was forced to # serial...
def read(cls, proto): """ Reads deserialized data from proto object. :param proto: (DynamicStructBuilder) Proto object :returns: (:class:TemporalMemory) TemporalMemory instance """ tm = object.__new__(cls) # capnp fails to save a tuple, so proto.columnDimensions was forced to # serial...
[ "Reads", "deserialized", "data", "from", "proto", "object", "." ]
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/algorithms/temporal_memory.py#L1206-L1277
[ "def", "read", "(", "cls", ",", "proto", ")", ":", "tm", "=", "object", ".", "__new__", "(", "cls", ")", "# capnp fails to save a tuple, so proto.columnDimensions was forced to", "# serialize as a list. We prefer a tuple, however, because columnDimensions", "# should be regarded...
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
SequenceMachine.generateFromNumbers
Generate a sequence from a list of numbers. Note: Any `None` in the list of numbers is considered a reset. @param numbers (list) List of numbers @return (list) Generated sequence
src/nupic/data/generators/sequence_machine.py
def generateFromNumbers(self, numbers): """ Generate a sequence from a list of numbers. Note: Any `None` in the list of numbers is considered a reset. @param numbers (list) List of numbers @return (list) Generated sequence """ sequence = [] for number in numbers: if number == N...
def generateFromNumbers(self, numbers): """ Generate a sequence from a list of numbers. Note: Any `None` in the list of numbers is considered a reset. @param numbers (list) List of numbers @return (list) Generated sequence """ sequence = [] for number in numbers: if number == N...
[ "Generate", "a", "sequence", "from", "a", "list", "of", "numbers", "." ]
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/data/generators/sequence_machine.py#L50-L69
[ "def", "generateFromNumbers", "(", "self", ",", "numbers", ")", ":", "sequence", "=", "[", "]", "for", "number", "in", "numbers", ":", "if", "number", "==", "None", ":", "sequence", ".", "append", "(", "number", ")", "else", ":", "pattern", "=", "self"...
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
SequenceMachine.addSpatialNoise
Add spatial noise to each pattern in the sequence. @param sequence (list) Sequence @param amount (float) Amount of spatial noise @return (list) Sequence with spatial noise
src/nupic/data/generators/sequence_machine.py
def addSpatialNoise(self, sequence, amount): """ Add spatial noise to each pattern in the sequence. @param sequence (list) Sequence @param amount (float) Amount of spatial noise @return (list) Sequence with spatial noise """ newSequence = [] for pattern in sequence: if patter...
def addSpatialNoise(self, sequence, amount): """ Add spatial noise to each pattern in the sequence. @param sequence (list) Sequence @param amount (float) Amount of spatial noise @return (list) Sequence with spatial noise """ newSequence = [] for pattern in sequence: if patter...
[ "Add", "spatial", "noise", "to", "each", "pattern", "in", "the", "sequence", "." ]
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/data/generators/sequence_machine.py#L72-L88
[ "def", "addSpatialNoise", "(", "self", ",", "sequence", ",", "amount", ")", ":", "newSequence", "=", "[", "]", "for", "pattern", "in", "sequence", ":", "if", "pattern", "is", "not", "None", ":", "pattern", "=", "self", ".", "patternMachine", ".", "addNoi...
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
SequenceMachine.prettyPrintSequence
Pretty print a sequence. @param sequence (list) Sequence @param verbosity (int) Verbosity level @return (string) Pretty-printed text
src/nupic/data/generators/sequence_machine.py
def prettyPrintSequence(self, sequence, verbosity=1): """ Pretty print a sequence. @param sequence (list) Sequence @param verbosity (int) Verbosity level @return (string) Pretty-printed text """ text = "" for i in xrange(len(sequence)): pattern = sequence[i] if pattern ...
def prettyPrintSequence(self, sequence, verbosity=1): """ Pretty print a sequence. @param sequence (list) Sequence @param verbosity (int) Verbosity level @return (string) Pretty-printed text """ text = "" for i in xrange(len(sequence)): pattern = sequence[i] if pattern ...
[ "Pretty", "print", "a", "sequence", "." ]
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/data/generators/sequence_machine.py#L91-L113
[ "def", "prettyPrintSequence", "(", "self", ",", "sequence", ",", "verbosity", "=", "1", ")", ":", "text", "=", "\"\"", "for", "i", "in", "xrange", "(", "len", "(", "sequence", ")", ")", ":", "pattern", "=", "sequence", "[", "i", "]", "if", "pattern",...
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
ROCCurve
compute Receiver operating characteristic (ROC) Note: this implementation is restricted to the binary classification task. Parameters ---------- y_true : array, shape = [n_samples] true binary labels y_score : array, shape = [n_samples] target scores, can either be probability es...
src/nupic/math/roc_utils.py
def ROCCurve(y_true, y_score): """compute Receiver operating characteristic (ROC) Note: this implementation is restricted to the binary classification task. Parameters ---------- y_true : array, shape = [n_samples] true binary labels y_score : array, shape = [n_samples] targe...
def ROCCurve(y_true, y_score): """compute Receiver operating characteristic (ROC) Note: this implementation is restricted to the binary classification task. Parameters ---------- y_true : array, shape = [n_samples] true binary labels y_score : array, shape = [n_samples] targe...
[ "compute", "Receiver", "operating", "characteristic", "(", "ROC", ")" ]
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/math/roc_utils.py#L43-L136
[ "def", "ROCCurve", "(", "y_true", ",", "y_score", ")", ":", "y_true", "=", "np", ".", "ravel", "(", "y_true", ")", "classes", "=", "np", ".", "unique", "(", "y_true", ")", "# ROC only for binary classification", "if", "classes", ".", "shape", "[", "0", "...
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
AreaUnderCurve
Compute Area Under the Curve (AUC) using the trapezoidal rule Parameters ---------- x : array, shape = [n] x coordinates y : array, shape = [n] y coordinates Returns ------- auc : float Examples -------- >>> import numpy as np >>> from sklearn import metri...
src/nupic/math/roc_utils.py
def AreaUnderCurve(x, y): """Compute Area Under the Curve (AUC) using the trapezoidal rule Parameters ---------- x : array, shape = [n] x coordinates y : array, shape = [n] y coordinates Returns ------- auc : float Examples -------- >>> import numpy as np ...
def AreaUnderCurve(x, y): """Compute Area Under the Curve (AUC) using the trapezoidal rule Parameters ---------- x : array, shape = [n] x coordinates y : array, shape = [n] y coordinates Returns ------- auc : float Examples -------- >>> import numpy as np ...
[ "Compute", "Area", "Under", "the", "Curve", "(", "AUC", ")", "using", "the", "trapezoidal", "rule" ]
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/math/roc_utils.py#L140-L183
[ "def", "AreaUnderCurve", "(", "x", ",", "y", ")", ":", "#x, y = check_arrays(x, y)", "if", "x", ".", "shape", "[", "0", "]", "!=", "y", ".", "shape", "[", "0", "]", ":", "raise", "ValueError", "(", "'x and y should have the same shape'", "' to compute area und...
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
MonitorMixinBase.mmPrettyPrintTraces
Returns pretty-printed table of traces. @param traces (list) Traces to print in table @param breakOnResets (BoolsTrace) Trace of resets to break table on @return (string) Pretty-printed table of traces.
src/nupic/algorithms/monitor_mixin/monitor_mixin_base.py
def mmPrettyPrintTraces(traces, breakOnResets=None): """ Returns pretty-printed table of traces. @param traces (list) Traces to print in table @param breakOnResets (BoolsTrace) Trace of resets to break table on @return (string) Pretty-printed table of traces. """ assert len(traces) > 0, "N...
def mmPrettyPrintTraces(traces, breakOnResets=None): """ Returns pretty-printed table of traces. @param traces (list) Traces to print in table @param breakOnResets (BoolsTrace) Trace of resets to break table on @return (string) Pretty-printed table of traces. """ assert len(traces) > 0, "N...
[ "Returns", "pretty", "-", "printed", "table", "of", "traces", "." ]
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/algorithms/monitor_mixin/monitor_mixin_base.py#L124-L142
[ "def", "mmPrettyPrintTraces", "(", "traces", ",", "breakOnResets", "=", "None", ")", ":", "assert", "len", "(", "traces", ")", ">", "0", ",", "\"No traces found\"", "table", "=", "PrettyTable", "(", "[", "\"#\"", "]", "+", "[", "trace", ".", "prettyPrintTi...
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
MonitorMixinBase.mmPrettyPrintMetrics
Returns pretty-printed table of metrics. @param metrics (list) Traces to print in table @param sigFigs (int) Number of significant figures to print @return (string) Pretty-printed table of metrics.
src/nupic/algorithms/monitor_mixin/monitor_mixin_base.py
def mmPrettyPrintMetrics(metrics, sigFigs=5): """ Returns pretty-printed table of metrics. @param metrics (list) Traces to print in table @param sigFigs (int) Number of significant figures to print @return (string) Pretty-printed table of metrics. """ assert len(metrics) > 0, "No metrics ...
def mmPrettyPrintMetrics(metrics, sigFigs=5): """ Returns pretty-printed table of metrics. @param metrics (list) Traces to print in table @param sigFigs (int) Number of significant figures to print @return (string) Pretty-printed table of metrics. """ assert len(metrics) > 0, "No metrics ...
[ "Returns", "pretty", "-", "printed", "table", "of", "metrics", "." ]
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/algorithms/monitor_mixin/monitor_mixin_base.py#L146-L162
[ "def", "mmPrettyPrintMetrics", "(", "metrics", ",", "sigFigs", "=", "5", ")", ":", "assert", "len", "(", "metrics", ")", ">", "0", ",", "\"No metrics found\"", "table", "=", "PrettyTable", "(", "[", "\"Metric\"", ",", "\"mean\"", ",", "\"standard deviation\"",...
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
MonitorMixinBase.mmGetCellTracePlot
Returns plot of the cell activity. Note that if many timesteps of activities are input, matplotlib's image interpolation may omit activities (columns in the image). @param cellTrace (list) a temporally ordered list of sets of cell activities @param cellCount (i...
src/nupic/algorithms/monitor_mixin/monitor_mixin_base.py
def mmGetCellTracePlot(self, cellTrace, cellCount, activityType, title="", showReset=False, resetShading=0.25): """ Returns plot of the cell activity. Note that if many timesteps of activities are input, matplotlib's image interpolation may omit activities (columns in the image)...
def mmGetCellTracePlot(self, cellTrace, cellCount, activityType, title="", showReset=False, resetShading=0.25): """ Returns plot of the cell activity. Note that if many timesteps of activities are input, matplotlib's image interpolation may omit activities (columns in the image)...
[ "Returns", "plot", "of", "the", "cell", "activity", ".", "Note", "that", "if", "many", "timesteps", "of", "activities", "are", "input", "matplotlib", "s", "image", "interpolation", "may", "omit", "activities", "(", "columns", "in", "the", "image", ")", "." ]
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/algorithms/monitor_mixin/monitor_mixin_base.py#L187-L227
[ "def", "mmGetCellTracePlot", "(", "self", ",", "cellTrace", ",", "cellCount", ",", "activityType", ",", "title", "=", "\"\"", ",", "showReset", "=", "False", ",", "resetShading", "=", "0.25", ")", ":", "plot", "=", "Plot", "(", "self", ",", "title", ")",...
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
estimateAnomalyLikelihoods
Given a series of anomaly scores, compute the likelihood for each score. This function should be called once on a bunch of historical anomaly scores for an initial estimate of the distribution. It should be called again every so often (say every 50 records) to update the estimate. :param anomalyScores: a list ...
src/nupic/algorithms/anomaly_likelihood.py
def estimateAnomalyLikelihoods(anomalyScores, averagingWindow=10, skipRecords=0, verbosity=0): """ Given a series of anomaly scores, compute the likelihood for each score. This function should be called once on a bunch of...
def estimateAnomalyLikelihoods(anomalyScores, averagingWindow=10, skipRecords=0, verbosity=0): """ Given a series of anomaly scores, compute the likelihood for each score. This function should be called once on a bunch of...
[ "Given", "a", "series", "of", "anomaly", "scores", "compute", "the", "likelihood", "for", "each", "score", ".", "This", "function", "should", "be", "called", "once", "on", "a", "bunch", "of", "historical", "anomaly", "scores", "for", "an", "initial", "estima...
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/algorithms/anomaly_likelihood.py#L405-L517
[ "def", "estimateAnomalyLikelihoods", "(", "anomalyScores", ",", "averagingWindow", "=", "10", ",", "skipRecords", "=", "0", ",", "verbosity", "=", "0", ")", ":", "if", "verbosity", ">", "1", ":", "print", "(", "\"In estimateAnomalyLikelihoods.\"", ")", "print", ...
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
updateAnomalyLikelihoods
Compute updated probabilities for anomalyScores using the given params. :param anomalyScores: a list of records. Each record is a list with the following three elements: [timestamp, value, score] Example:: [datetime.datetime(2013, 8, 10, 2...
src/nupic/algorithms/anomaly_likelihood.py
def updateAnomalyLikelihoods(anomalyScores, params, verbosity=0): """ Compute updated probabilities for anomalyScores using the given params. :param anomalyScores: a list of records. Each record is a list with the following three e...
def updateAnomalyLikelihoods(anomalyScores, params, verbosity=0): """ Compute updated probabilities for anomalyScores using the given params. :param anomalyScores: a list of records. Each record is a list with the following three e...
[ "Compute", "updated", "probabilities", "for", "anomalyScores", "using", "the", "given", "params", "." ]
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/algorithms/anomaly_likelihood.py#L521-L610
[ "def", "updateAnomalyLikelihoods", "(", "anomalyScores", ",", "params", ",", "verbosity", "=", "0", ")", ":", "if", "verbosity", ">", "3", ":", "print", "(", "\"In updateAnomalyLikelihoods.\"", ")", "print", "(", "\"Number of anomaly scores:\"", ",", "len", "(", ...
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
_filterLikelihoods
Filter the list of raw (pre-filtered) likelihoods so that we only preserve sharp increases in likelihood. 'likelihoods' can be a numpy array of floats or a list of floats. :returns: A new list of floats likelihoods containing the filtered values.
src/nupic/algorithms/anomaly_likelihood.py
def _filterLikelihoods(likelihoods, redThreshold=0.99999, yellowThreshold=0.999): """ Filter the list of raw (pre-filtered) likelihoods so that we only preserve sharp increases in likelihood. 'likelihoods' can be a numpy array of floats or a list of floats. :returns: A new list of floa...
def _filterLikelihoods(likelihoods, redThreshold=0.99999, yellowThreshold=0.999): """ Filter the list of raw (pre-filtered) likelihoods so that we only preserve sharp increases in likelihood. 'likelihoods' can be a numpy array of floats or a list of floats. :returns: A new list of floa...
[ "Filter", "the", "list", "of", "raw", "(", "pre", "-", "filtered", ")", "likelihoods", "so", "that", "we", "only", "preserve", "sharp", "increases", "in", "likelihood", ".", "likelihoods", "can", "be", "a", "numpy", "array", "of", "floats", "or", "a", "l...
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/algorithms/anomaly_likelihood.py#L614-L644
[ "def", "_filterLikelihoods", "(", "likelihoods", ",", "redThreshold", "=", "0.99999", ",", "yellowThreshold", "=", "0.999", ")", ":", "redThreshold", "=", "1.0", "-", "redThreshold", "yellowThreshold", "=", "1.0", "-", "yellowThreshold", "# The first value is untouche...
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
_anomalyScoreMovingAverage
Given a list of anomaly scores return a list of averaged records. anomalyScores is assumed to be a list of records of the form: [datetime.datetime(2013, 8, 10, 23, 0), 6.0, 1.0] Each record in the returned list list contains: [datetime, value, averagedScore] *Note:* we only average the ano...
src/nupic/algorithms/anomaly_likelihood.py
def _anomalyScoreMovingAverage(anomalyScores, windowSize=10, verbosity=0, ): """ Given a list of anomaly scores return a list of averaged records. anomalyScores is assumed to be a list of records of the form: ...
def _anomalyScoreMovingAverage(anomalyScores, windowSize=10, verbosity=0, ): """ Given a list of anomaly scores return a list of averaged records. anomalyScores is assumed to be a list of records of the form: ...
[ "Given", "a", "list", "of", "anomaly", "scores", "return", "a", "list", "of", "averaged", "records", ".", "anomalyScores", "is", "assumed", "to", "be", "a", "list", "of", "records", "of", "the", "form", ":", "[", "datetime", ".", "datetime", "(", "2013",...
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/algorithms/anomaly_likelihood.py#L648-L684
[ "def", "_anomalyScoreMovingAverage", "(", "anomalyScores", ",", "windowSize", "=", "10", ",", "verbosity", "=", "0", ",", ")", ":", "historicalValues", "=", "[", "]", "total", "=", "0.0", "averagedRecordList", "=", "[", "]", "# Aggregated records", "for", "rec...
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
estimateNormal
:param sampleData: :type sampleData: Numpy array. :param performLowerBoundCheck: :type performLowerBoundCheck: bool :returns: A dict containing the parameters of a normal distribution based on the ``sampleData``.
src/nupic/algorithms/anomaly_likelihood.py
def estimateNormal(sampleData, performLowerBoundCheck=True): """ :param sampleData: :type sampleData: Numpy array. :param performLowerBoundCheck: :type performLowerBoundCheck: bool :returns: A dict containing the parameters of a normal distribution based on the ``sampleData``. """ params = { "...
def estimateNormal(sampleData, performLowerBoundCheck=True): """ :param sampleData: :type sampleData: Numpy array. :param performLowerBoundCheck: :type performLowerBoundCheck: bool :returns: A dict containing the parameters of a normal distribution based on the ``sampleData``. """ params = { "...
[ ":", "param", "sampleData", ":", ":", "type", "sampleData", ":", "Numpy", "array", ".", ":", "param", "performLowerBoundCheck", ":", ":", "type", "performLowerBoundCheck", ":", "bool", ":", "returns", ":", "A", "dict", "containing", "the", "parameters", "of", ...
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/algorithms/anomaly_likelihood.py#L688-L720
[ "def", "estimateNormal", "(", "sampleData", ",", "performLowerBoundCheck", "=", "True", ")", ":", "params", "=", "{", "\"name\"", ":", "\"normal\"", ",", "\"mean\"", ":", "numpy", ".", "mean", "(", "sampleData", ")", ",", "\"variance\"", ":", "numpy", ".", ...
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
tailProbability
Given the normal distribution specified by the mean and standard deviation in distributionParams, return the probability of getting samples further from the mean. For values above the mean, this is the probability of getting samples > x and for values below the mean, the probability of getting samples < x. This...
src/nupic/algorithms/anomaly_likelihood.py
def tailProbability(x, distributionParams): """ Given the normal distribution specified by the mean and standard deviation in distributionParams, return the probability of getting samples further from the mean. For values above the mean, this is the probability of getting samples > x and for values below the ...
def tailProbability(x, distributionParams): """ Given the normal distribution specified by the mean and standard deviation in distributionParams, return the probability of getting samples further from the mean. For values above the mean, this is the probability of getting samples > x and for values below the ...
[ "Given", "the", "normal", "distribution", "specified", "by", "the", "mean", "and", "standard", "deviation", "in", "distributionParams", "return", "the", "probability", "of", "getting", "samples", "further", "from", "the", "mean", ".", "For", "values", "above", "...
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/algorithms/anomaly_likelihood.py#L742-L763
[ "def", "tailProbability", "(", "x", ",", "distributionParams", ")", ":", "if", "\"mean\"", "not", "in", "distributionParams", "or", "\"stdev\"", "not", "in", "distributionParams", ":", "raise", "RuntimeError", "(", "\"Insufficient parameters to specify the distribution.\"...
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
isValidEstimatorParams
:returns: ``True`` if ``p`` is a valid estimator params as might be returned by ``estimateAnomalyLikelihoods()`` or ``updateAnomalyLikelihoods``, ``False`` otherwise. Just does some basic validation.
src/nupic/algorithms/anomaly_likelihood.py
def isValidEstimatorParams(p): """ :returns: ``True`` if ``p`` is a valid estimator params as might be returned by ``estimateAnomalyLikelihoods()`` or ``updateAnomalyLikelihoods``, ``False`` otherwise. Just does some basic validation. """ if not isinstance(p, dict): return False if "distribution"...
def isValidEstimatorParams(p): """ :returns: ``True`` if ``p`` is a valid estimator params as might be returned by ``estimateAnomalyLikelihoods()`` or ``updateAnomalyLikelihoods``, ``False`` otherwise. Just does some basic validation. """ if not isinstance(p, dict): return False if "distribution"...
[ ":", "returns", ":", "True", "if", "p", "is", "a", "valid", "estimator", "params", "as", "might", "be", "returned", "by", "estimateAnomalyLikelihoods", "()", "or", "updateAnomalyLikelihoods", "False", "otherwise", ".", "Just", "does", "some", "basic", "validatio...
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/algorithms/anomaly_likelihood.py#L767-L784
[ "def", "isValidEstimatorParams", "(", "p", ")", ":", "if", "not", "isinstance", "(", "p", ",", "dict", ")", ":", "return", "False", "if", "\"distribution\"", "not", "in", "p", ":", "return", "False", "if", "\"movingAverage\"", "not", "in", "p", ":", "ret...
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
AnomalyLikelihood._calcSkipRecords
Return the value of skipRecords for passing to estimateAnomalyLikelihoods If `windowSize` is very large (bigger than the amount of data) then this could just return `learningPeriod`. But when some values have fallen out of the historical sliding window of anomaly records, then we have to take those int...
src/nupic/algorithms/anomaly_likelihood.py
def _calcSkipRecords(numIngested, windowSize, learningPeriod): """Return the value of skipRecords for passing to estimateAnomalyLikelihoods If `windowSize` is very large (bigger than the amount of data) then this could just return `learningPeriod`. But when some values have fallen out of the historical...
def _calcSkipRecords(numIngested, windowSize, learningPeriod): """Return the value of skipRecords for passing to estimateAnomalyLikelihoods If `windowSize` is very large (bigger than the amount of data) then this could just return `learningPeriod`. But when some values have fallen out of the historical...
[ "Return", "the", "value", "of", "skipRecords", "for", "passing", "to", "estimateAnomalyLikelihoods" ]
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/algorithms/anomaly_likelihood.py#L241-L258
[ "def", "_calcSkipRecords", "(", "numIngested", ",", "windowSize", ",", "learningPeriod", ")", ":", "numShiftedOut", "=", "max", "(", "0", ",", "numIngested", "-", "windowSize", ")", "return", "min", "(", "numIngested", ",", "max", "(", "0", ",", "learningPer...
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
AnomalyLikelihood.read
capnp deserialization method for the anomaly likelihood object :param proto: (Object) capnp proto object specified in nupic.regions.anomaly_likelihood.capnp :returns: (Object) the deserialized AnomalyLikelihood object
src/nupic/algorithms/anomaly_likelihood.py
def read(cls, proto): """ capnp deserialization method for the anomaly likelihood object :param proto: (Object) capnp proto object specified in nupic.regions.anomaly_likelihood.capnp :returns: (Object) the deserialized AnomalyLikelihood object """ # pylint: disable=W0212 ...
def read(cls, proto): """ capnp deserialization method for the anomaly likelihood object :param proto: (Object) capnp proto object specified in nupic.regions.anomaly_likelihood.capnp :returns: (Object) the deserialized AnomalyLikelihood object """ # pylint: disable=W0212 ...
[ "capnp", "deserialization", "method", "for", "the", "anomaly", "likelihood", "object" ]
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/algorithms/anomaly_likelihood.py#L266-L309
[ "def", "read", "(", "cls", ",", "proto", ")", ":", "# pylint: disable=W0212", "anomalyLikelihood", "=", "object", ".", "__new__", "(", "cls", ")", "anomalyLikelihood", ".", "_iteration", "=", "proto", ".", "iteration", "anomalyLikelihood", ".", "_historicalScores"...
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
AnomalyLikelihood.write
capnp serialization method for the anomaly likelihood object :param proto: (Object) capnp proto object specified in nupic.regions.anomaly_likelihood.capnp
src/nupic/algorithms/anomaly_likelihood.py
def write(self, proto): """ capnp serialization method for the anomaly likelihood object :param proto: (Object) capnp proto object specified in nupic.regions.anomaly_likelihood.capnp """ proto.iteration = self._iteration pHistScores = proto.init('historicalScores', len(s...
def write(self, proto): """ capnp serialization method for the anomaly likelihood object :param proto: (Object) capnp proto object specified in nupic.regions.anomaly_likelihood.capnp """ proto.iteration = self._iteration pHistScores = proto.init('historicalScores', len(s...
[ "capnp", "serialization", "method", "for", "the", "anomaly", "likelihood", "object" ]
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/algorithms/anomaly_likelihood.py#L312-L354
[ "def", "write", "(", "self", ",", "proto", ")", ":", "proto", ".", "iteration", "=", "self", ".", "_iteration", "pHistScores", "=", "proto", ".", "init", "(", "'historicalScores'", ",", "len", "(", "self", ".", "_historicalScores", ")", ")", "for", "i", ...
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
AnomalyLikelihood.anomalyProbability
Compute the probability that the current value plus anomaly score represents an anomaly given the historical distribution of anomaly scores. The closer the number is to 1, the higher the chance it is an anomaly. :param value: the current metric ("raw") input value, eg. "orange", or '21.2...
src/nupic/algorithms/anomaly_likelihood.py
def anomalyProbability(self, value, anomalyScore, timestamp=None): """ Compute the probability that the current value plus anomaly score represents an anomaly given the historical distribution of anomaly scores. The closer the number is to 1, the higher the chance it is an anomaly. :param value: th...
def anomalyProbability(self, value, anomalyScore, timestamp=None): """ Compute the probability that the current value plus anomaly score represents an anomaly given the historical distribution of anomaly scores. The closer the number is to 1, the higher the chance it is an anomaly. :param value: th...
[ "Compute", "the", "probability", "that", "the", "current", "value", "plus", "anomaly", "score", "represents", "an", "anomaly", "given", "the", "historical", "distribution", "of", "anomaly", "scores", ".", "The", "closer", "the", "number", "is", "to", "1", "the...
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/algorithms/anomaly_likelihood.py#L357-L401
[ "def", "anomalyProbability", "(", "self", ",", "value", ",", "anomalyScore", ",", "timestamp", "=", "None", ")", ":", "if", "timestamp", "is", "None", ":", "timestamp", "=", "self", ".", "_iteration", "dataPoint", "=", "(", "timestamp", ",", "value", ",", ...
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
IterationPhaseSpecLearnOnly._getImpl
Creates and returns the _IterationPhase-based instance corresponding to this phase specification model: Model instance
src/nupic/frameworks/opf/opf_task_driver.py
def _getImpl(self, model): """ Creates and returns the _IterationPhase-based instance corresponding to this phase specification model: Model instance """ impl = _IterationPhaseLearnOnly(model=model, nIters=self.__nIters) return impl
def _getImpl(self, model): """ Creates and returns the _IterationPhase-based instance corresponding to this phase specification model: Model instance """ impl = _IterationPhaseLearnOnly(model=model, nIters=self.__nIters) return impl
[ "Creates", "and", "returns", "the", "_IterationPhase", "-", "based", "instance", "corresponding", "to", "this", "phase", "specification" ]
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/frameworks/opf/opf_task_driver.py#L85-L93
[ "def", "_getImpl", "(", "self", ",", "model", ")", ":", "impl", "=", "_IterationPhaseLearnOnly", "(", "model", "=", "model", ",", "nIters", "=", "self", ".", "__nIters", ")", "return", "impl" ]
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
IterationPhaseSpecInferOnly._getImpl
Creates and returns the _IterationPhase-based instance corresponding to this phase specification model: Model instance
src/nupic/frameworks/opf/opf_task_driver.py
def _getImpl(self, model): """ Creates and returns the _IterationPhase-based instance corresponding to this phase specification model: Model instance """ impl = _IterationPhaseInferOnly(model=model, nIters=self.__nIters, ...
def _getImpl(self, model): """ Creates and returns the _IterationPhase-based instance corresponding to this phase specification model: Model instance """ impl = _IterationPhaseInferOnly(model=model, nIters=self.__nIters, ...
[ "Creates", "and", "returns", "the", "_IterationPhase", "-", "based", "instance", "corresponding", "to", "this", "phase", "specification" ]
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/frameworks/opf/opf_task_driver.py#L120-L129
[ "def", "_getImpl", "(", "self", ",", "model", ")", ":", "impl", "=", "_IterationPhaseInferOnly", "(", "model", "=", "model", ",", "nIters", "=", "self", ".", "__nIters", ",", "inferenceArgs", "=", "self", ".", "__inferenceArgs", ")", "return", "impl" ]
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
OPFTaskDriver.replaceIterationCycle
Replaces the Iteration Cycle phases :param phaseSpecs: Iteration cycle description consisting of a sequence of IterationPhaseSpecXXXXX elements that are performed in the given order
src/nupic/frameworks/opf/opf_task_driver.py
def replaceIterationCycle(self, phaseSpecs): """ Replaces the Iteration Cycle phases :param phaseSpecs: Iteration cycle description consisting of a sequence of IterationPhaseSpecXXXXX elements that are performed in the given order """ # -----------------------------...
def replaceIterationCycle(self, phaseSpecs): """ Replaces the Iteration Cycle phases :param phaseSpecs: Iteration cycle description consisting of a sequence of IterationPhaseSpecXXXXX elements that are performed in the given order """ # -----------------------------...
[ "Replaces", "the", "Iteration", "Cycle", "phases" ]
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/frameworks/opf/opf_task_driver.py#L247-L262
[ "def", "replaceIterationCycle", "(", "self", ",", "phaseSpecs", ")", ":", "# -----------------------------------------------------------------------", "# Replace our phase manager", "#", "self", ".", "__phaseManager", "=", "_PhaseManager", "(", "model", "=", "self", ".", "_...
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
OPFTaskDriver.handleInputRecord
Processes the given record according to the current iteration cycle phase :param inputRecord: (object) record expected to be returned from :meth:`nupic.data.record_stream.RecordStreamIface.getNextRecord`. :returns: :class:`nupic.frameworks.opf.opf_utils.ModelResult`
src/nupic/frameworks/opf/opf_task_driver.py
def handleInputRecord(self, inputRecord): """ Processes the given record according to the current iteration cycle phase :param inputRecord: (object) record expected to be returned from :meth:`nupic.data.record_stream.RecordStreamIface.getNextRecord`. :returns: :class:`nupic.frameworks.opf.o...
def handleInputRecord(self, inputRecord): """ Processes the given record according to the current iteration cycle phase :param inputRecord: (object) record expected to be returned from :meth:`nupic.data.record_stream.RecordStreamIface.getNextRecord`. :returns: :class:`nupic.frameworks.opf.o...
[ "Processes", "the", "given", "record", "according", "to", "the", "current", "iteration", "cycle", "phase" ]
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/frameworks/opf/opf_task_driver.py#L288-L309
[ "def", "handleInputRecord", "(", "self", ",", "inputRecord", ")", ":", "assert", "inputRecord", ",", "\"Invalid inputRecord: %r\"", "%", "inputRecord", "results", "=", "self", ".", "__phaseManager", ".", "handleInputRecord", "(", "inputRecord", ")", "metrics", "=", ...
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
_PhaseManager.__advancePhase
Advance to the next iteration cycle phase
src/nupic/frameworks/opf/opf_task_driver.py
def __advancePhase(self): """ Advance to the next iteration cycle phase """ self.__currentPhase = self.__phaseCycler.next() self.__currentPhase.enterPhase() return
def __advancePhase(self): """ Advance to the next iteration cycle phase """ self.__currentPhase = self.__phaseCycler.next() self.__currentPhase.enterPhase() return
[ "Advance", "to", "the", "next", "iteration", "cycle", "phase" ]
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/frameworks/opf/opf_task_driver.py#L363-L369
[ "def", "__advancePhase", "(", "self", ")", ":", "self", ".", "__currentPhase", "=", "self", ".", "__phaseCycler", ".", "next", "(", ")", "self", ".", "__currentPhase", ".", "enterPhase", "(", ")", "return" ]
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
_PhaseManager.handleInputRecord
Processes the given record according to the current phase inputRecord: record object formatted according to nupic.data.FileSource.getNext() result format. Returns: An opf_utils.ModelResult object with the inputs and inferences after the current record is processed by ...
src/nupic/frameworks/opf/opf_task_driver.py
def handleInputRecord(self, inputRecord): """ Processes the given record according to the current phase inputRecord: record object formatted according to nupic.data.FileSource.getNext() result format. Returns: An opf_utils.ModelResult object with the inputs and inferences ...
def handleInputRecord(self, inputRecord): """ Processes the given record according to the current phase inputRecord: record object formatted according to nupic.data.FileSource.getNext() result format. Returns: An opf_utils.ModelResult object with the inputs and inferences ...
[ "Processes", "the", "given", "record", "according", "to", "the", "current", "phase" ]
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/frameworks/opf/opf_task_driver.py#L372-L388
[ "def", "handleInputRecord", "(", "self", ",", "inputRecord", ")", ":", "results", "=", "self", ".", "__model", ".", "run", "(", "inputRecord", ")", "shouldContinue", "=", "self", ".", "__currentPhase", ".", "advance", "(", ")", "if", "not", "shouldContinue",...
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
_IterationPhase.enterPhase
Performs initialization that is necessary upon entry to the phase. Must be called before handleInputRecord() at the beginning of each phase
src/nupic/frameworks/opf/opf_task_driver.py
def enterPhase(self): """ Performs initialization that is necessary upon entry to the phase. Must be called before handleInputRecord() at the beginning of each phase """ self.__iter = iter(xrange(self.__nIters)) # Prime the iterator self.__iter.next()
def enterPhase(self): """ Performs initialization that is necessary upon entry to the phase. Must be called before handleInputRecord() at the beginning of each phase """ self.__iter = iter(xrange(self.__nIters)) # Prime the iterator self.__iter.next()
[ "Performs", "initialization", "that", "is", "necessary", "upon", "entry", "to", "the", "phase", ".", "Must", "be", "called", "before", "handleInputRecord", "()", "at", "the", "beginning", "of", "each", "phase" ]
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/frameworks/opf/opf_task_driver.py#L416-L425
[ "def", "enterPhase", "(", "self", ")", ":", "self", ".", "__iter", "=", "iter", "(", "xrange", "(", "self", ".", "__nIters", ")", ")", "# Prime the iterator", "self", ".", "__iter", ".", "next", "(", ")" ]
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
_IterationPhase.advance
Advances the iteration; Returns: True if more iterations remain; False if this is the final iteration.
src/nupic/frameworks/opf/opf_task_driver.py
def advance(self): """ Advances the iteration; Returns: True if more iterations remain; False if this is the final iteration. """ hasMore = True try: self.__iter.next() except StopIteration: self.__iter = None hasMore = False return hasMore
def advance(self): """ Advances the iteration; Returns: True if more iterations remain; False if this is the final iteration. """ hasMore = True try: self.__iter.next() except StopIteration: self.__iter = None hasMore = False return hasMore
[ "Advances", "the", "iteration", ";" ]
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/frameworks/opf/opf_task_driver.py#L428-L441
[ "def", "advance", "(", "self", ")", ":", "hasMore", "=", "True", "try", ":", "self", ".", "__iter", ".", "next", "(", ")", "except", "StopIteration", ":", "self", ".", "__iter", "=", "None", "hasMore", "=", "False", "return", "hasMore" ]
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
_IterationPhaseLearnOnly.enterPhase
[_IterationPhase method implementation] Performs initialization that is necessary upon entry to the phase. Must be called before handleInputRecord() at the beginning of each phase
src/nupic/frameworks/opf/opf_task_driver.py
def enterPhase(self): """ [_IterationPhase method implementation] Performs initialization that is necessary upon entry to the phase. Must be called before handleInputRecord() at the beginning of each phase """ super(_IterationPhaseLearnOnly, self).enterPhase() self.__model.enableLearning() s...
def enterPhase(self): """ [_IterationPhase method implementation] Performs initialization that is necessary upon entry to the phase. Must be called before handleInputRecord() at the beginning of each phase """ super(_IterationPhaseLearnOnly, self).enterPhase() self.__model.enableLearning() s...
[ "[", "_IterationPhase", "method", "implementation", "]", "Performs", "initialization", "that", "is", "necessary", "upon", "entry", "to", "the", "phase", ".", "Must", "be", "called", "before", "handleInputRecord", "()", "at", "the", "beginning", "of", "each", "ph...
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/frameworks/opf/opf_task_driver.py#L459-L467
[ "def", "enterPhase", "(", "self", ")", ":", "super", "(", "_IterationPhaseLearnOnly", ",", "self", ")", ".", "enterPhase", "(", ")", "self", ".", "__model", ".", "enableLearning", "(", ")", "self", ".", "__model", ".", "disableInference", "(", ")", "return...
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
_IterationPhaseInferCommon.enterPhase
[_IterationPhase method implementation] Performs initialization that is necessary upon entry to the phase. Must be called before handleInputRecord() at the beginning of each phase
src/nupic/frameworks/opf/opf_task_driver.py
def enterPhase(self): """ [_IterationPhase method implementation] Performs initialization that is necessary upon entry to the phase. Must be called before handleInputRecord() at the beginning of each phase """ super(_IterationPhaseInferCommon, self).enterPhase() self._model.enableInference(infer...
def enterPhase(self): """ [_IterationPhase method implementation] Performs initialization that is necessary upon entry to the phase. Must be called before handleInputRecord() at the beginning of each phase """ super(_IterationPhaseInferCommon, self).enterPhase() self._model.enableInference(infer...
[ "[", "_IterationPhase", "method", "implementation", "]", "Performs", "initialization", "that", "is", "necessary", "upon", "entry", "to", "the", "phase", ".", "Must", "be", "called", "before", "handleInputRecord", "()", "at", "the", "beginning", "of", "each", "ph...
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/frameworks/opf/opf_task_driver.py#L489-L496
[ "def", "enterPhase", "(", "self", ")", ":", "super", "(", "_IterationPhaseInferCommon", ",", "self", ")", ".", "enterPhase", "(", ")", "self", ".", "_model", ".", "enableInference", "(", "inferenceArgs", "=", "self", ".", "_inferenceArgs", ")", "return" ]
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
PreviousValueModel.write
Serialize via capnp :param proto: capnp PreviousValueModelProto message builder
src/nupic/frameworks/opf/previous_value_model.py
def write(self, proto): """ Serialize via capnp :param proto: capnp PreviousValueModelProto message builder """ super(PreviousValueModel, self).writeBaseToProto(proto.modelBase) proto.fieldNames = self._fieldNames proto.fieldTypes = self._fieldTypes if self._predictedField: proto.pre...
def write(self, proto): """ Serialize via capnp :param proto: capnp PreviousValueModelProto message builder """ super(PreviousValueModel, self).writeBaseToProto(proto.modelBase) proto.fieldNames = self._fieldNames proto.fieldTypes = self._fieldTypes if self._predictedField: proto.pre...
[ "Serialize", "via", "capnp" ]
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/frameworks/opf/previous_value_model.py#L138-L149
[ "def", "write", "(", "self", ",", "proto", ")", ":", "super", "(", "PreviousValueModel", ",", "self", ")", ".", "writeBaseToProto", "(", "proto", ".", "modelBase", ")", "proto", ".", "fieldNames", "=", "self", ".", "_fieldNames", "proto", ".", "fieldTypes"...
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
PreviousValueModel.read
Deserialize via capnp :param proto: capnp PreviousValueModelProto message reader :returns: new instance of PreviousValueModel deserialized from the given proto
src/nupic/frameworks/opf/previous_value_model.py
def read(cls, proto): """Deserialize via capnp :param proto: capnp PreviousValueModelProto message reader :returns: new instance of PreviousValueModel deserialized from the given proto """ instance = object.__new__(cls) super(PreviousValueModel, instance).__init__(proto=proto.mod...
def read(cls, proto): """Deserialize via capnp :param proto: capnp PreviousValueModelProto message reader :returns: new instance of PreviousValueModel deserialized from the given proto """ instance = object.__new__(cls) super(PreviousValueModel, instance).__init__(proto=proto.mod...
[ "Deserialize", "via", "capnp" ]
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/frameworks/opf/previous_value_model.py#L153-L173
[ "def", "read", "(", "cls", ",", "proto", ")", ":", "instance", "=", "object", ".", "__new__", "(", "cls", ")", "super", "(", "PreviousValueModel", ",", "instance", ")", ".", "__init__", "(", "proto", "=", "proto", ".", "modelBase", ")", "instance", "."...
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
lscsum
Accepts log-values as input, exponentiates them, computes the sum, then converts the sum back to log-space and returns the result. Handles underflow by rescaling so that the largest values is exactly 1.0.
src/nupic/math/logarithms.py
def lscsum(lx, epsilon=None): """ Accepts log-values as input, exponentiates them, computes the sum, then converts the sum back to log-space and returns the result. Handles underflow by rescaling so that the largest values is exactly 1.0. """ lx = numpy.asarray(lx) base = lx.max() # If the input is the...
def lscsum(lx, epsilon=None): """ Accepts log-values as input, exponentiates them, computes the sum, then converts the sum back to log-space and returns the result. Handles underflow by rescaling so that the largest values is exactly 1.0. """ lx = numpy.asarray(lx) base = lx.max() # If the input is the...
[ "Accepts", "log", "-", "values", "as", "input", "exponentiates", "them", "computes", "the", "sum", "then", "converts", "the", "sum", "back", "to", "log", "-", "space", "and", "returns", "the", "result", ".", "Handles", "underflow", "by", "rescaling", "so", ...
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/math/logarithms.py#L28-L67
[ "def", "lscsum", "(", "lx", ",", "epsilon", "=", "None", ")", ":", "lx", "=", "numpy", ".", "asarray", "(", "lx", ")", "base", "=", "lx", ".", "max", "(", ")", "# If the input is the log of 0's, catch this condition before we generate", "# an exception, and retur...
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
lscsum0
Accepts log-values as input, exponentiates them, sums down the rows (first dimension), then converts the sum back to log-space and returns the result. Handles underflow by rescaling so that the largest values is exactly 1.0.
src/nupic/math/logarithms.py
def lscsum0(lx): """ Accepts log-values as input, exponentiates them, sums down the rows (first dimension), then converts the sum back to log-space and returns the result. Handles underflow by rescaling so that the largest values is exactly 1.0. """ # rows = lx.shape[0] # columns = numpy.prod(lx.shape[1:]...
def lscsum0(lx): """ Accepts log-values as input, exponentiates them, sums down the rows (first dimension), then converts the sum back to log-space and returns the result. Handles underflow by rescaling so that the largest values is exactly 1.0. """ # rows = lx.shape[0] # columns = numpy.prod(lx.shape[1:]...
[ "Accepts", "log", "-", "values", "as", "input", "exponentiates", "them", "sums", "down", "the", "rows", "(", "first", "dimension", ")", "then", "converts", "the", "sum", "back", "to", "log", "-", "space", "and", "returns", "the", "result", ".", "Handles", ...
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/math/logarithms.py#L70-L106
[ "def", "lscsum0", "(", "lx", ")", ":", "# rows = lx.shape[0]", "# columns = numpy.prod(lx.shape[1:])", "# lx = lx.reshape(rows, columns)", "# bases = lx.max(1).reshape(rows, 1)", "# bases = lx.max(0).reshape((1,) + lx.shape[1:])", "lx", "=", "numpy", ".", "asarray", "(", "lx", ")...
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
normalize
Accepts log-values as input, exponentiates them, normalizes and returns the result. Handles underflow by rescaling so that the largest values is exactly 1.0.
src/nupic/math/logarithms.py
def normalize(lx): """ Accepts log-values as input, exponentiates them, normalizes and returns the result. Handles underflow by rescaling so that the largest values is exactly 1.0. """ lx = numpy.asarray(lx) base = lx.max() x = numpy.exp(lx - base) result = x / x.sum() conventional = (numpy.exp(lx)...
def normalize(lx): """ Accepts log-values as input, exponentiates them, normalizes and returns the result. Handles underflow by rescaling so that the largest values is exactly 1.0. """ lx = numpy.asarray(lx) base = lx.max() x = numpy.exp(lx - base) result = x / x.sum() conventional = (numpy.exp(lx)...
[ "Accepts", "log", "-", "values", "as", "input", "exponentiates", "them", "normalizes", "and", "returns", "the", "result", ".", "Handles", "underflow", "by", "rescaling", "so", "that", "the", "largest", "values", "is", "exactly", "1", ".", "0", "." ]
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/math/logarithms.py#L109-L123
[ "def", "normalize", "(", "lx", ")", ":", "lx", "=", "numpy", ".", "asarray", "(", "lx", ")", "base", "=", "lx", ".", "max", "(", ")", "x", "=", "numpy", ".", "exp", "(", "lx", "-", "base", ")", "result", "=", "x", "/", "x", ".", "sum", "(",...
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
nsum0
Accepts log-values as input, exponentiates them, sums down the rows (first dimension), normalizes and returns the result. Handles underflow by rescaling so that the largest values is exactly 1.0.
src/nupic/math/logarithms.py
def nsum0(lx): """ Accepts log-values as input, exponentiates them, sums down the rows (first dimension), normalizes and returns the result. Handles underflow by rescaling so that the largest values is exactly 1.0. """ lx = numpy.asarray(lx) base = lx.max() x = numpy.exp(lx - base) ssum = x.sum(0) r...
def nsum0(lx): """ Accepts log-values as input, exponentiates them, sums down the rows (first dimension), normalizes and returns the result. Handles underflow by rescaling so that the largest values is exactly 1.0. """ lx = numpy.asarray(lx) base = lx.max() x = numpy.exp(lx - base) ssum = x.sum(0) r...
[ "Accepts", "log", "-", "values", "as", "input", "exponentiates", "them", "sums", "down", "the", "rows", "(", "first", "dimension", ")", "normalizes", "and", "returns", "the", "result", ".", "Handles", "underflow", "by", "rescaling", "so", "that", "the", "lar...
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/math/logarithms.py#L126-L141
[ "def", "nsum0", "(", "lx", ")", ":", "lx", "=", "numpy", ".", "asarray", "(", "lx", ")", "base", "=", "lx", ".", "max", "(", ")", "x", "=", "numpy", ".", "exp", "(", "lx", "-", "base", ")", "ssum", "=", "x", ".", "sum", "(", "0", ")", "re...
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
logSumExp
returns log(exp(A) + exp(B)). A and B are numpy arrays
src/nupic/math/logarithms.py
def logSumExp(A, B, out=None): """ returns log(exp(A) + exp(B)). A and B are numpy arrays""" if out is None: out = numpy.zeros(A.shape) indicator1 = A >= B indicator2 = numpy.logical_not(indicator1) out[indicator1] = A[indicator1] + numpy.log1p(numpy.exp(B[indicator1]-A[indicator1])) out[indicator2] ...
def logSumExp(A, B, out=None): """ returns log(exp(A) + exp(B)). A and B are numpy arrays""" if out is None: out = numpy.zeros(A.shape) indicator1 = A >= B indicator2 = numpy.logical_not(indicator1) out[indicator1] = A[indicator1] + numpy.log1p(numpy.exp(B[indicator1]-A[indicator1])) out[indicator2] ...
[ "returns", "log", "(", "exp", "(", "A", ")", "+", "exp", "(", "B", "))", ".", "A", "and", "B", "are", "numpy", "arrays" ]
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/math/logarithms.py#L164-L175
[ "def", "logSumExp", "(", "A", ",", "B", ",", "out", "=", "None", ")", ":", "if", "out", "is", "None", ":", "out", "=", "numpy", ".", "zeros", "(", "A", ".", "shape", ")", "indicator1", "=", "A", ">=", "B", "indicator2", "=", "numpy", ".", "logi...
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
logDiffExp
returns log(exp(A) - exp(B)). A and B are numpy arrays. values in A should be greater than or equal to corresponding values in B
src/nupic/math/logarithms.py
def logDiffExp(A, B, out=None): """ returns log(exp(A) - exp(B)). A and B are numpy arrays. values in A should be greater than or equal to corresponding values in B""" if out is None: out = numpy.zeros(A.shape) indicator1 = A >= B assert indicator1.all(), "Values in the first array should be greater tha...
def logDiffExp(A, B, out=None): """ returns log(exp(A) - exp(B)). A and B are numpy arrays. values in A should be greater than or equal to corresponding values in B""" if out is None: out = numpy.zeros(A.shape) indicator1 = A >= B assert indicator1.all(), "Values in the first array should be greater tha...
[ "returns", "log", "(", "exp", "(", "A", ")", "-", "exp", "(", "B", "))", ".", "A", "and", "B", "are", "numpy", "arrays", ".", "values", "in", "A", "should", "be", "greater", "than", "or", "equal", "to", "corresponding", "values", "in", "B" ]
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/math/logarithms.py#L177-L188
[ "def", "logDiffExp", "(", "A", ",", "B", ",", "out", "=", "None", ")", ":", "if", "out", "is", "None", ":", "out", "=", "numpy", ".", "zeros", "(", "A", ".", "shape", ")", "indicator1", "=", "A", ">=", "B", "assert", "indicator1", ".", "all", "...
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
_getFieldIndexBySpecial
Return index of the field matching the field meta special value. :param fields: sequence of nupic.data.fieldmeta.FieldMetaInfo objects representing the fields of a stream :param special: one of the special field attribute values from nupic.data.fieldmeta.FieldMetaSpecial :returns: first zero-based index o...
src/nupic/data/record_stream.py
def _getFieldIndexBySpecial(fields, special): """ Return index of the field matching the field meta special value. :param fields: sequence of nupic.data.fieldmeta.FieldMetaInfo objects representing the fields of a stream :param special: one of the special field attribute values from nupic.data.fieldmeta.F...
def _getFieldIndexBySpecial(fields, special): """ Return index of the field matching the field meta special value. :param fields: sequence of nupic.data.fieldmeta.FieldMetaInfo objects representing the fields of a stream :param special: one of the special field attribute values from nupic.data.fieldmeta.F...
[ "Return", "index", "of", "the", "field", "matching", "the", "field", "meta", "special", "value", ".", ":", "param", "fields", ":", "sequence", "of", "nupic", ".", "data", ".", "fieldmeta", ".", "FieldMetaInfo", "objects", "representing", "the", "fields", "of...
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/data/record_stream.py#L32-L44
[ "def", "_getFieldIndexBySpecial", "(", "fields", ",", "special", ")", ":", "for", "i", ",", "field", "in", "enumerate", "(", "fields", ")", ":", "if", "field", ".", "special", "==", "special", ":", "return", "i", "return", "None" ]
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
ModelRecordEncoder.encode
Encodes the given input row as a dict, with the keys being the field names. This also adds in some meta fields: '_category': The value from the category field (if any) '_reset': True if the reset field was True (if any) '_sequenceId': the value from the sequenceId field (if any) :param inputR...
src/nupic/data/record_stream.py
def encode(self, inputRow): """Encodes the given input row as a dict, with the keys being the field names. This also adds in some meta fields: '_category': The value from the category field (if any) '_reset': True if the reset field was True (if any) '_sequenceId': the value from the sequenceI...
def encode(self, inputRow): """Encodes the given input row as a dict, with the keys being the field names. This also adds in some meta fields: '_category': The value from the category field (if any) '_reset': True if the reset field was True (if any) '_sequenceId': the value from the sequenceI...
[ "Encodes", "the", "given", "input", "row", "as", "a", "dict", "with", "the", "keys", "being", "the", "field", "names", ".", "This", "also", "adds", "in", "some", "meta", "fields", ":", "_category", ":", "The", "value", "from", "the", "category", "field",...
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/data/record_stream.py#L104-L174
[ "def", "encode", "(", "self", ",", "inputRow", ")", ":", "# Create the return dict", "result", "=", "dict", "(", "zip", "(", "self", ".", "_fieldNames", ",", "inputRow", ")", ")", "# Add in the special fields", "if", "self", ".", "_categoryFieldIndex", "is", "...
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
ModelRecordEncoder._computeTimestampRecordIdx
Give the timestamp of a record (a datetime object), compute the record's timestamp index - this is the timestamp divided by the aggregation period. Parameters: ------------------------------------------------------------------------ recordTS: datetime instance retval: record timestamp index, o...
src/nupic/data/record_stream.py
def _computeTimestampRecordIdx(self, recordTS): """ Give the timestamp of a record (a datetime object), compute the record's timestamp index - this is the timestamp divided by the aggregation period. Parameters: ------------------------------------------------------------------------ recordTS: da...
def _computeTimestampRecordIdx(self, recordTS): """ Give the timestamp of a record (a datetime object), compute the record's timestamp index - this is the timestamp divided by the aggregation period. Parameters: ------------------------------------------------------------------------ recordTS: da...
[ "Give", "the", "timestamp", "of", "a", "record", "(", "a", "datetime", "object", ")", "compute", "the", "record", "s", "timestamp", "index", "-", "this", "is", "the", "timestamp", "divided", "by", "the", "aggregation", "period", "." ]
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/data/record_stream.py#L177-L210
[ "def", "_computeTimestampRecordIdx", "(", "self", ",", "recordTS", ")", ":", "if", "self", ".", "_aggregationPeriod", "is", "None", ":", "return", "None", "# Base record index on number of elapsed months if aggregation is in", "# months", "if", "self", ".", "_aggregation...
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
RecordStreamIface.getNextRecordDict
Returns next available data record from the storage as a dict, with the keys being the field names. This also adds in some meta fields: - ``_category``: The value from the category field (if any) - ``_reset``: True if the reset field was True (if any) - ``_sequenceId``: the value from the sequenc...
src/nupic/data/record_stream.py
def getNextRecordDict(self): """Returns next available data record from the storage as a dict, with the keys being the field names. This also adds in some meta fields: - ``_category``: The value from the category field (if any) - ``_reset``: True if the reset field was True (if any) - ``_sequ...
def getNextRecordDict(self): """Returns next available data record from the storage as a dict, with the keys being the field names. This also adds in some meta fields: - ``_category``: The value from the category field (if any) - ``_reset``: True if the reset field was True (if any) - ``_sequ...
[ "Returns", "next", "available", "data", "record", "from", "the", "storage", "as", "a", "dict", "with", "the", "keys", "being", "the", "field", "names", ".", "This", "also", "adds", "in", "some", "meta", "fields", ":" ]
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/data/record_stream.py#L252-L274
[ "def", "getNextRecordDict", "(", "self", ")", ":", "values", "=", "self", ".", "getNextRecord", "(", ")", "if", "values", "is", "None", ":", "return", "None", "if", "not", "values", ":", "return", "dict", "(", ")", "if", "self", ".", "_modelRecordEncoder...
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
RecordStreamIface.getFieldMin
If underlying implementation does not support min/max stats collection, or if a field type does not support min/max (non scalars), the return value will be None. :param fieldName: (string) name of field to get min :returns: current minimum value for the field ``fieldName``.
src/nupic/data/record_stream.py
def getFieldMin(self, fieldName): """ If underlying implementation does not support min/max stats collection, or if a field type does not support min/max (non scalars), the return value will be None. :param fieldName: (string) name of field to get min :returns: current minimum value for the fie...
def getFieldMin(self, fieldName): """ If underlying implementation does not support min/max stats collection, or if a field type does not support min/max (non scalars), the return value will be None. :param fieldName: (string) name of field to get min :returns: current minimum value for the fie...
[ "If", "underlying", "implementation", "does", "not", "support", "min", "/", "max", "stats", "collection", "or", "if", "a", "field", "type", "does", "not", "support", "min", "/", "max", "(", "non", "scalars", ")", "the", "return", "value", "will", "be", "...
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/data/record_stream.py#L361-L377
[ "def", "getFieldMin", "(", "self", ",", "fieldName", ")", ":", "stats", "=", "self", ".", "getStats", "(", ")", "if", "stats", "==", "None", ":", "return", "None", "minValues", "=", "stats", ".", "get", "(", "'min'", ",", "None", ")", "if", "minValue...
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
RecordStreamIface.getFieldMax
If underlying implementation does not support min/max stats collection, or if a field type does not support min/max (non scalars), the return value will be None. :param fieldName: (string) name of field to get max :returns: current maximum value for the field ``fieldName``.
src/nupic/data/record_stream.py
def getFieldMax(self, fieldName): """ If underlying implementation does not support min/max stats collection, or if a field type does not support min/max (non scalars), the return value will be None. :param fieldName: (string) name of field to get max :returns: current maximum value for the fie...
def getFieldMax(self, fieldName): """ If underlying implementation does not support min/max stats collection, or if a field type does not support min/max (non scalars), the return value will be None. :param fieldName: (string) name of field to get max :returns: current maximum value for the fie...
[ "If", "underlying", "implementation", "does", "not", "support", "min", "/", "max", "stats", "collection", "or", "if", "a", "field", "type", "does", "not", "support", "min", "/", "max", "(", "non", "scalars", ")", "the", "return", "value", "will", "be", "...
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/data/record_stream.py#L380-L396
[ "def", "getFieldMax", "(", "self", ",", "fieldName", ")", ":", "stats", "=", "self", ".", "getStats", "(", ")", "if", "stats", "==", "None", ":", "return", "None", "maxValues", "=", "stats", ".", "get", "(", "'max'", ",", "None", ")", "if", "maxValue...
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
ExtendedLogger.debug
Log 'msg % args' with severity 'DEBUG'. To pass exception information, use the keyword argument exc_info with a true value, e.g. logger.debug("Houston, we have a %s", "thorny problem", exc_info=1)
src/nupic/swarming/hypersearch/extended_logger.py
def debug(self, msg, *args, **kwargs): """ Log 'msg % args' with severity 'DEBUG'. To pass exception information, use the keyword argument exc_info with a true value, e.g. logger.debug("Houston, we have a %s", "thorny problem", exc_info=1) """ self._baseLogger.debug(self, self.getExtendedM...
def debug(self, msg, *args, **kwargs): """ Log 'msg % args' with severity 'DEBUG'. To pass exception information, use the keyword argument exc_info with a true value, e.g. logger.debug("Houston, we have a %s", "thorny problem", exc_info=1) """ self._baseLogger.debug(self, self.getExtendedM...
[ "Log", "msg", "%", "args", "with", "severity", "DEBUG", "." ]
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/swarming/hypersearch/extended_logger.py#L47-L56
[ "def", "debug", "(", "self", ",", "msg", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "self", ".", "_baseLogger", ".", "debug", "(", "self", ",", "self", ".", "getExtendedMsg", "(", "msg", ")", ",", "*", "args", ",", "*", "*", "kwargs", ...
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
ExtendedLogger.info
Log 'msg % args' with severity 'INFO'. To pass exception information, use the keyword argument exc_info with a true value, e.g. logger.info("Houston, we have a %s", "interesting problem", exc_info=1)
src/nupic/swarming/hypersearch/extended_logger.py
def info(self, msg, *args, **kwargs): """ Log 'msg % args' with severity 'INFO'. To pass exception information, use the keyword argument exc_info with a true value, e.g. logger.info("Houston, we have a %s", "interesting problem", exc_info=1) """ self._baseLogger.info(self, self.getExtended...
def info(self, msg, *args, **kwargs): """ Log 'msg % args' with severity 'INFO'. To pass exception information, use the keyword argument exc_info with a true value, e.g. logger.info("Houston, we have a %s", "interesting problem", exc_info=1) """ self._baseLogger.info(self, self.getExtended...
[ "Log", "msg", "%", "args", "with", "severity", "INFO", "." ]
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/swarming/hypersearch/extended_logger.py#L59-L68
[ "def", "info", "(", "self", ",", "msg", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "self", ".", "_baseLogger", ".", "info", "(", "self", ",", "self", ".", "getExtendedMsg", "(", "msg", ")", ",", "*", "args", ",", "*", "*", "kwargs", "...
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
ExtendedLogger.warning
Log 'msg % args' with severity 'WARNING'. To pass exception information, use the keyword argument exc_info with a true value, e.g. logger.warning("Houston, we have a %s", "bit of a problem", exc_info=1)
src/nupic/swarming/hypersearch/extended_logger.py
def warning(self, msg, *args, **kwargs): """ Log 'msg % args' with severity 'WARNING'. To pass exception information, use the keyword argument exc_info with a true value, e.g. logger.warning("Houston, we have a %s", "bit of a problem", exc_info=1) """ self._baseLogger.warning(self, self.ge...
def warning(self, msg, *args, **kwargs): """ Log 'msg % args' with severity 'WARNING'. To pass exception information, use the keyword argument exc_info with a true value, e.g. logger.warning("Houston, we have a %s", "bit of a problem", exc_info=1) """ self._baseLogger.warning(self, self.ge...
[ "Log", "msg", "%", "args", "with", "severity", "WARNING", "." ]
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/swarming/hypersearch/extended_logger.py#L71-L80
[ "def", "warning", "(", "self", ",", "msg", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "self", ".", "_baseLogger", ".", "warning", "(", "self", ",", "self", ".", "getExtendedMsg", "(", "msg", ")", ",", "*", "args", ",", "*", "*", "kwargs...
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
ExtendedLogger.error
Log 'msg % args' with severity 'ERROR'. To pass exception information, use the keyword argument exc_info with a true value, e.g. logger.error("Houston, we have a %s", "major problem", exc_info=1)
src/nupic/swarming/hypersearch/extended_logger.py
def error(self, msg, *args, **kwargs): """ Log 'msg % args' with severity 'ERROR'. To pass exception information, use the keyword argument exc_info with a true value, e.g. logger.error("Houston, we have a %s", "major problem", exc_info=1) """ self._baseLogger.error(self, self.getExtendedMs...
def error(self, msg, *args, **kwargs): """ Log 'msg % args' with severity 'ERROR'. To pass exception information, use the keyword argument exc_info with a true value, e.g. logger.error("Houston, we have a %s", "major problem", exc_info=1) """ self._baseLogger.error(self, self.getExtendedMs...
[ "Log", "msg", "%", "args", "with", "severity", "ERROR", "." ]
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/swarming/hypersearch/extended_logger.py#L85-L94
[ "def", "error", "(", "self", ",", "msg", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "self", ".", "_baseLogger", ".", "error", "(", "self", ",", "self", ".", "getExtendedMsg", "(", "msg", ")", ",", "*", "args", ",", "*", "*", "kwargs", ...
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
ExtendedLogger.critical
Log 'msg % args' with severity 'CRITICAL'. To pass exception information, use the keyword argument exc_info with a true value, e.g. logger.critical("Houston, we have a %s", "major disaster", exc_info=1)
src/nupic/swarming/hypersearch/extended_logger.py
def critical(self, msg, *args, **kwargs): """ Log 'msg % args' with severity 'CRITICAL'. To pass exception information, use the keyword argument exc_info with a true value, e.g. logger.critical("Houston, we have a %s", "major disaster", exc_info=1) """ self._baseLogger.critical(self, self....
def critical(self, msg, *args, **kwargs): """ Log 'msg % args' with severity 'CRITICAL'. To pass exception information, use the keyword argument exc_info with a true value, e.g. logger.critical("Houston, we have a %s", "major disaster", exc_info=1) """ self._baseLogger.critical(self, self....
[ "Log", "msg", "%", "args", "with", "severity", "CRITICAL", "." ]
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/swarming/hypersearch/extended_logger.py#L97-L106
[ "def", "critical", "(", "self", ",", "msg", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "self", ".", "_baseLogger", ".", "critical", "(", "self", ",", "self", ".", "getExtendedMsg", "(", "msg", ")", ",", "*", "args", ",", "*", "*", "kwar...
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
ExtendedLogger.log
Log 'msg % args' with the integer severity 'level'. To pass exception information, use the keyword argument exc_info with a true value, e.g. logger.log(level, "We have a %s", "mysterious problem", exc_info=1)
src/nupic/swarming/hypersearch/extended_logger.py
def log(self, level, msg, *args, **kwargs): """ Log 'msg % args' with the integer severity 'level'. To pass exception information, use the keyword argument exc_info with a true value, e.g. logger.log(level, "We have a %s", "mysterious problem", exc_info=1) """ self._baseLogge...
def log(self, level, msg, *args, **kwargs): """ Log 'msg % args' with the integer severity 'level'. To pass exception information, use the keyword argument exc_info with a true value, e.g. logger.log(level, "We have a %s", "mysterious problem", exc_info=1) """ self._baseLogge...
[ "Log", "msg", "%", "args", "with", "the", "integer", "severity", "level", "." ]
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/swarming/hypersearch/extended_logger.py#L111-L121
[ "def", "log", "(", "self", ",", "level", ",", "msg", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "self", ".", "_baseLogger", ".", "log", "(", "self", ",", "level", ",", "self", ".", "getExtendedMsg", "(", "msg", ")", ",", "*", "args", ...
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
initFilter
Initializes internal filter variables for further processing. Returns a tuple (function to call,parameters for the filter call) The filterInfo is a dict. Here is an example structure: {fieldName: {'min': x, 'max': y, 'type': 'category', # or 'number' 'acceptVa...
src/nupic/data/aggregator.py
def initFilter(input, filterInfo = None): """ Initializes internal filter variables for further processing. Returns a tuple (function to call,parameters for the filter call) The filterInfo is a dict. Here is an example structure: {fieldName: {'min': x, 'max': y, 'type': 'cat...
def initFilter(input, filterInfo = None): """ Initializes internal filter variables for further processing. Returns a tuple (function to call,parameters for the filter call) The filterInfo is a dict. Here is an example structure: {fieldName: {'min': x, 'max': y, 'type': 'cat...
[ "Initializes", "internal", "filter", "variables", "for", "further", "processing", ".", "Returns", "a", "tuple", "(", "function", "to", "call", "parameters", "for", "the", "filter", "call", ")" ]
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/data/aggregator.py#L51-L110
[ "def", "initFilter", "(", "input", ",", "filterInfo", "=", "None", ")", ":", "if", "filterInfo", "is", "None", ":", "return", "None", "# Build an array of index/func to call on record[index]", "filterList", "=", "[", "]", "for", "i", ",", "fieldName", "in", "enu...
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
_filterRecord
Takes a record and returns true if record meets filter criteria, false otherwise
src/nupic/data/aggregator.py
def _filterRecord(filterList, record): """ Takes a record and returns true if record meets filter criteria, false otherwise """ for (fieldIdx, fp, params) in filterList: x = dict() x['value'] = record[fieldIdx] x['acceptValues'] = params['acceptValues'] x['min'] = params['min'] x['max'] = p...
def _filterRecord(filterList, record): """ Takes a record and returns true if record meets filter criteria, false otherwise """ for (fieldIdx, fp, params) in filterList: x = dict() x['value'] = record[fieldIdx] x['acceptValues'] = params['acceptValues'] x['min'] = params['min'] x['max'] = p...
[ "Takes", "a", "record", "and", "returns", "true", "if", "record", "meets", "filter", "criteria", "false", "otherwise" ]
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/data/aggregator.py#L114-L129
[ "def", "_filterRecord", "(", "filterList", ",", "record", ")", ":", "for", "(", "fieldIdx", ",", "fp", ",", "params", ")", "in", "filterList", ":", "x", "=", "dict", "(", ")", "x", "[", "'value'", "]", "=", "record", "[", "fieldIdx", "]", "x", "[",...
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
_aggr_sum
Returns sum of the elements in the list. Missing items are replaced with the mean value
src/nupic/data/aggregator.py
def _aggr_sum(inList): """ Returns sum of the elements in the list. Missing items are replaced with the mean value """ aggrMean = _aggr_mean(inList) if aggrMean == None: return None aggrSum = 0 for elem in inList: if elem != SENTINEL_VALUE_FOR_MISSING_DATA: aggrSum += elem else: a...
def _aggr_sum(inList): """ Returns sum of the elements in the list. Missing items are replaced with the mean value """ aggrMean = _aggr_mean(inList) if aggrMean == None: return None aggrSum = 0 for elem in inList: if elem != SENTINEL_VALUE_FOR_MISSING_DATA: aggrSum += elem else: a...
[ "Returns", "sum", "of", "the", "elements", "in", "the", "list", ".", "Missing", "items", "are", "replaced", "with", "the", "mean", "value" ]
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/data/aggregator.py#L153-L168
[ "def", "_aggr_sum", "(", "inList", ")", ":", "aggrMean", "=", "_aggr_mean", "(", "inList", ")", "if", "aggrMean", "==", "None", ":", "return", "None", "aggrSum", "=", "0", "for", "elem", "in", "inList", ":", "if", "elem", "!=", "SENTINEL_VALUE_FOR_MISSING_...
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
_aggr_mean
Returns mean of non-None elements of the list
src/nupic/data/aggregator.py
def _aggr_mean(inList): """ Returns mean of non-None elements of the list """ aggrSum = 0 nonNone = 0 for elem in inList: if elem != SENTINEL_VALUE_FOR_MISSING_DATA: aggrSum += elem nonNone += 1 if nonNone != 0: return aggrSum / nonNone else: return None
def _aggr_mean(inList): """ Returns mean of non-None elements of the list """ aggrSum = 0 nonNone = 0 for elem in inList: if elem != SENTINEL_VALUE_FOR_MISSING_DATA: aggrSum += elem nonNone += 1 if nonNone != 0: return aggrSum / nonNone else: return None
[ "Returns", "mean", "of", "non", "-", "None", "elements", "of", "the", "list" ]
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/data/aggregator.py#L172-L184
[ "def", "_aggr_mean", "(", "inList", ")", ":", "aggrSum", "=", "0", "nonNone", "=", "0", "for", "elem", "in", "inList", ":", "if", "elem", "!=", "SENTINEL_VALUE_FOR_MISSING_DATA", ":", "aggrSum", "+=", "elem", "nonNone", "+=", "1", "if", "nonNone", "!=", ...
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
_aggr_mode
Returns most common value seen in the non-None elements of the list
src/nupic/data/aggregator.py
def _aggr_mode(inList): """ Returns most common value seen in the non-None elements of the list """ valueCounts = dict() nonNone = 0 for elem in inList: if elem == SENTINEL_VALUE_FOR_MISSING_DATA: continue nonNone += 1 if elem in valueCounts: valueCounts[elem] += 1 else: v...
def _aggr_mode(inList): """ Returns most common value seen in the non-None elements of the list """ valueCounts = dict() nonNone = 0 for elem in inList: if elem == SENTINEL_VALUE_FOR_MISSING_DATA: continue nonNone += 1 if elem in valueCounts: valueCounts[elem] += 1 else: v...
[ "Returns", "most", "common", "value", "seen", "in", "the", "non", "-", "None", "elements", "of", "the", "list" ]
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/data/aggregator.py#L188-L212
[ "def", "_aggr_mode", "(", "inList", ")", ":", "valueCounts", "=", "dict", "(", ")", "nonNone", "=", "0", "for", "elem", "in", "inList", ":", "if", "elem", "==", "SENTINEL_VALUE_FOR_MISSING_DATA", ":", "continue", "nonNone", "+=", "1", "if", "elem", "in", ...
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
_aggr_weighted_mean
Weighted mean uses params (must be the same size as inList) and makes weighed mean of inList
src/nupic/data/aggregator.py
def _aggr_weighted_mean(inList, params): """ Weighted mean uses params (must be the same size as inList) and makes weighed mean of inList""" assert(len(inList) == len(params)) # If all weights are 0, then the value is not defined, return None (missing) weightsSum = sum(params) if weightsSum == 0: retur...
def _aggr_weighted_mean(inList, params): """ Weighted mean uses params (must be the same size as inList) and makes weighed mean of inList""" assert(len(inList) == len(params)) # If all weights are 0, then the value is not defined, return None (missing) weightsSum = sum(params) if weightsSum == 0: retur...
[ "Weighted", "mean", "uses", "params", "(", "must", "be", "the", "same", "size", "as", "inList", ")", "and", "makes", "weighed", "mean", "of", "inList" ]
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/data/aggregator.py#L216-L230
[ "def", "_aggr_weighted_mean", "(", "inList", ",", "params", ")", ":", "assert", "(", "len", "(", "inList", ")", "==", "len", "(", "params", ")", ")", "# If all weights are 0, then the value is not defined, return None (missing)", "weightsSum", "=", "sum", "(", "para...
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
generateDataset
Generate a dataset of aggregated values Parameters: ---------------------------------------------------------------------------- aggregationInfo: a dictionary that contains the following entries - fields: a list of pairs. Each pair is a field name and an aggregation function (e.g. sum). The function wi...
src/nupic/data/aggregator.py
def generateDataset(aggregationInfo, inputFilename, outputFilename=None): """Generate a dataset of aggregated values Parameters: ---------------------------------------------------------------------------- aggregationInfo: a dictionary that contains the following entries - fields: a list of pairs. Each pai...
def generateDataset(aggregationInfo, inputFilename, outputFilename=None): """Generate a dataset of aggregated values Parameters: ---------------------------------------------------------------------------- aggregationInfo: a dictionary that contains the following entries - fields: a list of pairs. Each pai...
[ "Generate", "a", "dataset", "of", "aggregated", "values" ]
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/data/aggregator.py#L720-L834
[ "def", "generateDataset", "(", "aggregationInfo", ",", "inputFilename", ",", "outputFilename", "=", "None", ")", ":", "# Create the input stream", "inputFullPath", "=", "resource_filename", "(", "\"nupic.datafiles\"", ",", "inputFilename", ")", "inputObj", "=", "FileRec...
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
getFilename
Generate the filename for aggregated dataset The filename is based on the input filename and the aggregation period. Returns the inputFile if no aggregation required (aggregation info has all 0's)
src/nupic/data/aggregator.py
def getFilename(aggregationInfo, inputFile): """Generate the filename for aggregated dataset The filename is based on the input filename and the aggregation period. Returns the inputFile if no aggregation required (aggregation info has all 0's) """ # Find the actual file, with an absolute path inputF...
def getFilename(aggregationInfo, inputFile): """Generate the filename for aggregated dataset The filename is based on the input filename and the aggregation period. Returns the inputFile if no aggregation required (aggregation info has all 0's) """ # Find the actual file, with an absolute path inputF...
[ "Generate", "the", "filename", "for", "aggregated", "dataset" ]
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/data/aggregator.py#L838-L867
[ "def", "getFilename", "(", "aggregationInfo", ",", "inputFile", ")", ":", "# Find the actual file, with an absolute path", "inputFile", "=", "resource_filename", "(", "\"nupic.datafiles\"", ",", "inputFile", ")", "a", "=", "defaultdict", "(", "lambda", ":", "0", ",", ...
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
Aggregator._getEndTime
Add the aggregation period to the input time t and return a datetime object Years and months are handled as aspecial case due to leap years and months with different number of dates. They can't be converted to a strict timedelta because a period of 3 months will have different durations actually. The s...
src/nupic/data/aggregator.py
def _getEndTime(self, t): """Add the aggregation period to the input time t and return a datetime object Years and months are handled as aspecial case due to leap years and months with different number of dates. They can't be converted to a strict timedelta because a period of 3 months will have differ...
def _getEndTime(self, t): """Add the aggregation period to the input time t and return a datetime object Years and months are handled as aspecial case due to leap years and months with different number of dates. They can't be converted to a strict timedelta because a period of 3 months will have differ...
[ "Add", "the", "aggregation", "period", "to", "the", "input", "time", "t", "and", "return", "a", "datetime", "object" ]
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/data/aggregator.py#L426-L444
[ "def", "_getEndTime", "(", "self", ",", "t", ")", ":", "assert", "isinstance", "(", "t", ",", "datetime", ".", "datetime", ")", "if", "self", ".", "_aggTimeDelta", ":", "return", "t", "+", "self", ".", "_aggTimeDelta", "else", ":", "year", "=", "t", ...
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
Aggregator._getFuncPtrAndParams
Given the name of an aggregation function, returns the function pointer and param. Parameters: ------------------------------------------------------------------------ funcName: a string (name of function) or funcPtr retval: (funcPtr, param)
src/nupic/data/aggregator.py
def _getFuncPtrAndParams(self, funcName): """ Given the name of an aggregation function, returns the function pointer and param. Parameters: ------------------------------------------------------------------------ funcName: a string (name of function) or funcPtr retval: (funcPtr, param) ...
def _getFuncPtrAndParams(self, funcName): """ Given the name of an aggregation function, returns the function pointer and param. Parameters: ------------------------------------------------------------------------ funcName: a string (name of function) or funcPtr retval: (funcPtr, param) ...
[ "Given", "the", "name", "of", "an", "aggregation", "function", "returns", "the", "function", "pointer", "and", "param", "." ]
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/data/aggregator.py#L447-L480
[ "def", "_getFuncPtrAndParams", "(", "self", ",", "funcName", ")", ":", "params", "=", "None", "if", "isinstance", "(", "funcName", ",", "basestring", ")", ":", "if", "funcName", "==", "'sum'", ":", "fp", "=", "_aggr_sum", "elif", "funcName", "==", "'first'...
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
Aggregator._createAggregateRecord
Generate the aggregated output record Parameters: ------------------------------------------------------------------------ retval: outputRecord
src/nupic/data/aggregator.py
def _createAggregateRecord(self): """ Generate the aggregated output record Parameters: ------------------------------------------------------------------------ retval: outputRecord """ record = [] for i, (fieldIdx, aggFP, paramIdx) in enumerate(self._fields): if aggFP is None: # t...
def _createAggregateRecord(self): """ Generate the aggregated output record Parameters: ------------------------------------------------------------------------ retval: outputRecord """ record = [] for i, (fieldIdx, aggFP, paramIdx) in enumerate(self._fields): if aggFP is None: # t...
[ "Generate", "the", "aggregated", "output", "record" ]
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/data/aggregator.py#L483-L505
[ "def", "_createAggregateRecord", "(", "self", ")", ":", "record", "=", "[", "]", "for", "i", ",", "(", "fieldIdx", ",", "aggFP", ",", "paramIdx", ")", "in", "enumerate", "(", "self", ".", "_fields", ")", ":", "if", "aggFP", "is", "None", ":", "# this...
5922fafffdccc8812e72b3324965ad2f7d4bbdad