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
OPFModelRunner._finalize
Run final activities after a model has run. These include recording and logging the final score
src/nupic/swarming/ModelRunner.py
def _finalize(self): """Run final activities after a model has run. These include recording and logging the final score""" self._logger.info( "Finished: modelID=%r; %r records processed. Performing final activities", self._modelID, self._currentRecordIndex + 1) # ==========================...
def _finalize(self): """Run final activities after a model has run. These include recording and logging the final score""" self._logger.info( "Finished: modelID=%r; %r records processed. Performing final activities", self._modelID, self._currentRecordIndex + 1) # ==========================...
[ "Run", "final", "activities", "after", "a", "model", "has", "run", ".", "These", "include", "recording", "and", "logging", "the", "final", "score" ]
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/swarming/ModelRunner.py#L394-L427
[ "def", "_finalize", "(", "self", ")", ":", "self", ".", "_logger", ".", "info", "(", "\"Finished: modelID=%r; %r records processed. Performing final activities\"", ",", "self", ".", "_modelID", ",", "self", ".", "_currentRecordIndex", "+", "1", ")", "# ===============...
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
OPFModelRunner.__createModelCheckpoint
Create a checkpoint from the current model, and store it in a dir named after checkpoint GUID, and finally store the GUID in the Models DB
src/nupic/swarming/ModelRunner.py
def __createModelCheckpoint(self): """ Create a checkpoint from the current model, and store it in a dir named after checkpoint GUID, and finally store the GUID in the Models DB """ if self._model is None or self._modelCheckpointGUID is None: return # Create an output store, if one doesn't exist...
def __createModelCheckpoint(self): """ Create a checkpoint from the current model, and store it in a dir named after checkpoint GUID, and finally store the GUID in the Models DB """ if self._model is None or self._modelCheckpointGUID is None: return # Create an output store, if one doesn't exist...
[ "Create", "a", "checkpoint", "from", "the", "current", "model", "and", "store", "it", "in", "a", "dir", "named", "after", "checkpoint", "GUID", "and", "finally", "store", "the", "GUID", "in", "the", "Models", "DB" ]
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/swarming/ModelRunner.py#L429-L452
[ "def", "__createModelCheckpoint", "(", "self", ")", ":", "if", "self", ".", "_model", "is", "None", "or", "self", ".", "_modelCheckpointGUID", "is", "None", ":", "return", "# Create an output store, if one doesn't exist already", "if", "self", ".", "_predictionLogger"...
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
OPFModelRunner.__deleteModelCheckpoint
Delete the stored checkpoint for the specified modelID. This function is called if the current model is now the best model, making the old model's checkpoint obsolete Parameters: ----------------------------------------------------------------------- modelID: The modelID for the checkpoint to ...
src/nupic/swarming/ModelRunner.py
def __deleteModelCheckpoint(self, modelID): """ Delete the stored checkpoint for the specified modelID. This function is called if the current model is now the best model, making the old model's checkpoint obsolete Parameters: --------------------------------------------------------------------...
def __deleteModelCheckpoint(self, modelID): """ Delete the stored checkpoint for the specified modelID. This function is called if the current model is now the best model, making the old model's checkpoint obsolete Parameters: --------------------------------------------------------------------...
[ "Delete", "the", "stored", "checkpoint", "for", "the", "specified", "modelID", ".", "This", "function", "is", "called", "if", "the", "current", "model", "is", "now", "the", "best", "model", "making", "the", "old", "model", "s", "checkpoint", "obsolete" ]
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/swarming/ModelRunner.py#L455-L484
[ "def", "__deleteModelCheckpoint", "(", "self", ",", "modelID", ")", ":", "checkpointID", "=", "self", ".", "_jobsDAO", ".", "modelsGetFields", "(", "modelID", ",", "[", "'modelCheckpointId'", "]", ")", "[", "0", "]", "if", "checkpointID", "is", "None", ":", ...
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
OPFModelRunner._createPredictionLogger
Creates the model's PredictionLogger object, which is an interface to write model results to a permanent storage location
src/nupic/swarming/ModelRunner.py
def _createPredictionLogger(self): """ Creates the model's PredictionLogger object, which is an interface to write model results to a permanent storage location """ # Write results to a file self._predictionLogger = BasicPredictionLogger( fields=self._model.getFieldInfo(), experiment...
def _createPredictionLogger(self): """ Creates the model's PredictionLogger object, which is an interface to write model results to a permanent storage location """ # Write results to a file self._predictionLogger = BasicPredictionLogger( fields=self._model.getFieldInfo(), experiment...
[ "Creates", "the", "model", "s", "PredictionLogger", "object", "which", "is", "an", "interface", "to", "write", "model", "results", "to", "a", "permanent", "storage", "location" ]
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/swarming/ModelRunner.py#L487-L502
[ "def", "_createPredictionLogger", "(", "self", ")", ":", "# Write results to a file", "self", ".", "_predictionLogger", "=", "BasicPredictionLogger", "(", "fields", "=", "self", ".", "_model", ".", "getFieldInfo", "(", ")", ",", "experimentDir", "=", "self", ".", ...
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
OPFModelRunner.__getOptimizedMetricLabel
Get the label for the metric being optimized. This function also caches the label in the instance variable self._optimizedMetricLabel Parameters: ----------------------------------------------------------------------- metricLabels: A sequence of all the labels being computed for this model Retur...
src/nupic/swarming/ModelRunner.py
def __getOptimizedMetricLabel(self): """ Get the label for the metric being optimized. This function also caches the label in the instance variable self._optimizedMetricLabel Parameters: ----------------------------------------------------------------------- metricLabels: A sequence of all the la...
def __getOptimizedMetricLabel(self): """ Get the label for the metric being optimized. This function also caches the label in the instance variable self._optimizedMetricLabel Parameters: ----------------------------------------------------------------------- metricLabels: A sequence of all the la...
[ "Get", "the", "label", "for", "the", "metric", "being", "optimized", ".", "This", "function", "also", "caches", "the", "label", "in", "the", "instance", "variable", "self", ".", "_optimizedMetricLabel" ]
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/swarming/ModelRunner.py#L505-L526
[ "def", "__getOptimizedMetricLabel", "(", "self", ")", ":", "matchingKeys", "=", "matchPatterns", "(", "[", "self", ".", "_optimizeKeyPattern", "]", ",", "self", ".", "_getMetricLabels", "(", ")", ")", "if", "len", "(", "matchingKeys", ")", "==", "0", ":", ...
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
OPFModelRunner._getFieldStats
Method which returns a dictionary of field statistics received from the input source. Returns: fieldStats: dict of dicts where the first level is the field name and the second level is the statistic. ie. fieldStats['pounds']['min']
src/nupic/swarming/ModelRunner.py
def _getFieldStats(self): """ Method which returns a dictionary of field statistics received from the input source. Returns: fieldStats: dict of dicts where the first level is the field name and the second level is the statistic. ie. fieldStats['pounds']['min'] """ fieldStats =...
def _getFieldStats(self): """ Method which returns a dictionary of field statistics received from the input source. Returns: fieldStats: dict of dicts where the first level is the field name and the second level is the statistic. ie. fieldStats['pounds']['min'] """ fieldStats =...
[ "Method", "which", "returns", "a", "dictionary", "of", "field", "statistics", "received", "from", "the", "input", "source", "." ]
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/swarming/ModelRunner.py#L536-L555
[ "def", "_getFieldStats", "(", "self", ")", ":", "fieldStats", "=", "dict", "(", ")", "fieldNames", "=", "self", ".", "_inputSource", ".", "getFieldNames", "(", ")", "for", "field", "in", "fieldNames", ":", "curStats", "=", "dict", "(", ")", "curStats", "...
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
OPFModelRunner._updateModelDBResults
Retrieves the current results and updates the model's record in the Model database.
src/nupic/swarming/ModelRunner.py
def _updateModelDBResults(self): """ Retrieves the current results and updates the model's record in the Model database. """ # ----------------------------------------------------------------------- # Get metrics metrics = self._getMetrics() # ----------------------------------------------...
def _updateModelDBResults(self): """ Retrieves the current results and updates the model's record in the Model database. """ # ----------------------------------------------------------------------- # Get metrics metrics = self._getMetrics() # ----------------------------------------------...
[ "Retrieves", "the", "current", "results", "and", "updates", "the", "model", "s", "record", "in", "the", "Model", "database", "." ]
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/swarming/ModelRunner.py#L568-L601
[ "def", "_updateModelDBResults", "(", "self", ")", ":", "# -----------------------------------------------------------------------", "# Get metrics", "metrics", "=", "self", ".", "_getMetrics", "(", ")", "# -----------------------------------------------------------------------", "# E...
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
OPFModelRunner.__updateJobResultsPeriodic
Periodic check to see if this is the best model. This should only have an effect if this is the *first* model to report its progress
src/nupic/swarming/ModelRunner.py
def __updateJobResultsPeriodic(self): """ Periodic check to see if this is the best model. This should only have an effect if this is the *first* model to report its progress """ if self._isBestModelStored and not self._isBestModel: return while True: jobResultsStr = self._jobsDAO.j...
def __updateJobResultsPeriodic(self): """ Periodic check to see if this is the best model. This should only have an effect if this is the *first* model to report its progress """ if self._isBestModelStored and not self._isBestModel: return while True: jobResultsStr = self._jobsDAO.j...
[ "Periodic", "check", "to", "see", "if", "this", "is", "the", "best", "model", ".", "This", "should", "only", "have", "an", "effect", "if", "this", "is", "the", "*", "first", "*", "model", "to", "report", "its", "progress" ]
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/swarming/ModelRunner.py#L604-L655
[ "def", "__updateJobResultsPeriodic", "(", "self", ")", ":", "if", "self", ".", "_isBestModelStored", "and", "not", "self", ".", "_isBestModel", ":", "return", "while", "True", ":", "jobResultsStr", "=", "self", ".", "_jobsDAO", ".", "jobGetFields", "(", "self"...
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
OPFModelRunner.__checkIfBestCompletedModel
Reads the current "best model" for the job and returns whether or not the current model is better than the "best model" stored for the job Returns: (isBetter, storedBest, origResultsStr) isBetter: True if the current model is better than the stored "best model" storedResults: A dict of the...
src/nupic/swarming/ModelRunner.py
def __checkIfBestCompletedModel(self): """ Reads the current "best model" for the job and returns whether or not the current model is better than the "best model" stored for the job Returns: (isBetter, storedBest, origResultsStr) isBetter: True if the current model is better than the stored ...
def __checkIfBestCompletedModel(self): """ Reads the current "best model" for the job and returns whether or not the current model is better than the "best model" stored for the job Returns: (isBetter, storedBest, origResultsStr) isBetter: True if the current model is better than the stored ...
[ "Reads", "the", "current", "best", "model", "for", "the", "job", "and", "returns", "whether", "or", "not", "the", "current", "model", "is", "better", "than", "the", "best", "model", "stored", "for", "the", "job" ]
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/swarming/ModelRunner.py#L658-L690
[ "def", "__checkIfBestCompletedModel", "(", "self", ")", ":", "jobResultsStr", "=", "self", ".", "_jobsDAO", ".", "jobGetFields", "(", "self", ".", "_jobID", ",", "[", "'results'", "]", ")", "[", "0", "]", "if", "jobResultsStr", "is", "None", ":", "jobResul...
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
OPFModelRunner.__updateJobResults
Check if this is the best model If so: 1) Write it's checkpoint 2) Record this model as the best 3) Delete the previous best's output cache Otherwise: 1) Delete our output cache
src/nupic/swarming/ModelRunner.py
def __updateJobResults(self): """" Check if this is the best model If so: 1) Write it's checkpoint 2) Record this model as the best 3) Delete the previous best's output cache Otherwise: 1) Delete our output cache """ isSaved = False while True: self._isBestMode...
def __updateJobResults(self): """" Check if this is the best model If so: 1) Write it's checkpoint 2) Record this model as the best 3) Delete the previous best's output cache Otherwise: 1) Delete our output cache """ isSaved = False while True: self._isBestMode...
[ "Check", "if", "this", "is", "the", "best", "model", "If", "so", ":", "1", ")", "Write", "it", "s", "checkpoint", "2", ")", "Record", "this", "model", "as", "the", "best", "3", ")", "Delete", "the", "previous", "best", "s", "output", "cache", "Otherw...
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/swarming/ModelRunner.py#L693-L761
[ "def", "__updateJobResults", "(", "self", ")", ":", "isSaved", "=", "False", "while", "True", ":", "self", ".", "_isBestModel", ",", "jobResults", ",", "jobResultsStr", "=", "self", ".", "__checkIfBestCompletedModel", "(", ")", "# -----------------------------------...
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
OPFModelRunner._writePrediction
Writes the results of one iteration of a model. The results are written to this ModelRunner's in-memory cache unless this model is the "best model" for the job. If this model is the "best model", the predictions are written out to a permanent store via a prediction output stream instance Parameters: ...
src/nupic/swarming/ModelRunner.py
def _writePrediction(self, result): """ Writes the results of one iteration of a model. The results are written to this ModelRunner's in-memory cache unless this model is the "best model" for the job. If this model is the "best model", the predictions are written out to a permanent store via a predi...
def _writePrediction(self, result): """ Writes the results of one iteration of a model. The results are written to this ModelRunner's in-memory cache unless this model is the "best model" for the job. If this model is the "best model", the predictions are written out to a permanent store via a predi...
[ "Writes", "the", "results", "of", "one", "iteration", "of", "a", "model", ".", "The", "results", "are", "written", "to", "this", "ModelRunner", "s", "in", "-", "memory", "cache", "unless", "this", "model", "is", "the", "best", "model", "for", "the", "job...
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/swarming/ModelRunner.py#L764-L780
[ "def", "_writePrediction", "(", "self", ",", "result", ")", ":", "self", ".", "__predictionCache", ".", "append", "(", "result", ")", "if", "self", ".", "_isBestModel", ":", "self", ".", "__flushPredictionCache", "(", ")" ]
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
OPFModelRunner.__flushPredictionCache
Writes the contents of this model's in-memory prediction cache to a permanent store via the prediction output stream instance
src/nupic/swarming/ModelRunner.py
def __flushPredictionCache(self): """ Writes the contents of this model's in-memory prediction cache to a permanent store via the prediction output stream instance """ if not self.__predictionCache: return # Create an output store, if one doesn't exist already if self._predictionLogg...
def __flushPredictionCache(self): """ Writes the contents of this model's in-memory prediction cache to a permanent store via the prediction output stream instance """ if not self.__predictionCache: return # Create an output store, if one doesn't exist already if self._predictionLogg...
[ "Writes", "the", "contents", "of", "this", "model", "s", "in", "-", "memory", "prediction", "cache", "to", "a", "permanent", "store", "via", "the", "prediction", "output", "stream", "instance" ]
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/swarming/ModelRunner.py#L794-L812
[ "def", "__flushPredictionCache", "(", "self", ")", ":", "if", "not", "self", ".", "__predictionCache", ":", "return", "# Create an output store, if one doesn't exist already", "if", "self", ".", "_predictionLogger", "is", "None", ":", "self", ".", "_createPredictionLogg...
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
OPFModelRunner.__deleteOutputCache
Delete's the output cache associated with the given modelID. This actually clears up the resources associated with the cache, rather than deleting al the records in the cache Parameters: ----------------------------------------------------------------------- modelID: The id of the model whose ...
src/nupic/swarming/ModelRunner.py
def __deleteOutputCache(self, modelID): """ Delete's the output cache associated with the given modelID. This actually clears up the resources associated with the cache, rather than deleting al the records in the cache Parameters: ----------------------------------------------------------------...
def __deleteOutputCache(self, modelID): """ Delete's the output cache associated with the given modelID. This actually clears up the resources associated with the cache, rather than deleting al the records in the cache Parameters: ----------------------------------------------------------------...
[ "Delete", "s", "the", "output", "cache", "associated", "with", "the", "given", "modelID", ".", "This", "actually", "clears", "up", "the", "resources", "associated", "with", "the", "cache", "rather", "than", "deleting", "al", "the", "records", "in", "the", "c...
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/swarming/ModelRunner.py#L815-L832
[ "def", "__deleteOutputCache", "(", "self", ",", "modelID", ")", ":", "# If this is our output, we should close the connection", "if", "modelID", "==", "self", ".", "_modelID", "and", "self", ".", "_predictionLogger", "is", "not", "None", ":", "self", ".", "_predicti...
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
OPFModelRunner._initPeriodicActivities
Creates and returns a PeriodicActivityMgr instance initialized with our periodic activities Parameters: ------------------------------------------------------------------------- retval: a PeriodicActivityMgr instance
src/nupic/swarming/ModelRunner.py
def _initPeriodicActivities(self): """ Creates and returns a PeriodicActivityMgr instance initialized with our periodic activities Parameters: ------------------------------------------------------------------------- retval: a PeriodicActivityMgr instance """ # Activity to upda...
def _initPeriodicActivities(self): """ Creates and returns a PeriodicActivityMgr instance initialized with our periodic activities Parameters: ------------------------------------------------------------------------- retval: a PeriodicActivityMgr instance """ # Activity to upda...
[ "Creates", "and", "returns", "a", "PeriodicActivityMgr", "instance", "initialized", "with", "our", "periodic", "activities" ]
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/swarming/ModelRunner.py#L835-L878
[ "def", "_initPeriodicActivities", "(", "self", ")", ":", "# Activity to update the metrics for this model", "# in the models table", "updateModelDBResults", "=", "PeriodicActivityRequest", "(", "repeating", "=", "True", ",", "period", "=", "100", ",", "cb", "=", "self", ...
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
OPFModelRunner.__checkCancelation
Check if the cancelation flag has been set for this model in the Model DB
src/nupic/swarming/ModelRunner.py
def __checkCancelation(self): """ Check if the cancelation flag has been set for this model in the Model DB""" # Update a hadoop job counter at least once every 600 seconds so it doesn't # think our map task is dead print >>sys.stderr, "reporter:counter:HypersearchWorker,numRecords,50" # See ...
def __checkCancelation(self): """ Check if the cancelation flag has been set for this model in the Model DB""" # Update a hadoop job counter at least once every 600 seconds so it doesn't # think our map task is dead print >>sys.stderr, "reporter:counter:HypersearchWorker,numRecords,50" # See ...
[ "Check", "if", "the", "cancelation", "flag", "has", "been", "set", "for", "this", "model", "in", "the", "Model", "DB" ]
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/swarming/ModelRunner.py#L881-L913
[ "def", "__checkCancelation", "(", "self", ")", ":", "# Update a hadoop job counter at least once every 600 seconds so it doesn't", "# think our map task is dead", "print", ">>", "sys", ".", "stderr", ",", "\"reporter:counter:HypersearchWorker,numRecords,50\"", "# See if the job got ca...
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
OPFModelRunner.__checkMaturity
Save the current metric value and see if the model's performance has 'leveled off.' We do this by looking at some number of previous number of recordings
src/nupic/swarming/ModelRunner.py
def __checkMaturity(self): """ Save the current metric value and see if the model's performance has 'leveled off.' We do this by looking at some number of previous number of recordings """ if self._currentRecordIndex+1 < self._MIN_RECORDS_TO_BE_BEST: return # If we are already mature, don't ...
def __checkMaturity(self): """ Save the current metric value and see if the model's performance has 'leveled off.' We do this by looking at some number of previous number of recordings """ if self._currentRecordIndex+1 < self._MIN_RECORDS_TO_BE_BEST: return # If we are already mature, don't ...
[ "Save", "the", "current", "metric", "value", "and", "see", "if", "the", "model", "s", "performance", "has", "leveled", "off", ".", "We", "do", "this", "by", "looking", "at", "some", "number", "of", "previous", "number", "of", "recordings" ]
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/swarming/ModelRunner.py#L916-L950
[ "def", "__checkMaturity", "(", "self", ")", ":", "if", "self", ".", "_currentRecordIndex", "+", "1", "<", "self", ".", "_MIN_RECORDS_TO_BE_BEST", ":", "return", "# If we are already mature, don't need to check anything", "if", "self", ".", "_isMature", ":", "return", ...
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
OPFModelRunner.__setAsOrphaned
Sets the current model as orphaned. This is called when the scheduler is about to kill the process to reallocate the worker to a different process.
src/nupic/swarming/ModelRunner.py
def __setAsOrphaned(self): """ Sets the current model as orphaned. This is called when the scheduler is about to kill the process to reallocate the worker to a different process. """ cmplReason = ClientJobsDAO.CMPL_REASON_ORPHAN cmplMessage = "Killed by Scheduler" self._jobsDAO.modelSetCompl...
def __setAsOrphaned(self): """ Sets the current model as orphaned. This is called when the scheduler is about to kill the process to reallocate the worker to a different process. """ cmplReason = ClientJobsDAO.CMPL_REASON_ORPHAN cmplMessage = "Killed by Scheduler" self._jobsDAO.modelSetCompl...
[ "Sets", "the", "current", "model", "as", "orphaned", ".", "This", "is", "called", "when", "the", "scheduler", "is", "about", "to", "kill", "the", "process", "to", "reallocate", "the", "worker", "to", "a", "different", "process", "." ]
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/swarming/ModelRunner.py#L968-L975
[ "def", "__setAsOrphaned", "(", "self", ")", ":", "cmplReason", "=", "ClientJobsDAO", ".", "CMPL_REASON_ORPHAN", "cmplMessage", "=", "\"Killed by Scheduler\"", "self", ".", "_jobsDAO", ".", "modelSetCompleted", "(", "self", ".", "_modelID", ",", "cmplReason", ",", ...
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
HsState.readStateFromDB
Set our state to that obtained from the engWorkerState field of the job record. Parameters: --------------------------------------------------------------------- stateJSON: JSON encoded state from job record
src/nupic/swarming/hypersearch/hs_state.py
def readStateFromDB(self): """Set our state to that obtained from the engWorkerState field of the job record. Parameters: --------------------------------------------------------------------- stateJSON: JSON encoded state from job record """ self._priorStateJSON = self._hsObj._cjDAO.jo...
def readStateFromDB(self): """Set our state to that obtained from the engWorkerState field of the job record. Parameters: --------------------------------------------------------------------- stateJSON: JSON encoded state from job record """ self._priorStateJSON = self._hsObj._cjDAO.jo...
[ "Set", "our", "state", "to", "that", "obtained", "from", "the", "engWorkerState", "field", "of", "the", "job", "record", "." ]
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/swarming/hypersearch/hs_state.py#L106-L229
[ "def", "readStateFromDB", "(", "self", ")", ":", "self", ".", "_priorStateJSON", "=", "self", ".", "_hsObj", ".", "_cjDAO", ".", "jobGetFields", "(", "self", ".", "_hsObj", ".", "_jobID", ",", "[", "'engWorkerState'", "]", ")", "[", "0", "]", "# Init if ...
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
HsState.writeStateToDB
Update the state in the job record with our local changes (if any). If we don't have the latest state in our priorStateJSON, then re-load in the latest state and return False. If we were successful writing out our changes, return True Parameters: ----------------------------------------------------...
src/nupic/swarming/hypersearch/hs_state.py
def writeStateToDB(self): """Update the state in the job record with our local changes (if any). If we don't have the latest state in our priorStateJSON, then re-load in the latest state and return False. If we were successful writing out our changes, return True Parameters: -------------------...
def writeStateToDB(self): """Update the state in the job record with our local changes (if any). If we don't have the latest state in our priorStateJSON, then re-load in the latest state and return False. If we were successful writing out our changes, return True Parameters: -------------------...
[ "Update", "the", "state", "in", "the", "job", "record", "with", "our", "local", "changes", "(", "if", "any", ")", ".", "If", "we", "don", "t", "have", "the", "latest", "state", "in", "our", "priorStateJSON", "then", "re", "-", "load", "in", "the", "l...
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/swarming/hypersearch/hs_state.py#L231-L270
[ "def", "writeStateToDB", "(", "self", ")", ":", "# If no changes, do nothing", "if", "not", "self", ".", "_dirty", ":", "return", "True", "# Set the update time", "self", ".", "_state", "[", "'lastUpdateTime'", "]", "=", "time", ".", "time", "(", ")", "newStat...
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
HsState.getFieldContributions
Return the field contributions statistics. Parameters: --------------------------------------------------------------------- retval: Dictionary where the keys are the field names and the values are how much each field contributed to the best score.
src/nupic/swarming/hypersearch/hs_state.py
def getFieldContributions(self): """Return the field contributions statistics. Parameters: --------------------------------------------------------------------- retval: Dictionary where the keys are the field names and the values are how much each field contributed to the best score. ...
def getFieldContributions(self): """Return the field contributions statistics. Parameters: --------------------------------------------------------------------- retval: Dictionary where the keys are the field names and the values are how much each field contributed to the best score. ...
[ "Return", "the", "field", "contributions", "statistics", "." ]
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/swarming/hypersearch/hs_state.py#L297-L389
[ "def", "getFieldContributions", "(", "self", ")", ":", "#in the fast swarm, there is only 1 sprint and field contributions are", "#not defined", "if", "self", ".", "_hsObj", ".", "_fixedFields", "is", "not", "None", ":", "return", "dict", "(", ")", ",", "dict", "(", ...
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
HsState.getAllSwarms
Return the list of all swarms in the given sprint. Parameters: --------------------------------------------------------------------- retval: list of active swarm Ids in the given sprint
src/nupic/swarming/hypersearch/hs_state.py
def getAllSwarms(self, sprintIdx): """Return the list of all swarms in the given sprint. Parameters: --------------------------------------------------------------------- retval: list of active swarm Ids in the given sprint """ swarmIds = [] for swarmId, info in self._state['swarms'].iter...
def getAllSwarms(self, sprintIdx): """Return the list of all swarms in the given sprint. Parameters: --------------------------------------------------------------------- retval: list of active swarm Ids in the given sprint """ swarmIds = [] for swarmId, info in self._state['swarms'].iter...
[ "Return", "the", "list", "of", "all", "swarms", "in", "the", "given", "sprint", "." ]
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/swarming/hypersearch/hs_state.py#L392-L404
[ "def", "getAllSwarms", "(", "self", ",", "sprintIdx", ")", ":", "swarmIds", "=", "[", "]", "for", "swarmId", ",", "info", "in", "self", ".", "_state", "[", "'swarms'", "]", ".", "iteritems", "(", ")", ":", "if", "info", "[", "'sprintIdx'", "]", "==",...
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
HsState.getCompletedSwarms
Return the list of all completed swarms. Parameters: --------------------------------------------------------------------- retval: list of active swarm Ids
src/nupic/swarming/hypersearch/hs_state.py
def getCompletedSwarms(self): """Return the list of all completed swarms. Parameters: --------------------------------------------------------------------- retval: list of active swarm Ids """ swarmIds = [] for swarmId, info in self._state['swarms'].iteritems(): if info['status'] ==...
def getCompletedSwarms(self): """Return the list of all completed swarms. Parameters: --------------------------------------------------------------------- retval: list of active swarm Ids """ swarmIds = [] for swarmId, info in self._state['swarms'].iteritems(): if info['status'] ==...
[ "Return", "the", "list", "of", "all", "completed", "swarms", "." ]
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/swarming/hypersearch/hs_state.py#L442-L454
[ "def", "getCompletedSwarms", "(", "self", ")", ":", "swarmIds", "=", "[", "]", "for", "swarmId", ",", "info", "in", "self", ".", "_state", "[", "'swarms'", "]", ".", "iteritems", "(", ")", ":", "if", "info", "[", "'status'", "]", "==", "'completed'", ...
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
HsState.getCompletingSwarms
Return the list of all completing swarms. Parameters: --------------------------------------------------------------------- retval: list of active swarm Ids
src/nupic/swarming/hypersearch/hs_state.py
def getCompletingSwarms(self): """Return the list of all completing swarms. Parameters: --------------------------------------------------------------------- retval: list of active swarm Ids """ swarmIds = [] for swarmId, info in self._state['swarms'].iteritems(): if info['status'] ...
def getCompletingSwarms(self): """Return the list of all completing swarms. Parameters: --------------------------------------------------------------------- retval: list of active swarm Ids """ swarmIds = [] for swarmId, info in self._state['swarms'].iteritems(): if info['status'] ...
[ "Return", "the", "list", "of", "all", "completing", "swarms", "." ]
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/swarming/hypersearch/hs_state.py#L456-L468
[ "def", "getCompletingSwarms", "(", "self", ")", ":", "swarmIds", "=", "[", "]", "for", "swarmId", ",", "info", "in", "self", ".", "_state", "[", "'swarms'", "]", ".", "iteritems", "(", ")", ":", "if", "info", "[", "'status'", "]", "==", "'completing'",...
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
HsState.bestModelInSprint
Return the best model ID and it's errScore from the given sprint, which may still be in progress. This returns the best score from all models in the sprint which have matured so far. Parameters: --------------------------------------------------------------------- retval: (modelId, errScore)
src/nupic/swarming/hypersearch/hs_state.py
def bestModelInSprint(self, sprintIdx): """Return the best model ID and it's errScore from the given sprint, which may still be in progress. This returns the best score from all models in the sprint which have matured so far. Parameters: -------------------------------------------------------------...
def bestModelInSprint(self, sprintIdx): """Return the best model ID and it's errScore from the given sprint, which may still be in progress. This returns the best score from all models in the sprint which have matured so far. Parameters: -------------------------------------------------------------...
[ "Return", "the", "best", "model", "ID", "and", "it", "s", "errScore", "from", "the", "given", "sprint", "which", "may", "still", "be", "in", "progress", ".", "This", "returns", "the", "best", "score", "from", "all", "models", "in", "the", "sprint", "whic...
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/swarming/hypersearch/hs_state.py#L494-L515
[ "def", "bestModelInSprint", "(", "self", ",", "sprintIdx", ")", ":", "# Get all the swarms in this sprint", "swarms", "=", "self", ".", "getAllSwarms", "(", "sprintIdx", ")", "# Get the best model and score from each swarm", "bestModelId", "=", "None", "bestErrScore", "="...
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
HsState.setSwarmState
Change the given swarm's state to 'newState'. If 'newState' is 'completed', then bestModelId and bestErrScore must be provided. Parameters: --------------------------------------------------------------------- swarmId: swarm Id newStatus: new status, either 'active', 'completing', 'complete...
src/nupic/swarming/hypersearch/hs_state.py
def setSwarmState(self, swarmId, newStatus): """Change the given swarm's state to 'newState'. If 'newState' is 'completed', then bestModelId and bestErrScore must be provided. Parameters: --------------------------------------------------------------------- swarmId: swarm Id newStatus: ...
def setSwarmState(self, swarmId, newStatus): """Change the given swarm's state to 'newState'. If 'newState' is 'completed', then bestModelId and bestErrScore must be provided. Parameters: --------------------------------------------------------------------- swarmId: swarm Id newStatus: ...
[ "Change", "the", "given", "swarm", "s", "state", "to", "newState", ".", "If", "newState", "is", "completed", "then", "bestModelId", "and", "bestErrScore", "must", "be", "provided", "." ]
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/swarming/hypersearch/hs_state.py#L517-L618
[ "def", "setSwarmState", "(", "self", ",", "swarmId", ",", "newStatus", ")", ":", "assert", "(", "newStatus", "in", "[", "'active'", ",", "'completing'", ",", "'completed'", ",", "'killed'", "]", ")", "# Set the swarm status", "swarmInfo", "=", "self", ".", "...
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
HsState.anyGoodSprintsActive
Return True if there are any more good sprints still being explored. A 'good' sprint is one that is earlier than where we detected an increase in error from sprint to subsequent sprint.
src/nupic/swarming/hypersearch/hs_state.py
def anyGoodSprintsActive(self): """Return True if there are any more good sprints still being explored. A 'good' sprint is one that is earlier than where we detected an increase in error from sprint to subsequent sprint. """ if self._state['lastGoodSprint'] is not None: goodSprints = self._sta...
def anyGoodSprintsActive(self): """Return True if there are any more good sprints still being explored. A 'good' sprint is one that is earlier than where we detected an increase in error from sprint to subsequent sprint. """ if self._state['lastGoodSprint'] is not None: goodSprints = self._sta...
[ "Return", "True", "if", "there", "are", "any", "more", "good", "sprints", "still", "being", "explored", ".", "A", "good", "sprint", "is", "one", "that", "is", "earlier", "than", "where", "we", "detected", "an", "increase", "in", "error", "from", "sprint", ...
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/swarming/hypersearch/hs_state.py#L620-L637
[ "def", "anyGoodSprintsActive", "(", "self", ")", ":", "if", "self", ".", "_state", "[", "'lastGoodSprint'", "]", "is", "not", "None", ":", "goodSprints", "=", "self", ".", "_state", "[", "'sprints'", "]", "[", "0", ":", "self", ".", "_state", "[", "'la...
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
HsState.isSprintCompleted
Return True if the given sprint has completed.
src/nupic/swarming/hypersearch/hs_state.py
def isSprintCompleted(self, sprintIdx): """Return True if the given sprint has completed.""" numExistingSprints = len(self._state['sprints']) if sprintIdx >= numExistingSprints: return False return (self._state['sprints'][sprintIdx]['status'] == 'completed')
def isSprintCompleted(self, sprintIdx): """Return True if the given sprint has completed.""" numExistingSprints = len(self._state['sprints']) if sprintIdx >= numExistingSprints: return False return (self._state['sprints'][sprintIdx]['status'] == 'completed')
[ "Return", "True", "if", "the", "given", "sprint", "has", "completed", "." ]
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/swarming/hypersearch/hs_state.py#L639-L645
[ "def", "isSprintCompleted", "(", "self", ",", "sprintIdx", ")", ":", "numExistingSprints", "=", "len", "(", "self", ".", "_state", "[", "'sprints'", "]", ")", "if", "sprintIdx", ">=", "numExistingSprints", ":", "return", "False", "return", "(", "self", ".", ...
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
HsState.killUselessSwarms
See if we can kill off some speculative swarms. If an earlier sprint has finally completed, we can now tell which fields should *really* be present in the sprints we've already started due to speculation, and kill off the swarms that should not have been included.
src/nupic/swarming/hypersearch/hs_state.py
def killUselessSwarms(self): """See if we can kill off some speculative swarms. If an earlier sprint has finally completed, we can now tell which fields should *really* be present in the sprints we've already started due to speculation, and kill off the swarms that should not have been included. """...
def killUselessSwarms(self): """See if we can kill off some speculative swarms. If an earlier sprint has finally completed, we can now tell which fields should *really* be present in the sprints we've already started due to speculation, and kill off the swarms that should not have been included. """...
[ "See", "if", "we", "can", "kill", "off", "some", "speculative", "swarms", ".", "If", "an", "earlier", "sprint", "has", "finally", "completed", "we", "can", "now", "tell", "which", "fields", "should", "*", "really", "*", "be", "present", "in", "the", "spr...
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/swarming/hypersearch/hs_state.py#L647-L751
[ "def", "killUselessSwarms", "(", "self", ")", ":", "# Get number of existing sprints", "numExistingSprints", "=", "len", "(", "self", ".", "_state", "[", "'sprints'", "]", ")", "# Should we bother killing useless swarms?", "if", "self", ".", "_hsObj", ".", "_searchTyp...
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
HsState.isSprintActive
If the given sprint exists and is active, return active=True. If the sprint does not exist yet, this call will create it (and return active=True). If it already exists, but is completing or complete, return active=False. If sprintIdx is past the end of the possible sprints, return active=False, ...
src/nupic/swarming/hypersearch/hs_state.py
def isSprintActive(self, sprintIdx): """If the given sprint exists and is active, return active=True. If the sprint does not exist yet, this call will create it (and return active=True). If it already exists, but is completing or complete, return active=False. If sprintIdx is past the end of the p...
def isSprintActive(self, sprintIdx): """If the given sprint exists and is active, return active=True. If the sprint does not exist yet, this call will create it (and return active=True). If it already exists, but is completing or complete, return active=False. If sprintIdx is past the end of the p...
[ "If", "the", "given", "sprint", "exists", "and", "is", "active", "return", "active", "=", "True", "." ]
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/swarming/hypersearch/hs_state.py#L753-L1022
[ "def", "isSprintActive", "(", "self", ",", "sprintIdx", ")", ":", "while", "True", ":", "numExistingSprints", "=", "len", "(", "self", ".", "_state", "[", "'sprints'", "]", ")", "# If this sprint already exists, see if it is active", "if", "sprintIdx", "<=", "numE...
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
MultiEncoder.addEncoder
Adds one encoder. :param name: (string) name of encoder, should be unique :param encoder: (:class:`.Encoder`) the encoder to add
src/nupic/encoders/multi.py
def addEncoder(self, name, encoder): """ Adds one encoder. :param name: (string) name of encoder, should be unique :param encoder: (:class:`.Encoder`) the encoder to add """ self.encoders.append((name, encoder, self.width)) for d in encoder.getDescription(): self.description.append((d...
def addEncoder(self, name, encoder): """ Adds one encoder. :param name: (string) name of encoder, should be unique :param encoder: (:class:`.Encoder`) the encoder to add """ self.encoders.append((name, encoder, self.width)) for d in encoder.getDescription(): self.description.append((d...
[ "Adds", "one", "encoder", "." ]
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/encoders/multi.py#L90-L100
[ "def", "addEncoder", "(", "self", ",", "name", ",", "encoder", ")", ":", "self", ".", "encoders", ".", "append", "(", "(", "name", ",", "encoder", ",", "self", ".", "width", ")", ")", "for", "d", "in", "encoder", ".", "getDescription", "(", ")", ":...
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
Spec.invariant
Verify the validity of the node spec object The type of each sub-object is verified and then the validity of each node spec item is verified by calling it invariant() method. It also makes sure that there is at most one default input and one default output.
src/nupic/regions/spec.py
def invariant(self): """Verify the validity of the node spec object The type of each sub-object is verified and then the validity of each node spec item is verified by calling it invariant() method. It also makes sure that there is at most one default input and one default output. """ # Ver...
def invariant(self): """Verify the validity of the node spec object The type of each sub-object is verified and then the validity of each node spec item is verified by calling it invariant() method. It also makes sure that there is at most one default input and one default output. """ # Ver...
[ "Verify", "the", "validity", "of", "the", "node", "spec", "object" ]
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/regions/spec.py#L152-L198
[ "def", "invariant", "(", "self", ")", ":", "# Verify the description and singleNodeOnly attributes", "assert", "isinstance", "(", "self", ".", "description", ",", "str", ")", "assert", "isinstance", "(", "self", ".", "singleNodeOnly", ",", "bool", ")", "# Make sure ...
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
Spec.toDict
Convert the information of the node spec to a plain dict of basic types The description and singleNodeOnly attributes are placed directly in the result dicts. The inputs, outputs, parameters and commands dicts contain Spec item objects (InputSpec, OutputSpec, etc). Each such object is converted also to...
src/nupic/regions/spec.py
def toDict(self): """Convert the information of the node spec to a plain dict of basic types The description and singleNodeOnly attributes are placed directly in the result dicts. The inputs, outputs, parameters and commands dicts contain Spec item objects (InputSpec, OutputSpec, etc). Each such object...
def toDict(self): """Convert the information of the node spec to a plain dict of basic types The description and singleNodeOnly attributes are placed directly in the result dicts. The inputs, outputs, parameters and commands dicts contain Spec item objects (InputSpec, OutputSpec, etc). Each such object...
[ "Convert", "the", "information", "of", "the", "node", "spec", "to", "a", "plain", "dict", "of", "basic", "types" ]
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/regions/spec.py#L200-L228
[ "def", "toDict", "(", "self", ")", ":", "def", "items2dict", "(", "items", ")", ":", "\"\"\"Convert a dict of node spec items to a plain dict\n\n Each node spec item object will be converted to a dict of its\n attributes. The entire items dict will become a dict of dicts (same keys...
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
ModelChooser.updateResultsForJob
Chooses the best model for a given job. Parameters ----------------------------------------------------------------------- forceUpdate: (True/False). If True, the update will ignore all the restrictions on the minimum time to update and the minimum number of records to ...
src/nupic/swarming/model_chooser.py
def updateResultsForJob(self, forceUpdate=True): """ Chooses the best model for a given job. Parameters ----------------------------------------------------------------------- forceUpdate: (True/False). If True, the update will ignore all the restrictions on the minimum time to updat...
def updateResultsForJob(self, forceUpdate=True): """ Chooses the best model for a given job. Parameters ----------------------------------------------------------------------- forceUpdate: (True/False). If True, the update will ignore all the restrictions on the minimum time to updat...
[ "Chooses", "the", "best", "model", "for", "a", "given", "job", "." ]
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/swarming/model_chooser.py#L66-L111
[ "def", "updateResultsForJob", "(", "self", ",", "forceUpdate", "=", "True", ")", ":", "updateInterval", "=", "time", ".", "time", "(", ")", "-", "self", ".", "_lastUpdateAttemptTime", "if", "updateInterval", "<", "self", ".", "_MIN_UPDATE_INTERVAL", "and", "no...
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
createEncoder
Create the encoder instance for our test and return it.
examples/network/network_api_demo.py
def createEncoder(): """Create the encoder instance for our test and return it.""" consumption_encoder = ScalarEncoder(21, 0.0, 100.0, n=50, name="consumption", clipInput=True) time_encoder = DateEncoder(timeOfDay=(21, 9.5), name="timestamp_timeOfDay") encoder = MultiEncoder() encoder.addEncoder("consu...
def createEncoder(): """Create the encoder instance for our test and return it.""" consumption_encoder = ScalarEncoder(21, 0.0, 100.0, n=50, name="consumption", clipInput=True) time_encoder = DateEncoder(timeOfDay=(21, 9.5), name="timestamp_timeOfDay") encoder = MultiEncoder() encoder.addEncoder("consu...
[ "Create", "the", "encoder", "instance", "for", "our", "test", "and", "return", "it", "." ]
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/examples/network/network_api_demo.py#L84-L94
[ "def", "createEncoder", "(", ")", ":", "consumption_encoder", "=", "ScalarEncoder", "(", "21", ",", "0.0", ",", "100.0", ",", "n", "=", "50", ",", "name", "=", "\"consumption\"", ",", "clipInput", "=", "True", ")", "time_encoder", "=", "DateEncoder", "(", ...
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
createNetwork
Create the Network instance. The network has a sensor region reading data from `dataSource` and passing the encoded representation to an SPRegion. The SPRegion output is passed to a TMRegion. :param dataSource: a RecordStream instance to get data from :returns: a Network instance ready to run
examples/network/network_api_demo.py
def createNetwork(dataSource): """Create the Network instance. The network has a sensor region reading data from `dataSource` and passing the encoded representation to an SPRegion. The SPRegion output is passed to a TMRegion. :param dataSource: a RecordStream instance to get data from :returns: a Network ...
def createNetwork(dataSource): """Create the Network instance. The network has a sensor region reading data from `dataSource` and passing the encoded representation to an SPRegion. The SPRegion output is passed to a TMRegion. :param dataSource: a RecordStream instance to get data from :returns: a Network ...
[ "Create", "the", "Network", "instance", "." ]
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/examples/network/network_api_demo.py#L98-L172
[ "def", "createNetwork", "(", "dataSource", ")", ":", "network", "=", "Network", "(", ")", "# Our input is sensor data from the gym file. The RecordSensor region", "# allows us to specify a file record stream as the input source via the", "# dataSource attribute.", "network", ".", "ad...
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
runNetwork
Run the network and write output to writer. :param network: a Network instance to run :param writer: a csv.writer instance to write output to
examples/network/network_api_demo.py
def runNetwork(network, writer): """Run the network and write output to writer. :param network: a Network instance to run :param writer: a csv.writer instance to write output to """ sensorRegion = network.regions["sensor"] spatialPoolerRegion = network.regions["spatialPoolerRegion"] temporalPoolerRegion ...
def runNetwork(network, writer): """Run the network and write output to writer. :param network: a Network instance to run :param writer: a csv.writer instance to write output to """ sensorRegion = network.regions["sensor"] spatialPoolerRegion = network.regions["spatialPoolerRegion"] temporalPoolerRegion ...
[ "Run", "the", "network", "and", "write", "output", "to", "writer", "." ]
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/examples/network/network_api_demo.py#L175-L197
[ "def", "runNetwork", "(", "network", ",", "writer", ")", ":", "sensorRegion", "=", "network", ".", "regions", "[", "\"sensor\"", "]", "spatialPoolerRegion", "=", "network", ".", "regions", "[", "\"spatialPoolerRegion\"", "]", "temporalPoolerRegion", "=", "network"...
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
ExperimentDescriptionAPI.__validateExperimentControl
Validates control dictionary for the experiment context
src/nupic/frameworks/opf/exp_description_api.py
def __validateExperimentControl(self, control): """ Validates control dictionary for the experiment context""" # Validate task list taskList = control.get('tasks', None) if taskList is not None: taskLabelsList = [] for task in taskList: validateOpfJsonValue(task, "opfTaskSchema.json...
def __validateExperimentControl(self, control): """ Validates control dictionary for the experiment context""" # Validate task list taskList = control.get('tasks', None) if taskList is not None: taskLabelsList = [] for task in taskList: validateOpfJsonValue(task, "opfTaskSchema.json...
[ "Validates", "control", "dictionary", "for", "the", "experiment", "context" ]
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/frameworks/opf/exp_description_api.py#L189-L213
[ "def", "__validateExperimentControl", "(", "self", ",", "control", ")", ":", "# Validate task list", "taskList", "=", "control", ".", "get", "(", "'tasks'", ",", "None", ")", "if", "taskList", "is", "not", "None", ":", "taskLabelsList", "=", "[", "]", "for",...
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
ExperimentDescriptionAPI.normalizeStreamSource
TODO: document :param stream:
src/nupic/frameworks/opf/exp_description_api.py
def normalizeStreamSource(self, stream): """ TODO: document :param stream: """ # The stream source in the task might be in several formats, so we need # to make sure it gets converted into an absolute path: source = stream['source'][len(FILE_SCHEME):] # If the source is already an absolu...
def normalizeStreamSource(self, stream): """ TODO: document :param stream: """ # The stream source in the task might be in several formats, so we need # to make sure it gets converted into an absolute path: source = stream['source'][len(FILE_SCHEME):] # If the source is already an absolu...
[ "TODO", ":", "document", ":", "param", "stream", ":" ]
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/frameworks/opf/exp_description_api.py#L221-L241
[ "def", "normalizeStreamSource", "(", "self", ",", "stream", ")", ":", "# The stream source in the task might be in several formats, so we need", "# to make sure it gets converted into an absolute path:", "source", "=", "stream", "[", "'source'", "]", "[", "len", "(", "FILE_SCHE...
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
ExperimentDescriptionAPI.normalizeStreamSources
TODO: document
src/nupic/frameworks/opf/exp_description_api.py
def normalizeStreamSources(self): """ TODO: document """ task = dict(self.__control) if 'dataset' in task: for stream in task['dataset']['streams']: self.normalizeStreamSource(stream) else: for subtask in task['tasks']: for stream in subtask['dataset']['streams']: ...
def normalizeStreamSources(self): """ TODO: document """ task = dict(self.__control) if 'dataset' in task: for stream in task['dataset']['streams']: self.normalizeStreamSource(stream) else: for subtask in task['tasks']: for stream in subtask['dataset']['streams']: ...
[ "TODO", ":", "document" ]
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/frameworks/opf/exp_description_api.py#L244-L255
[ "def", "normalizeStreamSources", "(", "self", ")", ":", "task", "=", "dict", "(", "self", ".", "__control", ")", "if", "'dataset'", "in", "task", ":", "for", "stream", "in", "task", "[", "'dataset'", "]", "[", "'streams'", "]", ":", "self", ".", "norma...
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
ExperimentDescriptionAPI.convertNupicEnvToOPF
TODO: document
src/nupic/frameworks/opf/exp_description_api.py
def convertNupicEnvToOPF(self): """ TODO: document """ # We need to create a task structure, most of which is taken verbatim # from the Nupic control dict task = dict(self.__control) task.pop('environment') inferenceArgs = task.pop('inferenceArgs') task['taskLabel'] = 'DefaultTask'...
def convertNupicEnvToOPF(self): """ TODO: document """ # We need to create a task structure, most of which is taken verbatim # from the Nupic control dict task = dict(self.__control) task.pop('environment') inferenceArgs = task.pop('inferenceArgs') task['taskLabel'] = 'DefaultTask'...
[ "TODO", ":", "document" ]
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/frameworks/opf/exp_description_api.py#L258-L294
[ "def", "convertNupicEnvToOPF", "(", "self", ")", ":", "# We need to create a task structure, most of which is taken verbatim", "# from the Nupic control dict", "task", "=", "dict", "(", "self", ".", "__control", ")", "task", ".", "pop", "(", "'environment'", ")", "inferen...
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
createNetwork
Create the Network instance. The network has a sensor region reading data from `dataSource` and passing the encoded representation to an Identity Region. :param dataSource: a RecordStream instance to get data from :returns: a Network instance ready to run
examples/network/custom_region_demo.py
def createNetwork(dataSource): """Create the Network instance. The network has a sensor region reading data from `dataSource` and passing the encoded representation to an Identity Region. :param dataSource: a RecordStream instance to get data from :returns: a Network instance ready to run """ network = ...
def createNetwork(dataSource): """Create the Network instance. The network has a sensor region reading data from `dataSource` and passing the encoded representation to an Identity Region. :param dataSource: a RecordStream instance to get data from :returns: a Network instance ready to run """ network = ...
[ "Create", "the", "Network", "instance", "." ]
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/examples/network/custom_region_demo.py#L57-L103
[ "def", "createNetwork", "(", "dataSource", ")", ":", "network", "=", "Network", "(", ")", "# Our input is sensor data from the gym file. The RecordSensor region", "# allows us to specify a file record stream as the input source via the", "# dataSource attribute.", "network", ".", "ad...
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
runNetwork
Run the network and write output to writer. :param network: a Network instance to run :param writer: a csv.writer instance to write output to
examples/network/custom_region_demo.py
def runNetwork(network, writer): """Run the network and write output to writer. :param network: a Network instance to run :param writer: a csv.writer instance to write output to """ identityRegion = network.regions["identityRegion"] for i in xrange(_NUM_RECORDS): # Run the network for a single iterati...
def runNetwork(network, writer): """Run the network and write output to writer. :param network: a Network instance to run :param writer: a csv.writer instance to write output to """ identityRegion = network.regions["identityRegion"] for i in xrange(_NUM_RECORDS): # Run the network for a single iterati...
[ "Run", "the", "network", "and", "write", "output", "to", "writer", "." ]
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/examples/network/custom_region_demo.py#L106-L120
[ "def", "runNetwork", "(", "network", ",", "writer", ")", ":", "identityRegion", "=", "network", ".", "regions", "[", "\"identityRegion\"", "]", "for", "i", "in", "xrange", "(", "_NUM_RECORDS", ")", ":", "# Run the network for a single iteration", "network", ".", ...
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
_appendReportKeys
Generate a set of possible report keys for an experiment's results. A report key is a string of key names separated by colons, each key being one level deeper into the experiment results dict. For example, 'key1:key2'. This routine is called recursively to build keys that are multiple levels deep from the resu...
src/nupic/swarming/utils.py
def _appendReportKeys(keys, prefix, results): """ Generate a set of possible report keys for an experiment's results. A report key is a string of key names separated by colons, each key being one level deeper into the experiment results dict. For example, 'key1:key2'. This routine is called recursively to bu...
def _appendReportKeys(keys, prefix, results): """ Generate a set of possible report keys for an experiment's results. A report key is a string of key names separated by colons, each key being one level deeper into the experiment results dict. For example, 'key1:key2'. This routine is called recursively to bu...
[ "Generate", "a", "set", "of", "possible", "report", "keys", "for", "an", "experiment", "s", "results", ".", "A", "report", "key", "is", "a", "string", "of", "key", "names", "separated", "by", "colons", "each", "key", "being", "one", "level", "deeper", "i...
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/swarming/utils.py#L126-L149
[ "def", "_appendReportKeys", "(", "keys", ",", "prefix", ",", "results", ")", ":", "allKeys", "=", "results", ".", "keys", "(", ")", "allKeys", ".", "sort", "(", ")", "for", "key", "in", "allKeys", ":", "if", "hasattr", "(", "results", "[", "key", "]"...
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
_matchReportKeys
Extract all items from the 'allKeys' list whose key matches one of the regular expressions passed in 'reportKeys'. Parameters: ---------------------------------------------------------------------------- reportKeyREs: List of regular expressions allReportKeys: List of all keys retval: list ...
src/nupic/swarming/utils.py
def _matchReportKeys(reportKeyREs=[], allReportKeys=[]): """ Extract all items from the 'allKeys' list whose key matches one of the regular expressions passed in 'reportKeys'. Parameters: ---------------------------------------------------------------------------- reportKeyREs: List of regular expressi...
def _matchReportKeys(reportKeyREs=[], allReportKeys=[]): """ Extract all items from the 'allKeys' list whose key matches one of the regular expressions passed in 'reportKeys'. Parameters: ---------------------------------------------------------------------------- reportKeyREs: List of regular expressi...
[ "Extract", "all", "items", "from", "the", "allKeys", "list", "whose", "key", "matches", "one", "of", "the", "regular", "expressions", "passed", "in", "reportKeys", "." ]
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/swarming/utils.py#L162-L193
[ "def", "_matchReportKeys", "(", "reportKeyREs", "=", "[", "]", ",", "allReportKeys", "=", "[", "]", ")", ":", "matchingReportKeys", "=", "[", "]", "# Extract the report items of interest", "for", "keyRE", "in", "reportKeyREs", ":", "# Find all keys that match this reg...
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
_getReportItem
Get a specific item by name out of the results dict. The format of itemName is a string of dictionary keys separated by colons, each key being one level deeper into the results dict. For example, 'key1:key2' would fetch results['key1']['key2']. If itemName is not found in results, then None is returned
src/nupic/swarming/utils.py
def _getReportItem(itemName, results): """ Get a specific item by name out of the results dict. The format of itemName is a string of dictionary keys separated by colons, each key being one level deeper into the results dict. For example, 'key1:key2' would fetch results['key1']['key2']. If itemName is not...
def _getReportItem(itemName, results): """ Get a specific item by name out of the results dict. The format of itemName is a string of dictionary keys separated by colons, each key being one level deeper into the results dict. For example, 'key1:key2' would fetch results['key1']['key2']. If itemName is not...
[ "Get", "a", "specific", "item", "by", "name", "out", "of", "the", "results", "dict", "." ]
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/swarming/utils.py#L197-L214
[ "def", "_getReportItem", "(", "itemName", ",", "results", ")", ":", "subKeys", "=", "itemName", ".", "split", "(", "':'", ")", "subResults", "=", "results", "for", "subKey", "in", "subKeys", ":", "subResults", "=", "subResults", "[", "subKey", "]", "return...
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
filterResults
Given the complete set of results generated by an experiment (passed in 'results'), filter out and return only the ones the caller wants, as specified through 'reportKeys' and 'optimizeKey'. A report key is a string of key names separated by colons, each key being one level deeper into the experiment results d...
src/nupic/swarming/utils.py
def filterResults(allResults, reportKeys, optimizeKey=None): """ Given the complete set of results generated by an experiment (passed in 'results'), filter out and return only the ones the caller wants, as specified through 'reportKeys' and 'optimizeKey'. A report key is a string of key names separated by colo...
def filterResults(allResults, reportKeys, optimizeKey=None): """ Given the complete set of results generated by an experiment (passed in 'results'), filter out and return only the ones the caller wants, as specified through 'reportKeys' and 'optimizeKey'. A report key is a string of key names separated by colo...
[ "Given", "the", "complete", "set", "of", "results", "generated", "by", "an", "experiment", "(", "passed", "in", "results", ")", "filter", "out", "and", "return", "only", "the", "ones", "the", "caller", "wants", "as", "specified", "through", "reportKeys", "an...
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/swarming/utils.py#L218-L277
[ "def", "filterResults", "(", "allResults", ",", "reportKeys", ",", "optimizeKey", "=", "None", ")", ":", "# Init return values", "optimizeDict", "=", "dict", "(", ")", "# Get all available report key names for this experiment", "allReportKeys", "=", "set", "(", ")", "...
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
_handleModelRunnerException
Perform standard handling of an exception that occurs while running a model. Parameters: ------------------------------------------------------------------------- jobID: ID for this hypersearch job in the jobs table modelID: model ID jobsDAO: ClientJobsDAO instance ...
src/nupic/swarming/utils.py
def _handleModelRunnerException(jobID, modelID, jobsDAO, experimentDir, logger, e): """ Perform standard handling of an exception that occurs while running a model. Parameters: ------------------------------------------------------------------------- jobID: ID f...
def _handleModelRunnerException(jobID, modelID, jobsDAO, experimentDir, logger, e): """ Perform standard handling of an exception that occurs while running a model. Parameters: ------------------------------------------------------------------------- jobID: ID f...
[ "Perform", "standard", "handling", "of", "an", "exception", "that", "occurs", "while", "running", "a", "model", "." ]
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/swarming/utils.py#L293-L342
[ "def", "_handleModelRunnerException", "(", "jobID", ",", "modelID", ",", "jobsDAO", ",", "experimentDir", ",", "logger", ",", "e", ")", ":", "msg", "=", "StringIO", ".", "StringIO", "(", ")", "print", ">>", "msg", ",", "\"Exception occurred while running model %...
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
runModelGivenBaseAndParams
This creates an experiment directory with a base.py description file created from 'baseDescription' and a description.py generated from the given params dict and then runs the experiment. Parameters: ------------------------------------------------------------------------- modelID: ID for this m...
src/nupic/swarming/utils.py
def runModelGivenBaseAndParams(modelID, jobID, baseDescription, params, predictedField, reportKeys, optimizeKey, jobsDAO, modelCheckpointGUID, logLevel=None, predictionCacheMaxRecords=None): """ This creates an experiment directory with a base.py description file created from 'baseDescriptio...
def runModelGivenBaseAndParams(modelID, jobID, baseDescription, params, predictedField, reportKeys, optimizeKey, jobsDAO, modelCheckpointGUID, logLevel=None, predictionCacheMaxRecords=None): """ This creates an experiment directory with a base.py description file created from 'baseDescriptio...
[ "This", "creates", "an", "experiment", "directory", "with", "a", "base", ".", "py", "description", "file", "created", "from", "baseDescription", "and", "a", "description", ".", "py", "generated", "from", "the", "given", "params", "dict", "and", "then", "runs",...
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/swarming/utils.py#L346-L450
[ "def", "runModelGivenBaseAndParams", "(", "modelID", ",", "jobID", ",", "baseDescription", ",", "params", ",", "predictedField", ",", "reportKeys", ",", "optimizeKey", ",", "jobsDAO", ",", "modelCheckpointGUID", ",", "logLevel", "=", "None", ",", "predictionCacheMax...
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
rCopy
Recursively copies a dict and returns the result. Args: d: The dict to copy. f: A function to apply to values when copying that takes the value and the list of keys from the root of the dict to the value and returns a value for the new dict. discardNoneKeys: If True, discard key-value pai...
src/nupic/swarming/utils.py
def rCopy(d, f=identityConversion, discardNoneKeys=True, deepCopy=True): """Recursively copies a dict and returns the result. Args: d: The dict to copy. f: A function to apply to values when copying that takes the value and the list of keys from the root of the dict to the value and returns a value...
def rCopy(d, f=identityConversion, discardNoneKeys=True, deepCopy=True): """Recursively copies a dict and returns the result. Args: d: The dict to copy. f: A function to apply to values when copying that takes the value and the list of keys from the root of the dict to the value and returns a value...
[ "Recursively", "copies", "a", "dict", "and", "returns", "the", "result", "." ]
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/swarming/utils.py#L577-L610
[ "def", "rCopy", "(", "d", ",", "f", "=", "identityConversion", ",", "discardNoneKeys", "=", "True", ",", "deepCopy", "=", "True", ")", ":", "# Optionally deep copy the dict.", "if", "deepCopy", ":", "d", "=", "copy", ".", "deepcopy", "(", "d", ")", "newDic...
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
rApply
Recursively applies f to the values in dict d. Args: d: The dict to recurse over. f: A function to apply to values in d that takes the value and a list of keys from the root of the dict to the value.
src/nupic/swarming/utils.py
def rApply(d, f): """Recursively applies f to the values in dict d. Args: d: The dict to recurse over. f: A function to apply to values in d that takes the value and a list of keys from the root of the dict to the value. """ remainingDicts = [(d, ())] while len(remainingDicts) > 0: curren...
def rApply(d, f): """Recursively applies f to the values in dict d. Args: d: The dict to recurse over. f: A function to apply to values in d that takes the value and a list of keys from the root of the dict to the value. """ remainingDicts = [(d, ())] while len(remainingDicts) > 0: curren...
[ "Recursively", "applies", "f", "to", "the", "values", "in", "dict", "d", "." ]
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/swarming/utils.py#L614-L630
[ "def", "rApply", "(", "d", ",", "f", ")", ":", "remainingDicts", "=", "[", "(", "d", ",", "(", ")", ")", "]", "while", "len", "(", "remainingDicts", ")", ">", "0", ":", "current", ",", "prevKeys", "=", "remainingDicts", ".", "pop", "(", ")", "for...
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
clippedObj
Return a clipped version of obj suitable for printing, This is useful when generating log messages by printing data structures, but don't want the message to be too long. If passed in a dict, list, or namedtuple, each element of the structure's string representation will be limited to 'maxElementSize' characte...
src/nupic/swarming/utils.py
def clippedObj(obj, maxElementSize=64): """ Return a clipped version of obj suitable for printing, This is useful when generating log messages by printing data structures, but don't want the message to be too long. If passed in a dict, list, or namedtuple, each element of the structure's string representat...
def clippedObj(obj, maxElementSize=64): """ Return a clipped version of obj suitable for printing, This is useful when generating log messages by printing data structures, but don't want the message to be too long. If passed in a dict, list, or namedtuple, each element of the structure's string representat...
[ "Return", "a", "clipped", "version", "of", "obj", "suitable", "for", "printing", "This", "is", "useful", "when", "generating", "log", "messages", "by", "printing", "data", "structures", "but", "don", "t", "want", "the", "message", "to", "be", "too", "long", ...
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/swarming/utils.py#L634-L669
[ "def", "clippedObj", "(", "obj", ",", "maxElementSize", "=", "64", ")", ":", "# Is it a named tuple?", "if", "hasattr", "(", "obj", ",", "'_asdict'", ")", ":", "obj", "=", "obj", ".", "_asdict", "(", ")", "# Printing a dict?", "if", "isinstance", "(", "obj...
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
validate
Validate a python value against json schema: validate(value, schemaPath) validate(value, schemaDict) value: python object to validate against the schema The json schema may be specified either as a path of the file containing the json schema or as a python dictionary using one of the following ke...
src/nupic/swarming/utils.py
def validate(value, **kwds): """ Validate a python value against json schema: validate(value, schemaPath) validate(value, schemaDict) value: python object to validate against the schema The json schema may be specified either as a path of the file containing the json schema or as a python diction...
def validate(value, **kwds): """ Validate a python value against json schema: validate(value, schemaPath) validate(value, schemaDict) value: python object to validate against the schema The json schema may be specified either as a path of the file containing the json schema or as a python diction...
[ "Validate", "a", "python", "value", "against", "json", "schema", ":", "validate", "(", "value", "schemaPath", ")", "validate", "(", "value", "schemaDict", ")" ]
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/swarming/utils.py#L678-L710
[ "def", "validate", "(", "value", ",", "*", "*", "kwds", ")", ":", "assert", "len", "(", "kwds", ".", "keys", "(", ")", ")", ">=", "1", "assert", "'schemaPath'", "in", "kwds", "or", "'schemaDict'", "in", "kwds", "schemaDict", "=", "None", "if", "'sche...
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
loadJsonValueFromFile
Loads a json value from a file and converts it to the corresponding python object. inputFilePath: Path of the json file; Returns: python value that represents the loaded json value
src/nupic/swarming/utils.py
def loadJsonValueFromFile(inputFilePath): """ Loads a json value from a file and converts it to the corresponding python object. inputFilePath: Path of the json file; Returns: python value that represents the loaded json value """ with open(inputFilePath) as fileObj: ...
def loadJsonValueFromFile(inputFilePath): """ Loads a json value from a file and converts it to the corresponding python object. inputFilePath: Path of the json file; Returns: python value that represents the loaded json value """ with open(inputFilePath) as fileObj: ...
[ "Loads", "a", "json", "value", "from", "a", "file", "and", "converts", "it", "to", "the", "corresponding", "python", "object", "." ]
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/swarming/utils.py#L714-L728
[ "def", "loadJsonValueFromFile", "(", "inputFilePath", ")", ":", "with", "open", "(", "inputFilePath", ")", "as", "fileObj", ":", "value", "=", "json", ".", "load", "(", "fileObj", ")", "return", "value" ]
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
sortedJSONDumpS
Return a JSON representation of obj with sorted keys on any embedded dicts. This insures that the same object will always be represented by the same string even if it contains dicts (where the sort order of the keys is normally undefined).
src/nupic/swarming/utils.py
def sortedJSONDumpS(obj): """ Return a JSON representation of obj with sorted keys on any embedded dicts. This insures that the same object will always be represented by the same string even if it contains dicts (where the sort order of the keys is normally undefined). """ itemStrs = [] if isinstance(...
def sortedJSONDumpS(obj): """ Return a JSON representation of obj with sorted keys on any embedded dicts. This insures that the same object will always be represented by the same string even if it contains dicts (where the sort order of the keys is normally undefined). """ itemStrs = [] if isinstance(...
[ "Return", "a", "JSON", "representation", "of", "obj", "with", "sorted", "keys", "on", "any", "embedded", "dicts", ".", "This", "insures", "that", "the", "same", "object", "will", "always", "be", "represented", "by", "the", "same", "string", "even", "if", "...
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/swarming/utils.py#L732-L755
[ "def", "sortedJSONDumpS", "(", "obj", ")", ":", "itemStrs", "=", "[", "]", "if", "isinstance", "(", "obj", ",", "dict", ")", ":", "items", "=", "obj", ".", "items", "(", ")", "items", ".", "sort", "(", ")", "for", "key", ",", "value", "in", "item...
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
PeriodicActivityMgr.tick
Activity tick handler; services all activities Returns: True if controlling iterator says it's okay to keep going; False to stop
src/nupic/swarming/utils.py
def tick(self): """ Activity tick handler; services all activities Returns: True if controlling iterator says it's okay to keep going; False to stop """ # Run activities whose time has come for act in self.__activities: if not act.iteratorHolder[0]: continue ...
def tick(self): """ Activity tick handler; services all activities Returns: True if controlling iterator says it's okay to keep going; False to stop """ # Run activities whose time has come for act in self.__activities: if not act.iteratorHolder[0]: continue ...
[ "Activity", "tick", "handler", ";", "services", "all", "activities" ]
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/swarming/utils.py#L535-L556
[ "def", "tick", "(", "self", ")", ":", "# Run activities whose time has come", "for", "act", "in", "self", ".", "__activities", ":", "if", "not", "act", ".", "iteratorHolder", "[", "0", "]", ":", "continue", "try", ":", "next", "(", "act", ".", "iteratorHol...
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
rUpdate
Recursively updates the values in original with the values from updates.
src/nupic/data/dict_utils.py
def rUpdate(original, updates): """Recursively updates the values in original with the values from updates.""" # Keep a list of the sub-dictionaries that need to be updated to avoid having # to use recursion (which could fail for dictionaries with a lot of nesting. dictPairs = [(original, updates)] while len(...
def rUpdate(original, updates): """Recursively updates the values in original with the values from updates.""" # Keep a list of the sub-dictionaries that need to be updated to avoid having # to use recursion (which could fail for dictionaries with a lot of nesting. dictPairs = [(original, updates)] while len(...
[ "Recursively", "updates", "the", "values", "in", "original", "with", "the", "values", "from", "updates", "." ]
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/data/dict_utils.py#L43-L54
[ "def", "rUpdate", "(", "original", ",", "updates", ")", ":", "# Keep a list of the sub-dictionaries that need to be updated to avoid having", "# to use recursion (which could fail for dictionaries with a lot of nesting.", "dictPairs", "=", "[", "(", "original", ",", "updates", ")",...
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
dictDiffAndReport
Compares two python dictionaries at the top level and report differences, if any, to stdout da: first dictionary db: second dictionary Returns: The same value as returned by dictDiff() for the given args
src/nupic/data/dict_utils.py
def dictDiffAndReport(da, db): """ Compares two python dictionaries at the top level and report differences, if any, to stdout da: first dictionary db: second dictionary Returns: The same value as returned by dictDiff() for the given args """ differences = dictDiff(da, db)...
def dictDiffAndReport(da, db): """ Compares two python dictionaries at the top level and report differences, if any, to stdout da: first dictionary db: second dictionary Returns: The same value as returned by dictDiff() for the given args """ differences = dictDiff(da, db)...
[ "Compares", "two", "python", "dictionaries", "at", "the", "top", "level", "and", "report", "differences", "if", "any", "to", "stdout" ]
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/data/dict_utils.py#L100-L125
[ "def", "dictDiffAndReport", "(", "da", ",", "db", ")", ":", "differences", "=", "dictDiff", "(", "da", ",", "db", ")", "if", "not", "differences", ":", "return", "differences", "if", "differences", "[", "'inAButNotInB'", "]", ":", "print", "\">>> inAButNotIn...
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
dictDiff
Compares two python dictionaries at the top level and return differences da: first dictionary db: second dictionary Returns: None if dictionaries test equal; otherwise returns a dictionary as follows: { 'inAButNotInB': ...
src/nupic/data/dict_utils.py
def dictDiff(da, db): """ Compares two python dictionaries at the top level and return differences da: first dictionary db: second dictionary Returns: None if dictionaries test equal; otherwise returns a dictionary as follows: { ...
def dictDiff(da, db): """ Compares two python dictionaries at the top level and return differences da: first dictionary db: second dictionary Returns: None if dictionaries test equal; otherwise returns a dictionary as follows: { ...
[ "Compares", "two", "python", "dictionaries", "at", "the", "top", "level", "and", "return", "differences" ]
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/data/dict_utils.py#L128-L173
[ "def", "dictDiff", "(", "da", ",", "db", ")", ":", "different", "=", "False", "resultDict", "=", "dict", "(", ")", "resultDict", "[", "'inAButNotInB'", "]", "=", "set", "(", "da", ")", "-", "set", "(", "db", ")", "if", "resultDict", "[", "'inAButNotI...
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
SDRCategoryEncoder._seed
Initialize the random seed
src/nupic/encoders/sdr_category.py
def _seed(self, seed=-1): """ Initialize the random seed """ if seed != -1: self.random = NupicRandom(seed) else: self.random = NupicRandom()
def _seed(self, seed=-1): """ Initialize the random seed """ if seed != -1: self.random = NupicRandom(seed) else: self.random = NupicRandom()
[ "Initialize", "the", "random", "seed" ]
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/encoders/sdr_category.py#L140-L147
[ "def", "_seed", "(", "self", ",", "seed", "=", "-", "1", ")", ":", "if", "seed", "!=", "-", "1", ":", "self", ".", "random", "=", "NupicRandom", "(", "seed", ")", "else", ":", "self", ".", "random", "=", "NupicRandom", "(", ")" ]
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
SDRCategoryEncoder._newRep
Generate a new and unique representation. Returns a numpy array of shape (n,).
src/nupic/encoders/sdr_category.py
def _newRep(self): """Generate a new and unique representation. Returns a numpy array of shape (n,). """ maxAttempts = 1000 for _ in xrange(maxAttempts): foundUnique = True population = numpy.arange(self.n, dtype=numpy.uint32) choices = numpy.arange(self.w, dtype=numpy.uint32) o...
def _newRep(self): """Generate a new and unique representation. Returns a numpy array of shape (n,). """ maxAttempts = 1000 for _ in xrange(maxAttempts): foundUnique = True population = numpy.arange(self.n, dtype=numpy.uint32) choices = numpy.arange(self.w, dtype=numpy.uint32) o...
[ "Generate", "a", "new", "and", "unique", "representation", ".", "Returns", "a", "numpy", "array", "of", "shape", "(", "n", ")", "." ]
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/encoders/sdr_category.py#L184-L205
[ "def", "_newRep", "(", "self", ")", ":", "maxAttempts", "=", "1000", "for", "_", "in", "xrange", "(", "maxAttempts", ")", ":", "foundUnique", "=", "True", "population", "=", "numpy", ".", "arange", "(", "self", ".", "n", ",", "dtype", "=", "numpy", "...
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
SDRCategoryEncoder.getScalars
See method description in base.py
src/nupic/encoders/sdr_category.py
def getScalars(self, input): """ See method description in base.py """ if input == SENTINEL_VALUE_FOR_MISSING_DATA: return numpy.array([0]) index = self.categoryToIndex.get(input, None) if index is None: if self._learningEnabled: self._addCategory(input) index = self.ncate...
def getScalars(self, input): """ See method description in base.py """ if input == SENTINEL_VALUE_FOR_MISSING_DATA: return numpy.array([0]) index = self.categoryToIndex.get(input, None) if index is None: if self._learningEnabled: self._addCategory(input) index = self.ncate...
[ "See", "method", "description", "in", "base", ".", "py" ]
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/encoders/sdr_category.py#L216-L230
[ "def", "getScalars", "(", "self", ",", "input", ")", ":", "if", "input", "==", "SENTINEL_VALUE_FOR_MISSING_DATA", ":", "return", "numpy", ".", "array", "(", "[", "0", "]", ")", "index", "=", "self", ".", "categoryToIndex", ".", "get", "(", "input", ",", ...
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
SDRCategoryEncoder.decode
See the function description in base.py
src/nupic/encoders/sdr_category.py
def decode(self, encoded, parentFieldName=''): """ See the function description in base.py """ assert (encoded[0:self.n] <= 1.0).all() resultString = "" resultRanges = [] overlaps = (self.sdrs * encoded[0:self.n]).sum(axis=1) if self.verbosity >= 2: print "Overlaps for decoding:"...
def decode(self, encoded, parentFieldName=''): """ See the function description in base.py """ assert (encoded[0:self.n] <= 1.0).all() resultString = "" resultRanges = [] overlaps = (self.sdrs * encoded[0:self.n]).sum(axis=1) if self.verbosity >= 2: print "Overlaps for decoding:"...
[ "See", "the", "function", "description", "in", "base", ".", "py" ]
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/encoders/sdr_category.py#L254-L282
[ "def", "decode", "(", "self", ",", "encoded", ",", "parentFieldName", "=", "''", ")", ":", "assert", "(", "encoded", "[", "0", ":", "self", ".", "n", "]", "<=", "1.0", ")", ".", "all", "(", ")", "resultString", "=", "\"\"", "resultRanges", "=", "["...
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
SDRCategoryEncoder._getTopDownMapping
Return the interal _topDownMappingM matrix used for handling the bucketInfo() and topDownCompute() methods. This is a matrix, one row per category (bucket) where each row contains the encoded output for that category.
src/nupic/encoders/sdr_category.py
def _getTopDownMapping(self): """ Return the interal _topDownMappingM matrix used for handling the bucketInfo() and topDownCompute() methods. This is a matrix, one row per category (bucket) where each row contains the encoded output for that category. """ # -------------------------------------...
def _getTopDownMapping(self): """ Return the interal _topDownMappingM matrix used for handling the bucketInfo() and topDownCompute() methods. This is a matrix, one row per category (bucket) where each row contains the encoded output for that category. """ # -------------------------------------...
[ "Return", "the", "interal", "_topDownMappingM", "matrix", "used", "for", "handling", "the", "bucketInfo", "()", "and", "topDownCompute", "()", "methods", ".", "This", "is", "a", "matrix", "one", "row", "per", "category", "(", "bucket", ")", "where", "each", ...
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/encoders/sdr_category.py#L285-L304
[ "def", "_getTopDownMapping", "(", "self", ")", ":", "# -------------------------------------------------------------------------", "# Do we need to build up our reverse mapping table?", "if", "self", ".", "_topDownMappingM", "is", "None", ":", "# Each row represents an encoded output p...
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
SDRCategoryEncoder.getBucketInfo
See the function description in base.py
src/nupic/encoders/sdr_category.py
def getBucketInfo(self, buckets): """ See the function description in base.py """ if self.ncategories==0: return 0 topDownMappingM = self._getTopDownMapping() categoryIndex = buckets[0] category = self.categories[categoryIndex] encoding = topDownMappingM.getRow(categoryIndex) r...
def getBucketInfo(self, buckets): """ See the function description in base.py """ if self.ncategories==0: return 0 topDownMappingM = self._getTopDownMapping() categoryIndex = buckets[0] category = self.categories[categoryIndex] encoding = topDownMappingM.getRow(categoryIndex) r...
[ "See", "the", "function", "description", "in", "base", ".", "py" ]
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/encoders/sdr_category.py#L313-L327
[ "def", "getBucketInfo", "(", "self", ",", "buckets", ")", ":", "if", "self", ".", "ncategories", "==", "0", ":", "return", "0", "topDownMappingM", "=", "self", ".", "_getTopDownMapping", "(", ")", "categoryIndex", "=", "buckets", "[", "0", "]", "category",...
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
SDRCategoryEncoder.topDownCompute
See the function description in base.py
src/nupic/encoders/sdr_category.py
def topDownCompute(self, encoded): """ See the function description in base.py """ if self.ncategories==0: return 0 topDownMappingM = self._getTopDownMapping() categoryIndex = topDownMappingM.rightVecProd(encoded).argmax() category = self.categories[categoryIndex] encoding = topDown...
def topDownCompute(self, encoded): """ See the function description in base.py """ if self.ncategories==0: return 0 topDownMappingM = self._getTopDownMapping() categoryIndex = topDownMappingM.rightVecProd(encoded).argmax() category = self.categories[categoryIndex] encoding = topDown...
[ "See", "the", "function", "description", "in", "base", ".", "py" ]
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/encoders/sdr_category.py#L330-L343
[ "def", "topDownCompute", "(", "self", ",", "encoded", ")", ":", "if", "self", ".", "ncategories", "==", "0", ":", "return", "0", "topDownMappingM", "=", "self", ".", "_getTopDownMapping", "(", ")", "categoryIndex", "=", "topDownMappingM", ".", "rightVecProd", ...
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
DateEncoder.getScalarNames
See method description in base.py
src/nupic/encoders/date.py
def getScalarNames(self, parentFieldName=''): """ See method description in base.py """ names = [] # This forms a name which is the concatenation of the parentFieldName # passed in and the encoder's own name. def _formFieldName(encoder): if parentFieldName == '': return encoder.nam...
def getScalarNames(self, parentFieldName=''): """ See method description in base.py """ names = [] # This forms a name which is the concatenation of the parentFieldName # passed in and the encoder's own name. def _formFieldName(encoder): if parentFieldName == '': return encoder.nam...
[ "See", "method", "description", "in", "base", ".", "py" ]
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/encoders/date.py#L238-L271
[ "def", "getScalarNames", "(", "self", ",", "parentFieldName", "=", "''", ")", ":", "names", "=", "[", "]", "# This forms a name which is the concatenation of the parentFieldName", "# passed in and the encoder's own name.", "def", "_formFieldName", "(", "encoder", ")", ":"...
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
DateEncoder.getEncodedValues
See method description in base.py
src/nupic/encoders/date.py
def getEncodedValues(self, input): """ See method description in base.py """ if input == SENTINEL_VALUE_FOR_MISSING_DATA: return numpy.array([None]) assert isinstance(input, datetime.datetime) values = [] # ------------------------------------------------------------------------- # Get ...
def getEncodedValues(self, input): """ See method description in base.py """ if input == SENTINEL_VALUE_FOR_MISSING_DATA: return numpy.array([None]) assert isinstance(input, datetime.datetime) values = [] # ------------------------------------------------------------------------- # Get ...
[ "See", "method", "description", "in", "base", ".", "py" ]
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/encoders/date.py#L274-L349
[ "def", "getEncodedValues", "(", "self", ",", "input", ")", ":", "if", "input", "==", "SENTINEL_VALUE_FOR_MISSING_DATA", ":", "return", "numpy", ".", "array", "(", "[", "None", "]", ")", "assert", "isinstance", "(", "input", ",", "datetime", ".", "datetime", ...
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
DateEncoder.getBucketIndices
See method description in base.py
src/nupic/encoders/date.py
def getBucketIndices(self, input): """ See method description in base.py """ if input == SENTINEL_VALUE_FOR_MISSING_DATA: # Encoder each sub-field return [None] * len(self.encoders) else: assert isinstance(input, datetime.datetime) # Get the scalar values for each sub-field ...
def getBucketIndices(self, input): """ See method description in base.py """ if input == SENTINEL_VALUE_FOR_MISSING_DATA: # Encoder each sub-field return [None] * len(self.encoders) else: assert isinstance(input, datetime.datetime) # Get the scalar values for each sub-field ...
[ "See", "method", "description", "in", "base", ".", "py" ]
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/encoders/date.py#L366-L384
[ "def", "getBucketIndices", "(", "self", ",", "input", ")", ":", "if", "input", "==", "SENTINEL_VALUE_FOR_MISSING_DATA", ":", "# Encoder each sub-field", "return", "[", "None", "]", "*", "len", "(", "self", ".", "encoders", ")", "else", ":", "assert", "isinstan...
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
DateEncoder.encodeIntoArray
See method description in base.py
src/nupic/encoders/date.py
def encodeIntoArray(self, input, output): """ See method description in base.py """ if input == SENTINEL_VALUE_FOR_MISSING_DATA: output[0:] = 0 else: if not isinstance(input, datetime.datetime): raise ValueError("Input is type %s, expected datetime. Value: %s" % ( type(input...
def encodeIntoArray(self, input, output): """ See method description in base.py """ if input == SENTINEL_VALUE_FOR_MISSING_DATA: output[0:] = 0 else: if not isinstance(input, datetime.datetime): raise ValueError("Input is type %s, expected datetime. Value: %s" % ( type(input...
[ "See", "method", "description", "in", "base", ".", "py" ]
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/encoders/date.py#L387-L402
[ "def", "encodeIntoArray", "(", "self", ",", "input", ",", "output", ")", ":", "if", "input", "==", "SENTINEL_VALUE_FOR_MISSING_DATA", ":", "output", "[", "0", ":", "]", "=", "0", "else", ":", "if", "not", "isinstance", "(", "input", ",", "datetime", ".",...
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
IdentityRegion.getSpec
Return the Spec for IdentityRegion.
examples/network/custom_region/identity_region.py
def getSpec(cls): """Return the Spec for IdentityRegion. """ spec = { "description":IdentityRegion.__doc__, "singleNodeOnly":True, "inputs":{ "in":{ "description":"The input vector.", "dataType":"Real32", "count":0, "required"...
def getSpec(cls): """Return the Spec for IdentityRegion. """ spec = { "description":IdentityRegion.__doc__, "singleNodeOnly":True, "inputs":{ "in":{ "description":"The input vector.", "dataType":"Real32", "count":0, "required"...
[ "Return", "the", "Spec", "for", "IdentityRegion", "." ]
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/examples/network/custom_region/identity_region.py#L51-L86
[ "def", "getSpec", "(", "cls", ")", ":", "spec", "=", "{", "\"description\"", ":", "IdentityRegion", ".", "__doc__", ",", "\"singleNodeOnly\"", ":", "True", ",", "\"inputs\"", ":", "{", "\"in\"", ":", "{", "\"description\"", ":", "\"The input vector.\"", ",", ...
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
_setRandomEncoderResolution
Given model params, figure out the correct resolution for the RandomDistributed encoder. Modifies params in place.
examples/opf/clients/nyctaxi/nyctaxi_anomaly.py
def _setRandomEncoderResolution(minResolution=0.001): """ Given model params, figure out the correct resolution for the RandomDistributed encoder. Modifies params in place. """ encoder = ( model_params.MODEL_PARAMS["modelParams"]["sensorParams"]["encoders"]["value"] ) if encoder["type"] == "RandomDis...
def _setRandomEncoderResolution(minResolution=0.001): """ Given model params, figure out the correct resolution for the RandomDistributed encoder. Modifies params in place. """ encoder = ( model_params.MODEL_PARAMS["modelParams"]["sensorParams"]["encoders"]["value"] ) if encoder["type"] == "RandomDis...
[ "Given", "model", "params", "figure", "out", "the", "correct", "resolution", "for", "the", "RandomDistributed", "encoder", ".", "Modifies", "params", "in", "place", "." ]
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/examples/opf/clients/nyctaxi/nyctaxi_anomaly.py#L54-L70
[ "def", "_setRandomEncoderResolution", "(", "minResolution", "=", "0.001", ")", ":", "encoder", "=", "(", "model_params", ".", "MODEL_PARAMS", "[", "\"modelParams\"", "]", "[", "\"sensorParams\"", "]", "[", "\"encoders\"", "]", "[", "\"value\"", "]", ")", "if", ...
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
HTMPredictionModelClassifierHelper.addLabel
Add the label labelName to each record with record ROWID in range from start to end, noninclusive of end. This will recalculate all points from end to the last record stored in the internal cache of this classifier.
src/nupic/frameworks/opf/htm_prediction_model_classifier_helper.py
def addLabel(self, start, end, labelName): """ Add the label labelName to each record with record ROWID in range from start to end, noninclusive of end. This will recalculate all points from end to the last record stored in the internal cache of this classifier. """ if len(self.saved_states...
def addLabel(self, start, end, labelName): """ Add the label labelName to each record with record ROWID in range from start to end, noninclusive of end. This will recalculate all points from end to the last record stored in the internal cache of this classifier. """ if len(self.saved_states...
[ "Add", "the", "label", "labelName", "to", "each", "record", "with", "record", "ROWID", "in", "range", "from", "start", "to", "end", "noninclusive", "of", "end", "." ]
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/frameworks/opf/htm_prediction_model_classifier_helper.py#L165-L211
[ "def", "addLabel", "(", "self", ",", "start", ",", "end", ",", "labelName", ")", ":", "if", "len", "(", "self", ".", "saved_states", ")", "==", "0", ":", "raise", "HTMPredictionModelInvalidRangeError", "(", "\"Invalid supplied range for 'addLabel'. \"", "\"Model h...
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
HTMPredictionModelClassifierHelper.removeLabels
Remove labels from each record with record ROWID in range from start to end, noninclusive of end. Removes all records if labelFilter is None, otherwise only removes the labels eqaul to labelFilter. This will recalculate all points from end to the last record stored in the internal cache of this classif...
src/nupic/frameworks/opf/htm_prediction_model_classifier_helper.py
def removeLabels(self, start=None, end=None, labelFilter=None): """ Remove labels from each record with record ROWID in range from start to end, noninclusive of end. Removes all records if labelFilter is None, otherwise only removes the labels eqaul to labelFilter. This will recalculate all points ...
def removeLabels(self, start=None, end=None, labelFilter=None): """ Remove labels from each record with record ROWID in range from start to end, noninclusive of end. Removes all records if labelFilter is None, otherwise only removes the labels eqaul to labelFilter. This will recalculate all points ...
[ "Remove", "labels", "from", "each", "record", "with", "record", "ROWID", "in", "range", "from", "start", "to", "end", "noninclusive", "of", "end", ".", "Removes", "all", "records", "if", "labelFilter", "is", "None", "otherwise", "only", "removes", "the", "la...
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/frameworks/opf/htm_prediction_model_classifier_helper.py#L214-L271
[ "def", "removeLabels", "(", "self", ",", "start", "=", "None", ",", "end", "=", "None", ",", "labelFilter", "=", "None", ")", ":", "if", "len", "(", "self", ".", "saved_states", ")", "==", "0", ":", "raise", "HTMPredictionModelInvalidRangeError", "(", "\...
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
HTMPredictionModelClassifierHelper._addRecordToKNN
This method will add the record to the KNN classifier.
src/nupic/frameworks/opf/htm_prediction_model_classifier_helper.py
def _addRecordToKNN(self, record): """ This method will add the record to the KNN classifier. """ classifier = self.htm_prediction_model._getAnomalyClassifier() knn = classifier.getSelf()._knn prototype_idx = classifier.getSelf().getParameter('categoryRecencyList') category = self._labelLis...
def _addRecordToKNN(self, record): """ This method will add the record to the KNN classifier. """ classifier = self.htm_prediction_model._getAnomalyClassifier() knn = classifier.getSelf()._knn prototype_idx = classifier.getSelf().getParameter('categoryRecencyList') category = self._labelLis...
[ "This", "method", "will", "add", "the", "record", "to", "the", "KNN", "classifier", "." ]
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/frameworks/opf/htm_prediction_model_classifier_helper.py#L324-L342
[ "def", "_addRecordToKNN", "(", "self", ",", "record", ")", ":", "classifier", "=", "self", ".", "htm_prediction_model", ".", "_getAnomalyClassifier", "(", ")", "knn", "=", "classifier", ".", "getSelf", "(", ")", ".", "_knn", "prototype_idx", "=", "classifier",...
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
HTMPredictionModelClassifierHelper._deleteRecordsFromKNN
This method will remove the given records from the classifier. parameters ------------ recordsToDelete - list of records to delete from the classififier
src/nupic/frameworks/opf/htm_prediction_model_classifier_helper.py
def _deleteRecordsFromKNN(self, recordsToDelete): """ This method will remove the given records from the classifier. parameters ------------ recordsToDelete - list of records to delete from the classififier """ classifier = self.htm_prediction_model._getAnomalyClassifier() knn = classif...
def _deleteRecordsFromKNN(self, recordsToDelete): """ This method will remove the given records from the classifier. parameters ------------ recordsToDelete - list of records to delete from the classififier """ classifier = self.htm_prediction_model._getAnomalyClassifier() knn = classif...
[ "This", "method", "will", "remove", "the", "given", "records", "from", "the", "classifier", "." ]
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/frameworks/opf/htm_prediction_model_classifier_helper.py#L345-L363
[ "def", "_deleteRecordsFromKNN", "(", "self", ",", "recordsToDelete", ")", ":", "classifier", "=", "self", ".", "htm_prediction_model", ".", "_getAnomalyClassifier", "(", ")", "knn", "=", "classifier", ".", "getSelf", "(", ")", ".", "_knn", "prototype_idx", "=", ...
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
HTMPredictionModelClassifierHelper._deleteRangeFromKNN
This method will remove any stored records within the range from start to end. Noninclusive of end. parameters ------------ start - integer representing the ROWID of the start of the deletion range, end - integer representing the ROWID of the end of the deletion range, if None, it will defaul...
src/nupic/frameworks/opf/htm_prediction_model_classifier_helper.py
def _deleteRangeFromKNN(self, start=0, end=None): """ This method will remove any stored records within the range from start to end. Noninclusive of end. parameters ------------ start - integer representing the ROWID of the start of the deletion range, end - integer representing the ROWID o...
def _deleteRangeFromKNN(self, start=0, end=None): """ This method will remove any stored records within the range from start to end. Noninclusive of end. parameters ------------ start - integer representing the ROWID of the start of the deletion range, end - integer representing the ROWID o...
[ "This", "method", "will", "remove", "any", "stored", "records", "within", "the", "range", "from", "start", "to", "end", ".", "Noninclusive", "of", "end", "." ]
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/frameworks/opf/htm_prediction_model_classifier_helper.py#L365-L391
[ "def", "_deleteRangeFromKNN", "(", "self", ",", "start", "=", "0", ",", "end", "=", "None", ")", ":", "classifier", "=", "self", ".", "htm_prediction_model", ".", "_getAnomalyClassifier", "(", ")", "knn", "=", "classifier", ".", "getSelf", "(", ")", ".", ...
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
HTMPredictionModelClassifierHelper._recomputeRecordFromKNN
return the classified labeling of record
src/nupic/frameworks/opf/htm_prediction_model_classifier_helper.py
def _recomputeRecordFromKNN(self, record): """ return the classified labeling of record """ inputs = { "categoryIn": [None], "bottomUpIn": self._getStateAnomalyVector(record), } outputs = {"categoriesOut": numpy.zeros((1,)), "bestPrototypeIndices":numpy.zeros((1,)), ...
def _recomputeRecordFromKNN(self, record): """ return the classified labeling of record """ inputs = { "categoryIn": [None], "bottomUpIn": self._getStateAnomalyVector(record), } outputs = {"categoriesOut": numpy.zeros((1,)), "bestPrototypeIndices":numpy.zeros((1,)), ...
[ "return", "the", "classified", "labeling", "of", "record" ]
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/frameworks/opf/htm_prediction_model_classifier_helper.py#L394-L435
[ "def", "_recomputeRecordFromKNN", "(", "self", ",", "record", ")", ":", "inputs", "=", "{", "\"categoryIn\"", ":", "[", "None", "]", ",", "\"bottomUpIn\"", ":", "self", ".", "_getStateAnomalyVector", "(", "record", ")", ",", "}", "outputs", "=", "{", "\"ca...
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
HTMPredictionModelClassifierHelper._constructClassificationRecord
Construct a _HTMClassificationRecord based on the current state of the htm_prediction_model of this classifier. ***This will look into the internals of the model and may depend on the SP, TM, and KNNClassifier***
src/nupic/frameworks/opf/htm_prediction_model_classifier_helper.py
def _constructClassificationRecord(self): """ Construct a _HTMClassificationRecord based on the current state of the htm_prediction_model of this classifier. ***This will look into the internals of the model and may depend on the SP, TM, and KNNClassifier*** """ model = self.htm_prediction_...
def _constructClassificationRecord(self): """ Construct a _HTMClassificationRecord based on the current state of the htm_prediction_model of this classifier. ***This will look into the internals of the model and may depend on the SP, TM, and KNNClassifier*** """ model = self.htm_prediction_...
[ "Construct", "a", "_HTMClassificationRecord", "based", "on", "the", "current", "state", "of", "the", "htm_prediction_model", "of", "this", "classifier", "." ]
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/frameworks/opf/htm_prediction_model_classifier_helper.py#L439-L499
[ "def", "_constructClassificationRecord", "(", "self", ")", ":", "model", "=", "self", ".", "htm_prediction_model", "sp", "=", "model", ".", "_getSPRegion", "(", ")", "tm", "=", "model", ".", "_getTPRegion", "(", ")", "tpImp", "=", "tm", ".", "getSelf", "("...
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
HTMPredictionModelClassifierHelper.compute
Run an iteration of this anomaly classifier
src/nupic/frameworks/opf/htm_prediction_model_classifier_helper.py
def compute(self): """ Run an iteration of this anomaly classifier """ result = self._constructClassificationRecord() # Classify this point after waiting the classification delay if result.ROWID >= self._autoDetectWaitRecords: self._updateState(result) # Save new classification recor...
def compute(self): """ Run an iteration of this anomaly classifier """ result = self._constructClassificationRecord() # Classify this point after waiting the classification delay if result.ROWID >= self._autoDetectWaitRecords: self._updateState(result) # Save new classification recor...
[ "Run", "an", "iteration", "of", "this", "anomaly", "classifier" ]
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/frameworks/opf/htm_prediction_model_classifier_helper.py#L502-L517
[ "def", "compute", "(", "self", ")", ":", "result", "=", "self", ".", "_constructClassificationRecord", "(", ")", "# Classify this point after waiting the classification delay", "if", "result", ".", "ROWID", ">=", "self", ".", "_autoDetectWaitRecords", ":", "self", "."...
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
HTMPredictionModelClassifierHelper.setAutoDetectWaitRecords
Sets the autoDetectWaitRecords.
src/nupic/frameworks/opf/htm_prediction_model_classifier_helper.py
def setAutoDetectWaitRecords(self, waitRecords): """ Sets the autoDetectWaitRecords. """ if not isinstance(waitRecords, int): raise HTMPredictionModelInvalidArgument("Invalid argument type \'%s\'. WaitRecord " "must be a number." % (type(waitRecords))) if len(self.saved_states) > 0 an...
def setAutoDetectWaitRecords(self, waitRecords): """ Sets the autoDetectWaitRecords. """ if not isinstance(waitRecords, int): raise HTMPredictionModelInvalidArgument("Invalid argument type \'%s\'. WaitRecord " "must be a number." % (type(waitRecords))) if len(self.saved_states) > 0 an...
[ "Sets", "the", "autoDetectWaitRecords", "." ]
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/frameworks/opf/htm_prediction_model_classifier_helper.py#L520-L537
[ "def", "setAutoDetectWaitRecords", "(", "self", ",", "waitRecords", ")", ":", "if", "not", "isinstance", "(", "waitRecords", ",", "int", ")", ":", "raise", "HTMPredictionModelInvalidArgument", "(", "\"Invalid argument type \\'%s\\'. WaitRecord \"", "\"must be a number.\"", ...
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
HTMPredictionModelClassifierHelper.setAutoDetectThreshold
Sets the autoDetectThreshold. TODO: Ensure previously classified points outside of classifier are valid.
src/nupic/frameworks/opf/htm_prediction_model_classifier_helper.py
def setAutoDetectThreshold(self, threshold): """ Sets the autoDetectThreshold. TODO: Ensure previously classified points outside of classifier are valid. """ if not (isinstance(threshold, float) or isinstance(threshold, int)): raise HTMPredictionModelInvalidArgument("Invalid argument type \'%s...
def setAutoDetectThreshold(self, threshold): """ Sets the autoDetectThreshold. TODO: Ensure previously classified points outside of classifier are valid. """ if not (isinstance(threshold, float) or isinstance(threshold, int)): raise HTMPredictionModelInvalidArgument("Invalid argument type \'%s...
[ "Sets", "the", "autoDetectThreshold", ".", "TODO", ":", "Ensure", "previously", "classified", "points", "outside", "of", "classifier", "are", "valid", "." ]
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/frameworks/opf/htm_prediction_model_classifier_helper.py#L547-L560
[ "def", "setAutoDetectThreshold", "(", "self", ",", "threshold", ")", ":", "if", "not", "(", "isinstance", "(", "threshold", ",", "float", ")", "or", "isinstance", "(", "threshold", ",", "int", ")", ")", ":", "raise", "HTMPredictionModelInvalidArgument", "(", ...
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
_getAdditionalSpecs
Build the additional specs in three groups (for the inspector) Use the type of the default argument to set the Spec type, defaulting to 'Byte' for None and complex types Determines the spatial parameters based on the selected implementation. It defaults to SpatialPooler.
src/nupic/regions/sp_region.py
def _getAdditionalSpecs(spatialImp, kwargs={}): """Build the additional specs in three groups (for the inspector) Use the type of the default argument to set the Spec type, defaulting to 'Byte' for None and complex types Determines the spatial parameters based on the selected implementation. It defaults to ...
def _getAdditionalSpecs(spatialImp, kwargs={}): """Build the additional specs in three groups (for the inspector) Use the type of the default argument to set the Spec type, defaulting to 'Byte' for None and complex types Determines the spatial parameters based on the selected implementation. It defaults to ...
[ "Build", "the", "additional", "specs", "in", "three", "groups", "(", "for", "the", "inspector", ")" ]
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/regions/sp_region.py#L116-L298
[ "def", "_getAdditionalSpecs", "(", "spatialImp", ",", "kwargs", "=", "{", "}", ")", ":", "typeNames", "=", "{", "int", ":", "'UInt32'", ",", "float", ":", "'Real32'", ",", "str", ":", "'Byte'", ",", "bool", ":", "'bool'", ",", "tuple", ":", "'tuple'", ...
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
SPRegion._initializeEphemeralMembers
Initialize all ephemeral data members, and give the derived class the opportunity to do the same by invoking the virtual member _initEphemerals(), which is intended to be overridden. NOTE: this is used by both __init__ and __setstate__ code paths.
src/nupic/regions/sp_region.py
def _initializeEphemeralMembers(self): """ Initialize all ephemeral data members, and give the derived class the opportunity to do the same by invoking the virtual member _initEphemerals(), which is intended to be overridden. NOTE: this is used by both __init__ and __setstate__ code paths. """ ...
def _initializeEphemeralMembers(self): """ Initialize all ephemeral data members, and give the derived class the opportunity to do the same by invoking the virtual member _initEphemerals(), which is intended to be overridden. NOTE: this is used by both __init__ and __setstate__ code paths. """ ...
[ "Initialize", "all", "ephemeral", "data", "members", "and", "give", "the", "derived", "class", "the", "opportunity", "to", "do", "the", "same", "by", "invoking", "the", "virtual", "member", "_initEphemerals", "()", "which", "is", "intended", "to", "be", "overr...
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/regions/sp_region.py#L383-L418
[ "def", "_initializeEphemeralMembers", "(", "self", ")", ":", "for", "attrName", "in", "self", ".", "_getEphemeralMembersBase", "(", ")", ":", "if", "attrName", "!=", "\"_loaded\"", ":", "if", "hasattr", "(", "self", ",", "attrName", ")", ":", "if", "self", ...
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
SPRegion.initialize
Overrides :meth:`~nupic.bindings.regions.PyRegion.PyRegion.initialize`.
src/nupic/regions/sp_region.py
def initialize(self): """ Overrides :meth:`~nupic.bindings.regions.PyRegion.PyRegion.initialize`. """ # Zero out the spatial output in case it is requested self._spatialPoolerOutput = numpy.zeros(self.columnCount, dtype=GetNTAReal()) # Zero out the rf...
def initialize(self): """ Overrides :meth:`~nupic.bindings.regions.PyRegion.PyRegion.initialize`. """ # Zero out the spatial output in case it is requested self._spatialPoolerOutput = numpy.zeros(self.columnCount, dtype=GetNTAReal()) # Zero out the rf...
[ "Overrides", ":", "meth", ":", "~nupic", ".", "bindings", ".", "regions", ".", "PyRegion", ".", "PyRegion", ".", "initialize", "." ]
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/regions/sp_region.py#L421-L434
[ "def", "initialize", "(", "self", ")", ":", "# Zero out the spatial output in case it is requested", "self", ".", "_spatialPoolerOutput", "=", "numpy", ".", "zeros", "(", "self", ".", "columnCount", ",", "dtype", "=", "GetNTAReal", "(", ")", ")", "# Zero out the rfI...
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
SPRegion._allocateSpatialFDR
Allocate the spatial pooler instance.
src/nupic/regions/sp_region.py
def _allocateSpatialFDR(self, rfInput): """Allocate the spatial pooler instance.""" if self._sfdr: return # Retrieve the necessary extra arguments that were handled automatically autoArgs = dict((name, getattr(self, name)) for name in self._spatialArgNames) # Instantiate...
def _allocateSpatialFDR(self, rfInput): """Allocate the spatial pooler instance.""" if self._sfdr: return # Retrieve the necessary extra arguments that were handled automatically autoArgs = dict((name, getattr(self, name)) for name in self._spatialArgNames) # Instantiate...
[ "Allocate", "the", "spatial", "pooler", "instance", "." ]
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/regions/sp_region.py#L437-L456
[ "def", "_allocateSpatialFDR", "(", "self", ",", "rfInput", ")", ":", "if", "self", ".", "_sfdr", ":", "return", "# Retrieve the necessary extra arguments that were handled automatically", "autoArgs", "=", "dict", "(", "(", "name", ",", "getattr", "(", "self", ",", ...
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
SPRegion.compute
Run one iteration, profiling it if requested. :param inputs: (dict) mapping region input names to numpy.array values :param outputs: (dict) mapping region output names to numpy.arrays that should be populated with output values by this method
src/nupic/regions/sp_region.py
def compute(self, inputs, outputs): """ Run one iteration, profiling it if requested. :param inputs: (dict) mapping region input names to numpy.array values :param outputs: (dict) mapping region output names to numpy.arrays that should be populated with output values by this method """ ...
def compute(self, inputs, outputs): """ Run one iteration, profiling it if requested. :param inputs: (dict) mapping region input names to numpy.array values :param outputs: (dict) mapping region output names to numpy.arrays that should be populated with output values by this method """ ...
[ "Run", "one", "iteration", "profiling", "it", "if", "requested", "." ]
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/regions/sp_region.py#L466-L504
[ "def", "compute", "(", "self", ",", "inputs", ",", "outputs", ")", ":", "# Uncomment this to find out who is generating divide by 0, or other numpy warnings", "# numpy.seterr(divide='raise', invalid='raise', over='raise')", "# Modify this line to turn on profiling for a given node. The resul...
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
SPRegion._compute
Run one iteration of SPRegion's compute
src/nupic/regions/sp_region.py
def _compute(self, inputs, outputs): """ Run one iteration of SPRegion's compute """ #if self.topDownMode and (not 'topDownIn' in inputs): # raise RuntimeError("The input topDownIn must be linked in if " # "topDownMode is True") if self._sfdr is None: raise Runti...
def _compute(self, inputs, outputs): """ Run one iteration of SPRegion's compute """ #if self.topDownMode and (not 'topDownIn' in inputs): # raise RuntimeError("The input topDownIn must be linked in if " # "topDownMode is True") if self._sfdr is None: raise Runti...
[ "Run", "one", "iteration", "of", "SPRegion", "s", "compute" ]
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/regions/sp_region.py#L506-L555
[ "def", "_compute", "(", "self", ",", "inputs", ",", "outputs", ")", ":", "#if self.topDownMode and (not 'topDownIn' in inputs):", "# raise RuntimeError(\"The input topDownIn must be linked in if \"", "# \"topDownMode is True\")", "if", "self", ".", "_sfdr", "is...
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
SPRegion._doBottomUpCompute
Do one iteration of inference and/or learning and return the result Parameters: -------------------------------------------- rfInput: Input vector. Shape is: (1, inputVectorLen). resetSignal: True if reset is asserted
src/nupic/regions/sp_region.py
def _doBottomUpCompute(self, rfInput, resetSignal): """ Do one iteration of inference and/or learning and return the result Parameters: -------------------------------------------- rfInput: Input vector. Shape is: (1, inputVectorLen). resetSignal: True if reset is asserted """ #...
def _doBottomUpCompute(self, rfInput, resetSignal): """ Do one iteration of inference and/or learning and return the result Parameters: -------------------------------------------- rfInput: Input vector. Shape is: (1, inputVectorLen). resetSignal: True if reset is asserted """ #...
[ "Do", "one", "iteration", "of", "inference", "and", "/", "or", "learning", "and", "return", "the", "result" ]
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/regions/sp_region.py#L562-L606
[ "def", "_doBottomUpCompute", "(", "self", ",", "rfInput", ",", "resetSignal", ")", ":", "# Conditional compute break", "self", ".", "_conditionalBreak", "(", ")", "# Save the rfInput for the spInputNonZeros parameter", "self", ".", "_spatialPoolerInput", "=", "rfInput", "...
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
SPRegion.getBaseSpec
Doesn't include the spatial, temporal and other parameters :returns: (dict) The base Spec for SPRegion.
src/nupic/regions/sp_region.py
def getBaseSpec(cls): """ Doesn't include the spatial, temporal and other parameters :returns: (dict) The base Spec for SPRegion. """ spec = dict( description=SPRegion.__doc__, singleNodeOnly=True, inputs=dict( bottomUpIn=dict( description="""The input vector."""...
def getBaseSpec(cls): """ Doesn't include the spatial, temporal and other parameters :returns: (dict) The base Spec for SPRegion. """ spec = dict( description=SPRegion.__doc__, singleNodeOnly=True, inputs=dict( bottomUpIn=dict( description="""The input vector."""...
[ "Doesn", "t", "include", "the", "spatial", "temporal", "and", "other", "parameters" ]
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/regions/sp_region.py#L634-L747
[ "def", "getBaseSpec", "(", "cls", ")", ":", "spec", "=", "dict", "(", "description", "=", "SPRegion", ".", "__doc__", ",", "singleNodeOnly", "=", "True", ",", "inputs", "=", "dict", "(", "bottomUpIn", "=", "dict", "(", "description", "=", "\"\"\"The input ...
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
SPRegion.getSpec
Overrides :meth:`~nupic.bindings.regions.PyRegion.PyRegion.getSpec`. The parameters collection is constructed based on the parameters specified by the various components (spatialSpec, temporalSpec and otherSpec)
src/nupic/regions/sp_region.py
def getSpec(cls): """ Overrides :meth:`~nupic.bindings.regions.PyRegion.PyRegion.getSpec`. The parameters collection is constructed based on the parameters specified by the various components (spatialSpec, temporalSpec and otherSpec) """ spec = cls.getBaseSpec() s, o = _getAdditionalSpecs(s...
def getSpec(cls): """ Overrides :meth:`~nupic.bindings.regions.PyRegion.PyRegion.getSpec`. The parameters collection is constructed based on the parameters specified by the various components (spatialSpec, temporalSpec and otherSpec) """ spec = cls.getBaseSpec() s, o = _getAdditionalSpecs(s...
[ "Overrides", ":", "meth", ":", "~nupic", ".", "bindings", ".", "regions", ".", "PyRegion", ".", "PyRegion", ".", "getSpec", "." ]
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/regions/sp_region.py#L750-L762
[ "def", "getSpec", "(", "cls", ")", ":", "spec", "=", "cls", ".", "getBaseSpec", "(", ")", "s", ",", "o", "=", "_getAdditionalSpecs", "(", "spatialImp", "=", "getDefaultSPImp", "(", ")", ")", "spec", "[", "'parameters'", "]", ".", "update", "(", "s", ...
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
SPRegion.getParameter
Overrides :meth:`~nupic.bindings.regions.PyRegion.PyRegion.getParameter`. Most parameters are handled automatically by PyRegion's parameter get mechanism. The ones that need special treatment are explicitly handled here.
src/nupic/regions/sp_region.py
def getParameter(self, parameterName, index=-1): """ Overrides :meth:`~nupic.bindings.regions.PyRegion.PyRegion.getParameter`. Most parameters are handled automatically by PyRegion's parameter get mechanism. The ones that need special treatment are explicitly handled here. """ if parame...
def getParameter(self, parameterName, index=-1): """ Overrides :meth:`~nupic.bindings.regions.PyRegion.PyRegion.getParameter`. Most parameters are handled automatically by PyRegion's parameter get mechanism. The ones that need special treatment are explicitly handled here. """ if parame...
[ "Overrides", ":", "meth", ":", "~nupic", ".", "bindings", ".", "regions", ".", "PyRegion", ".", "PyRegion", ".", "getParameter", ".", "Most", "parameters", "are", "handled", "automatically", "by", "PyRegion", "s", "parameter", "get", "mechanism", ".", "The", ...
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/regions/sp_region.py#L773-L802
[ "def", "getParameter", "(", "self", ",", "parameterName", ",", "index", "=", "-", "1", ")", ":", "if", "parameterName", "==", "'activeOutputCount'", ":", "return", "self", ".", "columnCount", "elif", "parameterName", "==", "'spatialPoolerInput'", ":", "return", ...
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
SPRegion.setParameter
Overrides :meth:`~nupic.bindings.regions.PyRegion.PyRegion.setParameter`. Set the value of a Spec parameter. Most parameters are handled automatically by PyRegion's parameter set mechanism. The ones that need special treatment are explicitly handled here.
src/nupic/regions/sp_region.py
def setParameter(self, parameterName, index, parameterValue): """ Overrides :meth:`~nupic.bindings.regions.PyRegion.PyRegion.setParameter`. Set the value of a Spec parameter. Most parameters are handled automatically by PyRegion's parameter set mechanism. The ones that need special treatment are ex...
def setParameter(self, parameterName, index, parameterValue): """ Overrides :meth:`~nupic.bindings.regions.PyRegion.PyRegion.setParameter`. Set the value of a Spec parameter. Most parameters are handled automatically by PyRegion's parameter set mechanism. The ones that need special treatment are ex...
[ "Overrides", ":", "meth", ":", "~nupic", ".", "bindings", ".", "regions", ".", "PyRegion", ".", "PyRegion", ".", "setParameter", "." ]
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/regions/sp_region.py#L805-L850
[ "def", "setParameter", "(", "self", ",", "parameterName", ",", "index", ",", "parameterValue", ")", ":", "if", "parameterName", "in", "self", ".", "_spatialArgNames", ":", "setattr", "(", "self", ".", "_sfdr", ",", "parameterName", ",", "parameterValue", ")", ...
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
SPRegion.writeToProto
Overrides :meth:`~nupic.bindings.regions.PyRegion.PyRegion.writeToProto`. Write state to proto object. :param proto: SPRegionProto capnproto object
src/nupic/regions/sp_region.py
def writeToProto(self, proto): """ Overrides :meth:`~nupic.bindings.regions.PyRegion.PyRegion.writeToProto`. Write state to proto object. :param proto: SPRegionProto capnproto object """ proto.spatialImp = self.spatialImp proto.columnCount = self.columnCount proto.inputWidth = self.inp...
def writeToProto(self, proto): """ Overrides :meth:`~nupic.bindings.regions.PyRegion.PyRegion.writeToProto`. Write state to proto object. :param proto: SPRegionProto capnproto object """ proto.spatialImp = self.spatialImp proto.columnCount = self.columnCount proto.inputWidth = self.inp...
[ "Overrides", ":", "meth", ":", "~nupic", ".", "bindings", ".", "regions", ".", "PyRegion", ".", "PyRegion", ".", "writeToProto", "." ]
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/regions/sp_region.py#L867-L883
[ "def", "writeToProto", "(", "self", ",", "proto", ")", ":", "proto", ".", "spatialImp", "=", "self", ".", "spatialImp", "proto", ".", "columnCount", "=", "self", ".", "columnCount", "proto", ".", "inputWidth", "=", "self", ".", "inputWidth", "proto", ".", ...
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
SPRegion.readFromProto
Overrides :meth:`~nupic.bindings.regions.PyRegion.PyRegion.readFromProto`. Read state from proto object. :param proto: SPRegionProto capnproto object
src/nupic/regions/sp_region.py
def readFromProto(cls, proto): """ Overrides :meth:`~nupic.bindings.regions.PyRegion.PyRegion.readFromProto`. Read state from proto object. :param proto: SPRegionProto capnproto object """ instance = cls(proto.columnCount, proto.inputWidth) instance.spatialImp = proto.spatialImp i...
def readFromProto(cls, proto): """ Overrides :meth:`~nupic.bindings.regions.PyRegion.PyRegion.readFromProto`. Read state from proto object. :param proto: SPRegionProto capnproto object """ instance = cls(proto.columnCount, proto.inputWidth) instance.spatialImp = proto.spatialImp i...
[ "Overrides", ":", "meth", ":", "~nupic", ".", "bindings", ".", "regions", ".", "PyRegion", ".", "PyRegion", ".", "readFromProto", "." ]
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/regions/sp_region.py#L887-L906
[ "def", "readFromProto", "(", "cls", ",", "proto", ")", ":", "instance", "=", "cls", "(", "proto", ".", "columnCount", ",", "proto", ".", "inputWidth", ")", "instance", ".", "spatialImp", "=", "proto", ".", "spatialImp", "instance", ".", "learningMode", "="...
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
SPRegion._initEphemerals
Initialize all ephemerals used by derived classes.
src/nupic/regions/sp_region.py
def _initEphemerals(self): """ Initialize all ephemerals used by derived classes. """ if hasattr(self, '_sfdr') and self._sfdr: self._spatialPoolerOutput = numpy.zeros(self.columnCount, dtype=GetNTAReal()) else: self._spatialPoolerOutput = ...
def _initEphemerals(self): """ Initialize all ephemerals used by derived classes. """ if hasattr(self, '_sfdr') and self._sfdr: self._spatialPoolerOutput = numpy.zeros(self.columnCount, dtype=GetNTAReal()) else: self._spatialPoolerOutput = ...
[ "Initialize", "all", "ephemerals", "used", "by", "derived", "classes", "." ]
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/regions/sp_region.py#L940-L957
[ "def", "_initEphemerals", "(", "self", ")", ":", "if", "hasattr", "(", "self", ",", "'_sfdr'", ")", "and", "self", ".", "_sfdr", ":", "self", ".", "_spatialPoolerOutput", "=", "numpy", ".", "zeros", "(", "self", ".", "columnCount", ",", "dtype", "=", "...
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
SPRegion.getParameterArrayCount
Overrides :meth:`~nupic.bindings.regions.PyRegion.PyRegion.getParameterArrayCount`. TODO: as a temporary hack, getParameterArrayCount checks to see if there's a variable, private or not, with that name. If so, it returns the value of the variable.
src/nupic/regions/sp_region.py
def getParameterArrayCount(self, name, index): """ Overrides :meth:`~nupic.bindings.regions.PyRegion.PyRegion.getParameterArrayCount`. TODO: as a temporary hack, getParameterArrayCount checks to see if there's a variable, private or not, with that name. If so, it returns the value of the variable. ...
def getParameterArrayCount(self, name, index): """ Overrides :meth:`~nupic.bindings.regions.PyRegion.PyRegion.getParameterArrayCount`. TODO: as a temporary hack, getParameterArrayCount checks to see if there's a variable, private or not, with that name. If so, it returns the value of the variable. ...
[ "Overrides", ":", "meth", ":", "~nupic", ".", "bindings", ".", "regions", ".", "PyRegion", ".", "PyRegion", ".", "getParameterArrayCount", "." ]
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/regions/sp_region.py#L1034-L1045
[ "def", "getParameterArrayCount", "(", "self", ",", "name", ",", "index", ")", ":", "p", "=", "self", ".", "getParameter", "(", "name", ")", "if", "(", "not", "hasattr", "(", "p", ",", "'__len__'", ")", ")", ":", "raise", "Exception", "(", "\"Attempt to...
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
SPRegion.getParameterArray
Overrides :meth:`~nupic.bindings.regions.PyRegion.PyRegion.getParameterArray`. TODO: as a temporary hack, getParameterArray checks to see if there's a variable, private or not, with that name. If so, it returns the value of the variable.
src/nupic/regions/sp_region.py
def getParameterArray(self, name, index, a): """ Overrides :meth:`~nupic.bindings.regions.PyRegion.PyRegion.getParameterArray`. TODO: as a temporary hack, getParameterArray checks to see if there's a variable, private or not, with that name. If so, it returns the value of the variable. """ ...
def getParameterArray(self, name, index, a): """ Overrides :meth:`~nupic.bindings.regions.PyRegion.PyRegion.getParameterArray`. TODO: as a temporary hack, getParameterArray checks to see if there's a variable, private or not, with that name. If so, it returns the value of the variable. """ ...
[ "Overrides", ":", "meth", ":", "~nupic", ".", "bindings", ".", "regions", ".", "PyRegion", ".", "PyRegion", ".", "getParameterArray", "." ]
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/regions/sp_region.py#L1048-L1061
[ "def", "getParameterArray", "(", "self", ",", "name", ",", "index", ",", "a", ")", ":", "p", "=", "self", ".", "getParameter", "(", "name", ")", "if", "(", "not", "hasattr", "(", "p", ",", "'__len__'", ")", ")", ":", "raise", "Exception", "(", "\"A...
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
FunctionSource._cacheSequenceInfoType
Figure out whether reset, sequenceId, both or neither are present in the data. Compute once instead of every time. Taken from filesource.py
src/nupic/data/function_source.py
def _cacheSequenceInfoType(self): """Figure out whether reset, sequenceId, both or neither are present in the data. Compute once instead of every time. Taken from filesource.py""" hasReset = self.resetFieldName is not None hasSequenceId = self.sequenceIdFieldName is not None if hasReset a...
def _cacheSequenceInfoType(self): """Figure out whether reset, sequenceId, both or neither are present in the data. Compute once instead of every time. Taken from filesource.py""" hasReset = self.resetFieldName is not None hasSequenceId = self.sequenceIdFieldName is not None if hasReset a...
[ "Figure", "out", "whether", "reset", "sequenceId", "both", "or", "neither", "are", "present", "in", "the", "data", ".", "Compute", "once", "instead", "of", "every", "time", "." ]
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/data/function_source.py#L51-L70
[ "def", "_cacheSequenceInfoType", "(", "self", ")", ":", "hasReset", "=", "self", ".", "resetFieldName", "is", "not", "None", "hasSequenceId", "=", "self", ".", "sequenceIdFieldName", "is", "not", "None", "if", "hasReset", "and", "not", "hasSequenceId", ":", "s...
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
_getTPClass
Return the class corresponding to the given temporalImp string
src/nupic/regions/tm_region.py
def _getTPClass(temporalImp): """ Return the class corresponding to the given temporalImp string """ if temporalImp == 'py': return backtracking_tm.BacktrackingTM elif temporalImp == 'cpp': return backtracking_tm_cpp.BacktrackingTMCPP elif temporalImp == 'tm_py': return backtracking_tm_shim.TMShi...
def _getTPClass(temporalImp): """ Return the class corresponding to the given temporalImp string """ if temporalImp == 'py': return backtracking_tm.BacktrackingTM elif temporalImp == 'cpp': return backtracking_tm_cpp.BacktrackingTMCPP elif temporalImp == 'tm_py': return backtracking_tm_shim.TMShi...
[ "Return", "the", "class", "corresponding", "to", "the", "given", "temporalImp", "string" ]
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/regions/tm_region.py#L45-L61
[ "def", "_getTPClass", "(", "temporalImp", ")", ":", "if", "temporalImp", "==", "'py'", ":", "return", "backtracking_tm", ".", "BacktrackingTM", "elif", "temporalImp", "==", "'cpp'", ":", "return", "backtracking_tm_cpp", ".", "BacktrackingTMCPP", "elif", "temporalImp...
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
_buildArgs
Get the default arguments from the function and assign as instance vars. Return a list of 3-tuples with (name, description, defaultValue) for each argument to the function. Assigns all arguments to the function as instance variables of TMRegion. If the argument was not provided, uses the default value. P...
src/nupic/regions/tm_region.py
def _buildArgs(f, self=None, kwargs={}): """ Get the default arguments from the function and assign as instance vars. Return a list of 3-tuples with (name, description, defaultValue) for each argument to the function. Assigns all arguments to the function as instance variables of TMRegion. If the argume...
def _buildArgs(f, self=None, kwargs={}): """ Get the default arguments from the function and assign as instance vars. Return a list of 3-tuples with (name, description, defaultValue) for each argument to the function. Assigns all arguments to the function as instance variables of TMRegion. If the argume...
[ "Get", "the", "default", "arguments", "from", "the", "function", "and", "assign", "as", "instance", "vars", "." ]
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/regions/tm_region.py#L65-L114
[ "def", "_buildArgs", "(", "f", ",", "self", "=", "None", ",", "kwargs", "=", "{", "}", ")", ":", "# Get the name, description, and default value for each argument", "argTuples", "=", "getArgumentDescriptions", "(", "f", ")", "argTuples", "=", "argTuples", "[", "1"...
5922fafffdccc8812e72b3324965ad2f7d4bbdad