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
generatePlot
Generates a table where each cell represent a frequency of pairs as described below. x coordinate is the % difference between input records (origData list), y coordinate is the % difference between corresponding output records.
examples/opf/tools/sp_plotter.py
def generatePlot(outputs, origData): """ Generates a table where each cell represent a frequency of pairs as described below. x coordinate is the % difference between input records (origData list), y coordinate is the % difference between corresponding output records. """ PLOT_PRECISION = 100 distribMat...
def generatePlot(outputs, origData): """ Generates a table where each cell represent a frequency of pairs as described below. x coordinate is the % difference between input records (origData list), y coordinate is the % difference between corresponding output records. """ PLOT_PRECISION = 100 distribMat...
[ "Generates", "a", "table", "where", "each", "cell", "represent", "a", "frequency", "of", "pairs", "as", "described", "below", ".", "x", "coordinate", "is", "the", "%", "difference", "between", "input", "records", "(", "origData", "list", ")", "y", "coordinat...
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/examples/opf/tools/sp_plotter.py#L40-L88
[ "def", "generatePlot", "(", "outputs", ",", "origData", ")", ":", "PLOT_PRECISION", "=", "100", "distribMatrix", "=", "np", ".", "zeros", "(", "(", "PLOT_PRECISION", "+", "1", ",", "PLOT_PRECISION", "+", "1", ")", ")", "outputSize", "=", "len", "(", "out...
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
generateRandomInput
Generates a set of input record Params: numRecords - how many records to generate elemSize - the size of each record (num 0s or 1s) numSet - how many 1s in each record Returns: a list of inputs
examples/opf/tools/sp_plotter.py
def generateRandomInput(numRecords, elemSize = 400, numSet = 42): """ Generates a set of input record Params: numRecords - how many records to generate elemSize - the size of each record (num 0s or 1s) numSet - how many 1s in each record Returns: a list of inputs """ inputs = ...
def generateRandomInput(numRecords, elemSize = 400, numSet = 42): """ Generates a set of input record Params: numRecords - how many records to generate elemSize - the size of each record (num 0s or 1s) numSet - how many 1s in each record Returns: a list of inputs """ inputs = ...
[ "Generates", "a", "set", "of", "input", "record" ]
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/examples/opf/tools/sp_plotter.py#L92-L117
[ "def", "generateRandomInput", "(", "numRecords", ",", "elemSize", "=", "400", ",", "numSet", "=", "42", ")", ":", "inputs", "=", "[", "]", "for", "_", "in", "xrange", "(", "numRecords", ")", ":", "input", "=", "np", ".", "zeros", "(", "elemSize", ","...
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
appendInputWithSimilarValues
Creates an 'one-off' record for each record in the inputs. Appends new records to the same inputs list.
examples/opf/tools/sp_plotter.py
def appendInputWithSimilarValues(inputs): """ Creates an 'one-off' record for each record in the inputs. Appends new records to the same inputs list. """ numInputs = len(inputs) for i in xrange(numInputs): input = inputs[i] for j in xrange(len(input)-1): if input[j] == 1 and input[j+1] == 0: ...
def appendInputWithSimilarValues(inputs): """ Creates an 'one-off' record for each record in the inputs. Appends new records to the same inputs list. """ numInputs = len(inputs) for i in xrange(numInputs): input = inputs[i] for j in xrange(len(input)-1): if input[j] == 1 and input[j+1] == 0: ...
[ "Creates", "an", "one", "-", "off", "record", "for", "each", "record", "in", "the", "inputs", ".", "Appends", "new", "records", "to", "the", "same", "inputs", "list", "." ]
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/examples/opf/tools/sp_plotter.py#L121-L134
[ "def", "appendInputWithSimilarValues", "(", "inputs", ")", ":", "numInputs", "=", "len", "(", "inputs", ")", "for", "i", "in", "xrange", "(", "numInputs", ")", ":", "input", "=", "inputs", "[", "i", "]", "for", "j", "in", "xrange", "(", "len", "(", "...
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
appendInputWithNSimilarValues
Creates a neighboring record for each record in the inputs and adds new records at the end of the inputs list
examples/opf/tools/sp_plotter.py
def appendInputWithNSimilarValues(inputs, numNear = 10): """ Creates a neighboring record for each record in the inputs and adds new records at the end of the inputs list """ numInputs = len(inputs) skipOne = False for i in xrange(numInputs): input = inputs[i] numChanged = 0 newInput = copy.deep...
def appendInputWithNSimilarValues(inputs, numNear = 10): """ Creates a neighboring record for each record in the inputs and adds new records at the end of the inputs list """ numInputs = len(inputs) skipOne = False for i in xrange(numInputs): input = inputs[i] numChanged = 0 newInput = copy.deep...
[ "Creates", "a", "neighboring", "record", "for", "each", "record", "in", "the", "inputs", "and", "adds", "new", "records", "at", "the", "end", "of", "the", "inputs", "list" ]
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/examples/opf/tools/sp_plotter.py#L138-L162
[ "def", "appendInputWithNSimilarValues", "(", "inputs", ",", "numNear", "=", "10", ")", ":", "numInputs", "=", "len", "(", "inputs", ")", "skipOne", "=", "False", "for", "i", "in", "xrange", "(", "numInputs", ")", ":", "input", "=", "inputs", "[", "i", ...
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
modifyBits
Modifies up to maxChanges number of bits in the inputVal
examples/opf/tools/sp_plotter.py
def modifyBits(inputVal, maxChanges): """ Modifies up to maxChanges number of bits in the inputVal """ changes = np.random.random_integers(0, maxChanges, 1)[0] if changes == 0: return inputVal inputWidth = len(inputVal) whatToChange = np.random.random_integers(0, 41, changes) runningIndex = -1 n...
def modifyBits(inputVal, maxChanges): """ Modifies up to maxChanges number of bits in the inputVal """ changes = np.random.random_integers(0, maxChanges, 1)[0] if changes == 0: return inputVal inputWidth = len(inputVal) whatToChange = np.random.random_integers(0, 41, changes) runningIndex = -1 n...
[ "Modifies", "up", "to", "maxChanges", "number", "of", "bits", "in", "the", "inputVal" ]
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/examples/opf/tools/sp_plotter.py#L166-L190
[ "def", "modifyBits", "(", "inputVal", ",", "maxChanges", ")", ":", "changes", "=", "np", ".", "random", ".", "random_integers", "(", "0", ",", "maxChanges", ",", "1", ")", "[", "0", "]", "if", "changes", "==", "0", ":", "return", "inputVal", "inputWidt...
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
getRandomWithMods
Returns a random selection from the inputSpace with randomly modified up to maxChanges number of bits.
examples/opf/tools/sp_plotter.py
def getRandomWithMods(inputSpace, maxChanges): """ Returns a random selection from the inputSpace with randomly modified up to maxChanges number of bits. """ size = len(inputSpace) ind = np.random.random_integers(0, size-1, 1)[0] value = copy.deepcopy(inputSpace[ind]) if maxChanges == 0: return valu...
def getRandomWithMods(inputSpace, maxChanges): """ Returns a random selection from the inputSpace with randomly modified up to maxChanges number of bits. """ size = len(inputSpace) ind = np.random.random_integers(0, size-1, 1)[0] value = copy.deepcopy(inputSpace[ind]) if maxChanges == 0: return valu...
[ "Returns", "a", "random", "selection", "from", "the", "inputSpace", "with", "randomly", "modified", "up", "to", "maxChanges", "number", "of", "bits", "." ]
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/examples/opf/tools/sp_plotter.py#L194-L206
[ "def", "getRandomWithMods", "(", "inputSpace", ",", "maxChanges", ")", ":", "size", "=", "len", "(", "inputSpace", ")", "ind", "=", "np", ".", "random", ".", "random_integers", "(", "0", ",", "size", "-", "1", ",", "1", ")", "[", "0", "]", "value", ...
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
createEncoder
Creates and returns a #MultiEncoder including a ScalarEncoder for energy consumption and a DateEncoder for the time of the day. @see nupic/encoders/__init__.py for type to file-name mapping @see nupic/encoders for encoder source files
examples/network/hierarchy_network_demo.py
def createEncoder(): """ Creates and returns a #MultiEncoder including a ScalarEncoder for energy consumption and a DateEncoder for the time of the day. @see nupic/encoders/__init__.py for type to file-name mapping @see nupic/encoders for encoder source files """ encoder = MultiEncoder() encoder.addMul...
def createEncoder(): """ Creates and returns a #MultiEncoder including a ScalarEncoder for energy consumption and a DateEncoder for the time of the day. @see nupic/encoders/__init__.py for type to file-name mapping @see nupic/encoders for encoder source files """ encoder = MultiEncoder() encoder.addMul...
[ "Creates", "and", "returns", "a", "#MultiEncoder", "including", "a", "ScalarEncoder", "for", "energy", "consumption", "and", "a", "DateEncoder", "for", "the", "time", "of", "the", "day", "." ]
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/examples/network/hierarchy_network_demo.py#L105-L128
[ "def", "createEncoder", "(", ")", ":", "encoder", "=", "MultiEncoder", "(", ")", "encoder", ".", "addMultipleEncoders", "(", "{", "\"consumption\"", ":", "{", "\"fieldname\"", ":", "u\"consumption\"", ",", "\"type\"", ":", "\"ScalarEncoder\"", ",", "\"name\"", "...
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
createRecordSensor
Creates a RecordSensor region that allows us to specify a file record stream as the input source.
examples/network/hierarchy_network_demo.py
def createRecordSensor(network, name, dataSource): """ Creates a RecordSensor region that allows us to specify a file record stream as the input source. """ # Specific type of region. Possible options can be found in /nupic/regions/ regionType = "py.RecordSensor" # Creates a json from specified dictiona...
def createRecordSensor(network, name, dataSource): """ Creates a RecordSensor region that allows us to specify a file record stream as the input source. """ # Specific type of region. Possible options can be found in /nupic/regions/ regionType = "py.RecordSensor" # Creates a json from specified dictiona...
[ "Creates", "a", "RecordSensor", "region", "that", "allows", "us", "to", "specify", "a", "file", "record", "stream", "as", "the", "input", "source", "." ]
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/examples/network/hierarchy_network_demo.py#L132-L156
[ "def", "createRecordSensor", "(", "network", ",", "name", ",", "dataSource", ")", ":", "# Specific type of region. Possible options can be found in /nupic/regions/", "regionType", "=", "\"py.RecordSensor\"", "# Creates a json from specified dictionary.", "regionParams", "=", "json"...
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
createNetwork
Creates and returns a new Network with a sensor region reading data from 'dataSource'. There are two hierarchical levels, each with one SP and one TM. @param dataSource - A RecordStream containing the input data @returns a Network ready to run
examples/network/hierarchy_network_demo.py
def createNetwork(dataSource): """Creates and returns a new Network with a sensor region reading data from 'dataSource'. There are two hierarchical levels, each with one SP and one TM. @param dataSource - A RecordStream containing the input data @returns a Network ready to run """ network = Network() # C...
def createNetwork(dataSource): """Creates and returns a new Network with a sensor region reading data from 'dataSource'. There are two hierarchical levels, each with one SP and one TM. @param dataSource - A RecordStream containing the input data @returns a Network ready to run """ network = Network() # C...
[ "Creates", "and", "returns", "a", "new", "Network", "with", "a", "sensor", "region", "reading", "data", "from", "dataSource", ".", "There", "are", "two", "hierarchical", "levels", "each", "with", "one", "SP", "and", "one", "TM", "." ]
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/examples/network/hierarchy_network_demo.py#L191-L266
[ "def", "createNetwork", "(", "dataSource", ")", ":", "network", "=", "Network", "(", ")", "# Create and add a record sensor and a SP region", "sensor", "=", "createRecordSensor", "(", "network", ",", "name", "=", "_RECORD_SENSOR", ",", "dataSource", "=", "dataSource",...
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
runNetwork
Runs specified Network writing the ensuing anomaly scores to writer. @param network: The Network instance to be run @param writer: A csv.writer used to write to output file.
examples/network/hierarchy_network_demo.py
def runNetwork(network, numRecords, writer): """ Runs specified Network writing the ensuing anomaly scores to writer. @param network: The Network instance to be run @param writer: A csv.writer used to write to output file. """ sensorRegion = network.regions[_RECORD_SENSOR] l1SpRegion = network.regions[...
def runNetwork(network, numRecords, writer): """ Runs specified Network writing the ensuing anomaly scores to writer. @param network: The Network instance to be run @param writer: A csv.writer used to write to output file. """ sensorRegion = network.regions[_RECORD_SENSOR] l1SpRegion = network.regions[...
[ "Runs", "specified", "Network", "writing", "the", "ensuing", "anomaly", "scores", "to", "writer", "." ]
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/examples/network/hierarchy_network_demo.py#L270-L330
[ "def", "runNetwork", "(", "network", ",", "numRecords", ",", "writer", ")", ":", "sensorRegion", "=", "network", ".", "regions", "[", "_RECORD_SENSOR", "]", "l1SpRegion", "=", "network", ".", "regions", "[", "_L1_SPATIAL_POOLER", "]", "l1TpRegion", "=", "netwo...
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
clean
Removes trailing whitespace on each line.
src/nupic/swarming/hypersearch/object_json.py
def clean(s): """Removes trailing whitespace on each line.""" lines = [l.rstrip() for l in s.split('\n')] return '\n'.join(lines)
def clean(s): """Removes trailing whitespace on each line.""" lines = [l.rstrip() for l in s.split('\n')] return '\n'.join(lines)
[ "Removes", "trailing", "whitespace", "on", "each", "line", "." ]
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/swarming/hypersearch/object_json.py#L147-L150
[ "def", "clean", "(", "s", ")", ":", "lines", "=", "[", "l", ".", "rstrip", "(", ")", "for", "l", "in", "s", ".", "split", "(", "'\\n'", ")", "]", "return", "'\\n'", ".", "join", "(", "lines", ")" ]
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
MetricsManager.update
Compute the new metrics values, given the next inference/ground-truth values :param results: (:class:`~nupic.frameworks.opf.opf_utils.ModelResult`) object that was computed during the last iteration of the model. :returns: (dict) where each key is the metric-name, and the values are ...
src/nupic/frameworks/opf/prediction_metrics_manager.py
def update(self, results): """ Compute the new metrics values, given the next inference/ground-truth values :param results: (:class:`~nupic.frameworks.opf.opf_utils.ModelResult`) object that was computed during the last iteration of the model. :returns: (dict) where each key is the metric-...
def update(self, results): """ Compute the new metrics values, given the next inference/ground-truth values :param results: (:class:`~nupic.frameworks.opf.opf_utils.ModelResult`) object that was computed during the last iteration of the model. :returns: (dict) where each key is the metric-...
[ "Compute", "the", "new", "metrics", "values", "given", "the", "next", "inference", "/", "ground", "-", "truth", "values" ]
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/frameworks/opf/prediction_metrics_manager.py#L94-L156
[ "def", "update", "(", "self", ",", "results", ")", ":", "#print \"\\n\\n---------------------------------------------------------------\"", "#print \"Model results: \\nrawInput:%s \\ninferences:%s\" % \\", "# (pprint.pformat(results.rawInput), pprint.pformat(results.inferences))", "self",...
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
MetricsManager.getMetrics
Gets the current metric values :returns: (dict) where each key is the metric-name, and the values are it scalar value. Same as the output of :meth:`~nupic.frameworks.opf.prediction_metrics_manager.MetricsManager.update`
src/nupic/frameworks/opf/prediction_metrics_manager.py
def getMetrics(self): """ Gets the current metric values :returns: (dict) where each key is the metric-name, and the values are it scalar value. Same as the output of :meth:`~nupic.frameworks.opf.prediction_metrics_manager.MetricsManager.update` """ result = {} f...
def getMetrics(self): """ Gets the current metric values :returns: (dict) where each key is the metric-name, and the values are it scalar value. Same as the output of :meth:`~nupic.frameworks.opf.prediction_metrics_manager.MetricsManager.update` """ result = {} f...
[ "Gets", "the", "current", "metric", "values" ]
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/frameworks/opf/prediction_metrics_manager.py#L159-L174
[ "def", "getMetrics", "(", "self", ")", ":", "result", "=", "{", "}", "for", "metricObj", ",", "label", "in", "zip", "(", "self", ".", "__metrics", ",", "self", ".", "__metricLabels", ")", ":", "value", "=", "metricObj", ".", "getMetric", "(", ")", "r...
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
MetricsManager.getMetricDetails
Gets detailed info about a given metric, in addition to its value. This may including any statistics or auxilary data that are computed for a given metric. :param metricLabel: (string) label of the given metric (see :class:`~nupic.frameworks.opf.metrics.MetricSpec`) :returns: (dict) of met...
src/nupic/frameworks/opf/prediction_metrics_manager.py
def getMetricDetails(self, metricLabel): """ Gets detailed info about a given metric, in addition to its value. This may including any statistics or auxilary data that are computed for a given metric. :param metricLabel: (string) label of the given metric (see :class:`~nupic.frameworks...
def getMetricDetails(self, metricLabel): """ Gets detailed info about a given metric, in addition to its value. This may including any statistics or auxilary data that are computed for a given metric. :param metricLabel: (string) label of the given metric (see :class:`~nupic.frameworks...
[ "Gets", "detailed", "info", "about", "a", "given", "metric", "in", "addition", "to", "its", "value", ".", "This", "may", "including", "any", "statistics", "or", "auxilary", "data", "that", "are", "computed", "for", "a", "given", "metric", "." ]
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/frameworks/opf/prediction_metrics_manager.py#L177-L194
[ "def", "getMetricDetails", "(", "self", ",", "metricLabel", ")", ":", "try", ":", "metricIndex", "=", "self", ".", "__metricLabels", ".", "index", "(", "metricLabel", ")", "except", "IndexError", ":", "return", "None", "return", "self", ".", "__metrics", "["...
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
MetricsManager._addResults
Stores the current model results in the manager's internal store Parameters: ----------------------------------------------------------------------- results: A ModelResults object that contains the current timestep's input/inferences
src/nupic/frameworks/opf/prediction_metrics_manager.py
def _addResults(self, results): """ Stores the current model results in the manager's internal store Parameters: ----------------------------------------------------------------------- results: A ModelResults object that contains the current timestep's input/inferences """ # ...
def _addResults(self, results): """ Stores the current model results in the manager's internal store Parameters: ----------------------------------------------------------------------- results: A ModelResults object that contains the current timestep's input/inferences """ # ...
[ "Stores", "the", "current", "model", "results", "in", "the", "manager", "s", "internal", "store" ]
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/frameworks/opf/prediction_metrics_manager.py#L204-L229
[ "def", "_addResults", "(", "self", ",", "results", ")", ":", "# -----------------------------------------------------------------------", "# If the model potentially has temporal inferences.", "if", "self", ".", "__isTemporal", ":", "shiftedInferences", "=", "self", ".", "__inf...
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
MetricsManager._getGroundTruth
Get the actual value for this field Parameters: ----------------------------------------------------------------------- sensorInputElement: The inference element (part of the inference) that is being used for this metric
src/nupic/frameworks/opf/prediction_metrics_manager.py
def _getGroundTruth(self, inferenceElement): """ Get the actual value for this field Parameters: ----------------------------------------------------------------------- sensorInputElement: The inference element (part of the inference) that is being used for this me...
def _getGroundTruth(self, inferenceElement): """ Get the actual value for this field Parameters: ----------------------------------------------------------------------- sensorInputElement: The inference element (part of the inference) that is being used for this me...
[ "Get", "the", "actual", "value", "for", "this", "field" ]
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/frameworks/opf/prediction_metrics_manager.py#L232-L244
[ "def", "_getGroundTruth", "(", "self", ",", "inferenceElement", ")", ":", "sensorInputElement", "=", "InferenceElement", ".", "getInputElement", "(", "inferenceElement", ")", "if", "sensorInputElement", "is", "None", ":", "return", "None", "return", "getattr", "(", ...
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
MetricsManager.__constructMetricsModules
Creates the required metrics modules Parameters: ----------------------------------------------------------------------- metricSpecs: A sequence of MetricSpec objects that specify which metric modules to instantiate
src/nupic/frameworks/opf/prediction_metrics_manager.py
def __constructMetricsModules(self, metricSpecs): """ Creates the required metrics modules Parameters: ----------------------------------------------------------------------- metricSpecs: A sequence of MetricSpec objects that specify which metric modules to instantiate """ if no...
def __constructMetricsModules(self, metricSpecs): """ Creates the required metrics modules Parameters: ----------------------------------------------------------------------- metricSpecs: A sequence of MetricSpec objects that specify which metric modules to instantiate """ if no...
[ "Creates", "the", "required", "metrics", "modules" ]
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/frameworks/opf/prediction_metrics_manager.py#L275-L294
[ "def", "__constructMetricsModules", "(", "self", ",", "metricSpecs", ")", ":", "if", "not", "metricSpecs", ":", "return", "self", ".", "__metricSpecs", "=", "metricSpecs", "for", "spec", "in", "metricSpecs", ":", "if", "not", "InferenceElement", ".", "validate",...
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
_generateSimple
Generate a simple dataset. This contains a bunch of non-overlapping sequences. At the end of the dataset, we introduce missing records so that test code can insure that the model didn't get confused by them. Parameters: ---------------------------------------------------- filename: name of the...
examples/opf/experiments/missing_record/make_datasets.py
def _generateSimple(filename="simple.csv", numSequences=1, elementsPerSeq=3, numRepeats=10): """ Generate a simple dataset. This contains a bunch of non-overlapping sequences. At the end of the dataset, we introduce missing records so that test code can insure that the model didn't get ...
def _generateSimple(filename="simple.csv", numSequences=1, elementsPerSeq=3, numRepeats=10): """ Generate a simple dataset. This contains a bunch of non-overlapping sequences. At the end of the dataset, we introduce missing records so that test code can insure that the model didn't get ...
[ "Generate", "a", "simple", "dataset", ".", "This", "contains", "a", "bunch", "of", "non", "-", "overlapping", "sequences", ".", "At", "the", "end", "of", "the", "dataset", "we", "introduce", "missing", "records", "so", "that", "test", "code", "can", "insur...
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/examples/opf/experiments/missing_record/make_datasets.py#L35-L110
[ "def", "_generateSimple", "(", "filename", "=", "\"simple.csv\"", ",", "numSequences", "=", "1", ",", "elementsPerSeq", "=", "3", ",", "numRepeats", "=", "10", ")", ":", "# Create the output file", "scriptDir", "=", "os", ".", "path", ".", "dirname", "(", "_...
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
InferenceShifter.shift
Shift the model result and return the new instance. Queues up the T(i+1) prediction value and emits a T(i) input/prediction pair, if possible. E.g., if the previous T(i-1) iteration was learn-only, then we would not have a T(i) prediction in our FIFO and would not be able to emit a meaningful input/pre...
src/nupic/data/inference_shifter.py
def shift(self, modelResult): """Shift the model result and return the new instance. Queues up the T(i+1) prediction value and emits a T(i) input/prediction pair, if possible. E.g., if the previous T(i-1) iteration was learn-only, then we would not have a T(i) prediction in our FIFO and would not b...
def shift(self, modelResult): """Shift the model result and return the new instance. Queues up the T(i+1) prediction value and emits a T(i) input/prediction pair, if possible. E.g., if the previous T(i-1) iteration was learn-only, then we would not have a T(i) prediction in our FIFO and would not b...
[ "Shift", "the", "model", "result", "and", "return", "the", "new", "instance", "." ]
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/data/inference_shifter.py#L40-L88
[ "def", "shift", "(", "self", ",", "modelResult", ")", ":", "inferencesToWrite", "=", "{", "}", "if", "self", ".", "_inferenceBuffer", "is", "None", ":", "maxDelay", "=", "InferenceElement", ".", "getMaxDelay", "(", "modelResult", ".", "inferences", ")", "sel...
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
generateStats
Collect statistics for each of the fields in the user input data file and return a stats dict object. Parameters: ------------------------------------------------------------------------------ filename: The path and name of the data file. maxSamples: Upper bound on the number of rows to...
src/nupic/data/stats_v2.py
def generateStats(filename, maxSamples = None,): """ Collect statistics for each of the fields in the user input data file and return a stats dict object. Parameters: ------------------------------------------------------------------------------ filename: The path and name of the data file. m...
def generateStats(filename, maxSamples = None,): """ Collect statistics for each of the fields in the user input data file and return a stats dict object. Parameters: ------------------------------------------------------------------------------ filename: The path and name of the data file. m...
[ "Collect", "statistics", "for", "each", "of", "the", "fields", "in", "the", "user", "input", "data", "file", "and", "return", "a", "stats", "dict", "object", "." ]
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/data/stats_v2.py#L240-L308
[ "def", "generateStats", "(", "filename", ",", "maxSamples", "=", "None", ",", ")", ":", "# Mapping from field type to stats collector object", "statsCollectorMapping", "=", "{", "'float'", ":", "FloatStatsCollector", ",", "'int'", ":", "IntStatsCollector", ",", "'string...
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
NumberStatsCollector.getStats
Override of getStats() in BaseStatsCollector stats: A dictionary where all the stats are outputted
src/nupic/data/stats_v2.py
def getStats(self, stats): """ Override of getStats() in BaseStatsCollector stats: A dictionary where all the stats are outputted """ BaseStatsCollector.getStats(self, stats) sortedNumberList = sorted(self.valueList) listLength = len(sortedNumberList) min = sortedNumberList[0...
def getStats(self, stats): """ Override of getStats() in BaseStatsCollector stats: A dictionary where all the stats are outputted """ BaseStatsCollector.getStats(self, stats) sortedNumberList = sorted(self.valueList) listLength = len(sortedNumberList) min = sortedNumberList[0...
[ "Override", "of", "getStats", "()", "in", "BaseStatsCollector" ]
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/data/stats_v2.py#L119-L178
[ "def", "getStats", "(", "self", ",", "stats", ")", ":", "BaseStatsCollector", ".", "getStats", "(", "self", ",", "stats", ")", "sortedNumberList", "=", "sorted", "(", "self", ".", "valueList", ")", "listLength", "=", "len", "(", "sortedNumberList", ")", "m...
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
main
Run according to options in sys.argv and diff classifiers.
scripts/run_experiment_classifier_diff.py
def main(): """Run according to options in sys.argv and diff classifiers.""" initLogging(verbose=True) # Initialize PRNGs initExperimentPrng() # Mock out the creation of the SDRClassifier. @staticmethod def _mockCreate(*args, **kwargs): kwargs.pop('implementation', None) return SDRClassifierDiff...
def main(): """Run according to options in sys.argv and diff classifiers.""" initLogging(verbose=True) # Initialize PRNGs initExperimentPrng() # Mock out the creation of the SDRClassifier. @staticmethod def _mockCreate(*args, **kwargs): kwargs.pop('implementation', None) return SDRClassifierDiff...
[ "Run", "according", "to", "options", "in", "sys", ".", "argv", "and", "diff", "classifiers", "." ]
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/scripts/run_experiment_classifier_diff.py#L36-L51
[ "def", "main", "(", ")", ":", "initLogging", "(", "verbose", "=", "True", ")", "# Initialize PRNGs", "initExperimentPrng", "(", ")", "# Mock out the creation of the SDRClassifier.", "@", "staticmethod", "def", "_mockCreate", "(", "*", "args", ",", "*", "*", "kwarg...
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
_abbreviate
Abbreviate the given text to threshold chars and append an ellipsis if its length exceeds threshold; used for logging; NOTE: the resulting text could be longer than threshold due to the ellipsis
src/nupic/database/client_jobs_dao.py
def _abbreviate(text, threshold): """ Abbreviate the given text to threshold chars and append an ellipsis if its length exceeds threshold; used for logging; NOTE: the resulting text could be longer than threshold due to the ellipsis """ if text is not None and len(text) > threshold: text = text[:threshol...
def _abbreviate(text, threshold): """ Abbreviate the given text to threshold chars and append an ellipsis if its length exceeds threshold; used for logging; NOTE: the resulting text could be longer than threshold due to the ellipsis """ if text is not None and len(text) > threshold: text = text[:threshol...
[ "Abbreviate", "the", "given", "text", "to", "threshold", "chars", "and", "append", "an", "ellipsis", "if", "its", "length", "exceeds", "threshold", ";", "used", "for", "logging", ";" ]
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/database/client_jobs_dao.py#L62-L71
[ "def", "_abbreviate", "(", "text", ",", "threshold", ")", ":", "if", "text", "is", "not", "None", "and", "len", "(", "text", ")", ">", "threshold", ":", "text", "=", "text", "[", ":", "threshold", "]", "+", "\"...\"", "return", "text" ]
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
ClientJobsDAO.__getDBNameForVersion
Generates the ClientJobs database name for the given version of the database Parameters: ---------------------------------------------------------------- dbVersion: ClientJobs database version number retval: the ClientJobs database name for the given DB version
src/nupic/database/client_jobs_dao.py
def __getDBNameForVersion(cls, dbVersion): """ Generates the ClientJobs database name for the given version of the database Parameters: ---------------------------------------------------------------- dbVersion: ClientJobs database version number retval: the ClientJobs database na...
def __getDBNameForVersion(cls, dbVersion): """ Generates the ClientJobs database name for the given version of the database Parameters: ---------------------------------------------------------------- dbVersion: ClientJobs database version number retval: the ClientJobs database na...
[ "Generates", "the", "ClientJobs", "database", "name", "for", "the", "given", "version", "of", "the", "database" ]
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/database/client_jobs_dao.py#L507-L531
[ "def", "__getDBNameForVersion", "(", "cls", ",", "dbVersion", ")", ":", "# DB Name prefix for the given version", "prefix", "=", "cls", ".", "__getDBNamePrefixForVersion", "(", "dbVersion", ")", "# DB Name suffix", "suffix", "=", "Configuration", ".", "get", "(", "'nu...
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
ClientJobsDAO.get
Get the instance of the ClientJobsDAO created for this process (or perhaps at some point in the future, for this thread). Parameters: ---------------------------------------------------------------- retval: instance of ClientJobsDAO
src/nupic/database/client_jobs_dao.py
def get(): """ Get the instance of the ClientJobsDAO created for this process (or perhaps at some point in the future, for this thread). Parameters: ---------------------------------------------------------------- retval: instance of ClientJobsDAO """ # Instantiate if needed if Client...
def get(): """ Get the instance of the ClientJobsDAO created for this process (or perhaps at some point in the future, for this thread). Parameters: ---------------------------------------------------------------- retval: instance of ClientJobsDAO """ # Instantiate if needed if Client...
[ "Get", "the", "instance", "of", "the", "ClientJobsDAO", "created", "for", "this", "process", "(", "or", "perhaps", "at", "some", "point", "in", "the", "future", "for", "this", "thread", ")", "." ]
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/database/client_jobs_dao.py#L536-L553
[ "def", "get", "(", ")", ":", "# Instantiate if needed", "if", "ClientJobsDAO", ".", "_instance", "is", "None", ":", "cjDAO", "=", "ClientJobsDAO", "(", ")", "cjDAO", ".", "connect", "(", ")", "ClientJobsDAO", ".", "_instance", "=", "cjDAO", "# Return the insta...
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
ClientJobsDAO._columnNameDBToPublic
Convert a database internal column name to a public name. This takes something of the form word1_word2_word3 and converts it to: word1Word2Word3. If the db field name starts with '_', it is stripped out so that the name is compatible with collections.namedtuple. for example: _word1_word2_word3 => word1W...
src/nupic/database/client_jobs_dao.py
def _columnNameDBToPublic(self, dbName): """ Convert a database internal column name to a public name. This takes something of the form word1_word2_word3 and converts it to: word1Word2Word3. If the db field name starts with '_', it is stripped out so that the name is compatible with collections.namedtup...
def _columnNameDBToPublic(self, dbName): """ Convert a database internal column name to a public name. This takes something of the form word1_word2_word3 and converts it to: word1Word2Word3. If the db field name starts with '_', it is stripped out so that the name is compatible with collections.namedtup...
[ "Convert", "a", "database", "internal", "column", "name", "to", "a", "public", "name", ".", "This", "takes", "something", "of", "the", "form", "word1_word2_word3", "and", "converts", "it", "to", ":", "word1Word2Word3", ".", "If", "the", "db", "field", "name"...
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/database/client_jobs_dao.py#L593-L613
[ "def", "_columnNameDBToPublic", "(", "self", ",", "dbName", ")", ":", "words", "=", "dbName", ".", "split", "(", "'_'", ")", "if", "dbName", ".", "startswith", "(", "'_'", ")", ":", "words", "=", "words", "[", "1", ":", "]", "pubWords", "=", "[", "...
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
ClientJobsDAO.connect
Locate the current version of the jobs DB or create a new one, and optionally delete old versions laying around. If desired, this method can be called at any time to re-create the tables from scratch, delete old versions of the database, etc. Parameters: --------------------------------------------...
src/nupic/database/client_jobs_dao.py
def connect(self, deleteOldVersions=False, recreate=False): """ Locate the current version of the jobs DB or create a new one, and optionally delete old versions laying around. If desired, this method can be called at any time to re-create the tables from scratch, delete old versions of the database, et...
def connect(self, deleteOldVersions=False, recreate=False): """ Locate the current version of the jobs DB or create a new one, and optionally delete old versions laying around. If desired, this method can be called at any time to re-create the tables from scratch, delete old versions of the database, et...
[ "Locate", "the", "current", "version", "of", "the", "jobs", "DB", "or", "create", "a", "new", "one", "and", "optionally", "delete", "old", "versions", "laying", "around", ".", "If", "desired", "this", "method", "can", "be", "called", "at", "any", "time", ...
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/database/client_jobs_dao.py#L618-L643
[ "def", "connect", "(", "self", ",", "deleteOldVersions", "=", "False", ",", "recreate", "=", "False", ")", ":", "# Initialize tables, if needed", "with", "ConnectionFactory", ".", "get", "(", ")", "as", "conn", ":", "# Initialize tables", "self", ".", "_initTabl...
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
ClientJobsDAO._initTables
Initialize tables, if needed Parameters: ---------------------------------------------------------------- cursor: SQL cursor deleteOldVersions: if true, delete any old versions of the DB left on the server recreate: if true, recreate the database ...
src/nupic/database/client_jobs_dao.py
def _initTables(self, cursor, deleteOldVersions, recreate): """ Initialize tables, if needed Parameters: ---------------------------------------------------------------- cursor: SQL cursor deleteOldVersions: if true, delete any old versions of the DB left on...
def _initTables(self, cursor, deleteOldVersions, recreate): """ Initialize tables, if needed Parameters: ---------------------------------------------------------------- cursor: SQL cursor deleteOldVersions: if true, delete any old versions of the DB left on...
[ "Initialize", "tables", "if", "needed" ]
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/database/client_jobs_dao.py#L647-L925
[ "def", "_initTables", "(", "self", ",", "cursor", ",", "deleteOldVersions", ",", "recreate", ")", ":", "# Delete old versions if they exist", "if", "deleteOldVersions", ":", "self", ".", "_logger", ".", "info", "(", "\"Dropping old versions of client_jobs DB; called from:...
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
ClientJobsDAO._getMatchingRowsNoRetries
Return a sequence of matching rows with the requested field values from a table or empty sequence if nothing matched. tableInfo: Table information: a ClientJobsDAO._TableInfoBase instance conn: Owned connection acquired from ConnectionFactory.get() fieldsToMatch: Dictionary of inter...
src/nupic/database/client_jobs_dao.py
def _getMatchingRowsNoRetries(self, tableInfo, conn, fieldsToMatch, selectFieldNames, maxRows=None): """ Return a sequence of matching rows with the requested field values from a table or empty sequence if nothing matched. tableInfo: Table information: a ClientJobsDAO....
def _getMatchingRowsNoRetries(self, tableInfo, conn, fieldsToMatch, selectFieldNames, maxRows=None): """ Return a sequence of matching rows with the requested field values from a table or empty sequence if nothing matched. tableInfo: Table information: a ClientJobsDAO....
[ "Return", "a", "sequence", "of", "matching", "rows", "with", "the", "requested", "field", "values", "from", "a", "table", "or", "empty", "sequence", "if", "nothing", "matched", "." ]
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/database/client_jobs_dao.py#L928-L991
[ "def", "_getMatchingRowsNoRetries", "(", "self", ",", "tableInfo", ",", "conn", ",", "fieldsToMatch", ",", "selectFieldNames", ",", "maxRows", "=", "None", ")", ":", "assert", "fieldsToMatch", ",", "repr", "(", "fieldsToMatch", ")", "assert", "all", "(", "k", ...
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
ClientJobsDAO._getMatchingRowsWithRetries
Like _getMatchingRowsNoRetries(), but with retries on transient MySQL failures
src/nupic/database/client_jobs_dao.py
def _getMatchingRowsWithRetries(self, tableInfo, fieldsToMatch, selectFieldNames, maxRows=None): """ Like _getMatchingRowsNoRetries(), but with retries on transient MySQL failures """ with ConnectionFactory.get() as conn: return self._getMatchingRowsNoRetries(tabl...
def _getMatchingRowsWithRetries(self, tableInfo, fieldsToMatch, selectFieldNames, maxRows=None): """ Like _getMatchingRowsNoRetries(), but with retries on transient MySQL failures """ with ConnectionFactory.get() as conn: return self._getMatchingRowsNoRetries(tabl...
[ "Like", "_getMatchingRowsNoRetries", "()", "but", "with", "retries", "on", "transient", "MySQL", "failures" ]
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/database/client_jobs_dao.py#L995-L1002
[ "def", "_getMatchingRowsWithRetries", "(", "self", ",", "tableInfo", ",", "fieldsToMatch", ",", "selectFieldNames", ",", "maxRows", "=", "None", ")", ":", "with", "ConnectionFactory", ".", "get", "(", ")", "as", "conn", ":", "return", "self", ".", "_getMatchin...
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
ClientJobsDAO._getOneMatchingRowNoRetries
Return a single matching row with the requested field values from the the requested table or None if nothing matched. tableInfo: Table information: a ClientJobsDAO._TableInfoBase instance conn: Owned connection acquired from ConnectionFactory.get() fieldsToMatch: Dictionary of inter...
src/nupic/database/client_jobs_dao.py
def _getOneMatchingRowNoRetries(self, tableInfo, conn, fieldsToMatch, selectFieldNames): """ Return a single matching row with the requested field values from the the requested table or None if nothing matched. tableInfo: Table information: a ClientJobsDAO._TableInfo...
def _getOneMatchingRowNoRetries(self, tableInfo, conn, fieldsToMatch, selectFieldNames): """ Return a single matching row with the requested field values from the the requested table or None if nothing matched. tableInfo: Table information: a ClientJobsDAO._TableInfo...
[ "Return", "a", "single", "matching", "row", "with", "the", "requested", "field", "values", "from", "the", "the", "requested", "table", "or", "None", "if", "nothing", "matched", "." ]
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/database/client_jobs_dao.py#L1005-L1033
[ "def", "_getOneMatchingRowNoRetries", "(", "self", ",", "tableInfo", ",", "conn", ",", "fieldsToMatch", ",", "selectFieldNames", ")", ":", "rows", "=", "self", ".", "_getMatchingRowsNoRetries", "(", "tableInfo", ",", "conn", ",", "fieldsToMatch", ",", "selectField...
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
ClientJobsDAO._getOneMatchingRowWithRetries
Like _getOneMatchingRowNoRetries(), but with retries on transient MySQL failures
src/nupic/database/client_jobs_dao.py
def _getOneMatchingRowWithRetries(self, tableInfo, fieldsToMatch, selectFieldNames): """ Like _getOneMatchingRowNoRetries(), but with retries on transient MySQL failures """ with ConnectionFactory.get() as conn: return self._getOneMatchingRowNoRetries(tableInfo,...
def _getOneMatchingRowWithRetries(self, tableInfo, fieldsToMatch, selectFieldNames): """ Like _getOneMatchingRowNoRetries(), but with retries on transient MySQL failures """ with ConnectionFactory.get() as conn: return self._getOneMatchingRowNoRetries(tableInfo,...
[ "Like", "_getOneMatchingRowNoRetries", "()", "but", "with", "retries", "on", "transient", "MySQL", "failures" ]
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/database/client_jobs_dao.py#L1037-L1044
[ "def", "_getOneMatchingRowWithRetries", "(", "self", ",", "tableInfo", ",", "fieldsToMatch", ",", "selectFieldNames", ")", ":", "with", "ConnectionFactory", ".", "get", "(", ")", "as", "conn", ":", "return", "self", ".", "_getOneMatchingRowNoRetries", "(", "tableI...
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
ClientJobsDAO._insertOrGetUniqueJobNoRetries
Attempt to insert a row with the given parameters into the jobs table. Return jobID of the inserted row, or of an existing row with matching client/jobHash key. The combination of client and jobHash are expected to be unique (enforced by a unique index on the two columns). NOTE: It's possibe that ...
src/nupic/database/client_jobs_dao.py
def _insertOrGetUniqueJobNoRetries( self, conn, client, cmdLine, jobHash, clientInfo, clientKey, params, minimumWorkers, maximumWorkers, jobType, priority, alreadyRunning): """ Attempt to insert a row with the given parameters into the jobs table. Return jobID of the inserted row, or of an existing row ...
def _insertOrGetUniqueJobNoRetries( self, conn, client, cmdLine, jobHash, clientInfo, clientKey, params, minimumWorkers, maximumWorkers, jobType, priority, alreadyRunning): """ Attempt to insert a row with the given parameters into the jobs table. Return jobID of the inserted row, or of an existing row ...
[ "Attempt", "to", "insert", "a", "row", "with", "the", "given", "parameters", "into", "the", "jobs", "table", ".", "Return", "jobID", "of", "the", "inserted", "row", "or", "of", "an", "existing", "row", "with", "matching", "client", "/", "jobHash", "key", ...
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/database/client_jobs_dao.py#L1059-L1178
[ "def", "_insertOrGetUniqueJobNoRetries", "(", "self", ",", "conn", ",", "client", ",", "cmdLine", ",", "jobHash", ",", "clientInfo", ",", "clientKey", ",", "params", ",", "minimumWorkers", ",", "maximumWorkers", ",", "jobType", ",", "priority", ",", "alreadyRunn...
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
ClientJobsDAO._resumeJobNoRetries
Resumes processing of an existing job that is presently in the STATUS_COMPLETED state. NOTE: this is primarily for resuming suspended Production and Stream Jobs; DO NOT use it on Hypersearch jobs. This prepares an existing job entry to resume processing. The CJM is always periodically sweeping th...
src/nupic/database/client_jobs_dao.py
def _resumeJobNoRetries(self, conn, jobID, alreadyRunning): """ Resumes processing of an existing job that is presently in the STATUS_COMPLETED state. NOTE: this is primarily for resuming suspended Production and Stream Jobs; DO NOT use it on Hypersearch jobs. This prepares an existing job entry ...
def _resumeJobNoRetries(self, conn, jobID, alreadyRunning): """ Resumes processing of an existing job that is presently in the STATUS_COMPLETED state. NOTE: this is primarily for resuming suspended Production and Stream Jobs; DO NOT use it on Hypersearch jobs. This prepares an existing job entry ...
[ "Resumes", "processing", "of", "an", "existing", "job", "that", "is", "presently", "in", "the", "STATUS_COMPLETED", "state", "." ]
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/database/client_jobs_dao.py#L1181-L1260
[ "def", "_resumeJobNoRetries", "(", "self", ",", "conn", ",", "jobID", ",", "alreadyRunning", ")", ":", "# Initial status", "if", "alreadyRunning", ":", "# Use STATUS_TESTMODE so scheduler will leave our row alone", "initStatus", "=", "self", ".", "STATUS_TESTMODE", "else"...
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
ClientJobsDAO.jobResume
Resumes processing of an existing job that is presently in the STATUS_COMPLETED state. NOTE: this is primarily for resuming suspended Production Jobs; DO NOT use it on Hypersearch jobs. NOTE: The job MUST be in the STATUS_COMPLETED state at the time of this call, otherwise an exception will be rai...
src/nupic/database/client_jobs_dao.py
def jobResume(self, jobID, alreadyRunning=False): """ Resumes processing of an existing job that is presently in the STATUS_COMPLETED state. NOTE: this is primarily for resuming suspended Production Jobs; DO NOT use it on Hypersearch jobs. NOTE: The job MUST be in the STATUS_COMPLETED state at the...
def jobResume(self, jobID, alreadyRunning=False): """ Resumes processing of an existing job that is presently in the STATUS_COMPLETED state. NOTE: this is primarily for resuming suspended Production Jobs; DO NOT use it on Hypersearch jobs. NOTE: The job MUST be in the STATUS_COMPLETED state at the...
[ "Resumes", "processing", "of", "an", "existing", "job", "that", "is", "presently", "in", "the", "STATUS_COMPLETED", "state", "." ]
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/database/client_jobs_dao.py#L1304-L1347
[ "def", "jobResume", "(", "self", ",", "jobID", ",", "alreadyRunning", "=", "False", ")", ":", "row", "=", "self", ".", "jobGetFields", "(", "jobID", ",", "[", "'status'", "]", ")", "(", "jobStatus", ",", ")", "=", "row", "if", "jobStatus", "!=", "sel...
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
ClientJobsDAO.jobInsert
Add an entry to the jobs table for a new job request. This is called by clients that wish to startup a new job, like a Hypersearch, stream job, or specific model evaluation from the engine. This puts a new entry into the jobs table. The CJM is always periodically sweeping the jobs table and when it fin...
src/nupic/database/client_jobs_dao.py
def jobInsert(self, client, cmdLine, clientInfo='', clientKey='', params='', alreadyRunning=False, minimumWorkers=0, maximumWorkers=0, jobType='', priority=DEFAULT_JOB_PRIORITY): """ Add an entry to the jobs table for a new job request. This is called by clients that wish to star...
def jobInsert(self, client, cmdLine, clientInfo='', clientKey='', params='', alreadyRunning=False, minimumWorkers=0, maximumWorkers=0, jobType='', priority=DEFAULT_JOB_PRIORITY): """ Add an entry to the jobs table for a new job request. This is called by clients that wish to star...
[ "Add", "an", "entry", "to", "the", "jobs", "table", "for", "a", "new", "job", "request", ".", "This", "is", "called", "by", "clients", "that", "wish", "to", "startup", "a", "new", "job", "like", "a", "Hypersearch", "stream", "job", "or", "specific", "m...
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/database/client_jobs_dao.py#L1351-L1425
[ "def", "jobInsert", "(", "self", ",", "client", ",", "cmdLine", ",", "clientInfo", "=", "''", ",", "clientKey", "=", "''", ",", "params", "=", "''", ",", "alreadyRunning", "=", "False", ",", "minimumWorkers", "=", "0", ",", "maximumWorkers", "=", "0", ...
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
ClientJobsDAO.jobInsertUnique
Add an entry to the jobs table for a new job request, but only if the same job, by the same client is not already running. If the job is already running, or queued up to run, this call does nothing. If the job does not exist in the jobs table or has completed, it will be inserted and/or started up again...
src/nupic/database/client_jobs_dao.py
def jobInsertUnique(self, client, cmdLine, jobHash, clientInfo='', clientKey='', params='', minimumWorkers=0, maximumWorkers=0, jobType='', priority=DEFAULT_JOB_PRIORITY): """ Add an entry to the jobs table for a new job request, but only if the ...
def jobInsertUnique(self, client, cmdLine, jobHash, clientInfo='', clientKey='', params='', minimumWorkers=0, maximumWorkers=0, jobType='', priority=DEFAULT_JOB_PRIORITY): """ Add an entry to the jobs table for a new job request, but only if the ...
[ "Add", "an", "entry", "to", "the", "jobs", "table", "for", "a", "new", "job", "request", "but", "only", "if", "the", "same", "job", "by", "the", "same", "client", "is", "not", "already", "running", ".", "If", "the", "job", "is", "already", "running", ...
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/database/client_jobs_dao.py#L1429-L1545
[ "def", "jobInsertUnique", "(", "self", ",", "client", ",", "cmdLine", ",", "jobHash", ",", "clientInfo", "=", "''", ",", "clientKey", "=", "''", ",", "params", "=", "''", ",", "minimumWorkers", "=", "0", ",", "maximumWorkers", "=", "0", ",", "jobType", ...
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
ClientJobsDAO._startJobWithRetries
Place the given job in STATUS_RUNNING mode; the job is expected to be STATUS_NOTSTARTED. NOTE: this function was factored out of jobStartNext because it's also needed for testing (e.g., test_client_jobs_dao.py)
src/nupic/database/client_jobs_dao.py
def _startJobWithRetries(self, jobID): """ Place the given job in STATUS_RUNNING mode; the job is expected to be STATUS_NOTSTARTED. NOTE: this function was factored out of jobStartNext because it's also needed for testing (e.g., test_client_jobs_dao.py) """ with ConnectionFactory.get() as conn...
def _startJobWithRetries(self, jobID): """ Place the given job in STATUS_RUNNING mode; the job is expected to be STATUS_NOTSTARTED. NOTE: this function was factored out of jobStartNext because it's also needed for testing (e.g., test_client_jobs_dao.py) """ with ConnectionFactory.get() as conn...
[ "Place", "the", "given", "job", "in", "STATUS_RUNNING", "mode", ";", "the", "job", "is", "expected", "to", "be", "STATUS_NOTSTARTED", "." ]
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/database/client_jobs_dao.py#L1549-L1570
[ "def", "_startJobWithRetries", "(", "self", ",", "jobID", ")", ":", "with", "ConnectionFactory", ".", "get", "(", ")", "as", "conn", ":", "query", "=", "'UPDATE %s SET status=%%s, '", "' _eng_cjm_conn_id=%%s, '", "' start_time=UTC_TIMESTAMP(), '", "'...
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
ClientJobsDAO.jobStartNext
For use only by Nupic Scheduler (also known as ClientJobManager) Look through the jobs table and see if any new job requests have been queued up. If so, pick one and mark it as starting up and create the model table to hold the results Parameters: ---------------------------------------------------...
src/nupic/database/client_jobs_dao.py
def jobStartNext(self): """ For use only by Nupic Scheduler (also known as ClientJobManager) Look through the jobs table and see if any new job requests have been queued up. If so, pick one and mark it as starting up and create the model table to hold the results Parameters: -------------------...
def jobStartNext(self): """ For use only by Nupic Scheduler (also known as ClientJobManager) Look through the jobs table and see if any new job requests have been queued up. If so, pick one and mark it as starting up and create the model table to hold the results Parameters: -------------------...
[ "For", "use", "only", "by", "Nupic", "Scheduler", "(", "also", "known", "as", "ClientJobManager", ")", "Look", "through", "the", "jobs", "table", "and", "see", "if", "any", "new", "job", "requests", "have", "been", "queued", "up", ".", "If", "so", "pick"...
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/database/client_jobs_dao.py#L1574-L1598
[ "def", "jobStartNext", "(", "self", ")", ":", "# NOTE: cursor.execute('SELECT @update_id') trick is unreliable: if a", "# connection loss occurs during cursor.execute, then the server-cached", "# information is lost, and we cannot get the updated job ID; so, we use", "# this select instead", ...
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
ClientJobsDAO.jobReactivateRunningJobs
Look through the jobs table and reactivate all that are already in the running state by setting their _eng_allocate_new_workers fields to True; used by Nupic Scheduler as part of its failure-recovery procedure.
src/nupic/database/client_jobs_dao.py
def jobReactivateRunningJobs(self): """ Look through the jobs table and reactivate all that are already in the running state by setting their _eng_allocate_new_workers fields to True; used by Nupic Scheduler as part of its failure-recovery procedure. """ # Get a database connection and cursor w...
def jobReactivateRunningJobs(self): """ Look through the jobs table and reactivate all that are already in the running state by setting their _eng_allocate_new_workers fields to True; used by Nupic Scheduler as part of its failure-recovery procedure. """ # Get a database connection and cursor w...
[ "Look", "through", "the", "jobs", "table", "and", "reactivate", "all", "that", "are", "already", "in", "the", "running", "state", "by", "setting", "their", "_eng_allocate_new_workers", "fields", "to", "True", ";", "used", "by", "Nupic", "Scheduler", "as", "par...
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/database/client_jobs_dao.py#L1603-L1618
[ "def", "jobReactivateRunningJobs", "(", "self", ")", ":", "# Get a database connection and cursor", "with", "ConnectionFactory", ".", "get", "(", ")", "as", "conn", ":", "query", "=", "'UPDATE %s SET _eng_cjm_conn_id=%%s, '", "' _eng_allocate_new_workers=TRUE '", ...
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
ClientJobsDAO.jobGetDemand
Look through the jobs table and get the demand - minimum and maximum number of workers requested, if new workers are to be allocated, if there are any untended dead workers, for all running jobs. Parameters: ---------------------------------------------------------------- retval: list of Clien...
src/nupic/database/client_jobs_dao.py
def jobGetDemand(self,): """ Look through the jobs table and get the demand - minimum and maximum number of workers requested, if new workers are to be allocated, if there are any untended dead workers, for all running jobs. Parameters: --------------------------------------------------------------...
def jobGetDemand(self,): """ Look through the jobs table and get the demand - minimum and maximum number of workers requested, if new workers are to be allocated, if there are any untended dead workers, for all running jobs. Parameters: --------------------------------------------------------------...
[ "Look", "through", "the", "jobs", "table", "and", "get", "the", "demand", "-", "minimum", "and", "maximum", "number", "of", "workers", "requested", "if", "new", "workers", "are", "to", "be", "allocated", "if", "there", "are", "any", "untended", "dead", "wo...
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/database/client_jobs_dao.py#L1622-L1641
[ "def", "jobGetDemand", "(", "self", ",", ")", ":", "rows", "=", "self", ".", "_getMatchingRowsWithRetries", "(", "self", ".", "_jobs", ",", "dict", "(", "status", "=", "self", ".", "STATUS_RUNNING", ")", ",", "[", "self", ".", "_jobs", ".", "pubToDBNameD...
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
ClientJobsDAO.jobCancelAllRunningJobs
Set cancel field of all currently-running jobs to true.
src/nupic/database/client_jobs_dao.py
def jobCancelAllRunningJobs(self): """ Set cancel field of all currently-running jobs to true. """ # Get a database connection and cursor with ConnectionFactory.get() as conn: query = 'UPDATE %s SET cancel=TRUE WHERE status<>%%s ' \ % (self.jobsTableName,) conn.cursor.execute...
def jobCancelAllRunningJobs(self): """ Set cancel field of all currently-running jobs to true. """ # Get a database connection and cursor with ConnectionFactory.get() as conn: query = 'UPDATE %s SET cancel=TRUE WHERE status<>%%s ' \ % (self.jobsTableName,) conn.cursor.execute...
[ "Set", "cancel", "field", "of", "all", "currently", "-", "running", "jobs", "to", "true", "." ]
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/database/client_jobs_dao.py#L1646-L1657
[ "def", "jobCancelAllRunningJobs", "(", "self", ")", ":", "# Get a database connection and cursor", "with", "ConnectionFactory", ".", "get", "(", ")", "as", "conn", ":", "query", "=", "'UPDATE %s SET cancel=TRUE WHERE status<>%%s '", "%", "(", "self", ".", "jobsTableName...
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
ClientJobsDAO.jobCountCancellingJobs
Look through the jobs table and count the running jobs whose cancel field is true. Parameters: ---------------------------------------------------------------- retval: A count of running jobs with the cancel field set to true.
src/nupic/database/client_jobs_dao.py
def jobCountCancellingJobs(self,): """ Look through the jobs table and count the running jobs whose cancel field is true. Parameters: ---------------------------------------------------------------- retval: A count of running jobs with the cancel field set to true. """ with ConnectionF...
def jobCountCancellingJobs(self,): """ Look through the jobs table and count the running jobs whose cancel field is true. Parameters: ---------------------------------------------------------------- retval: A count of running jobs with the cancel field set to true. """ with ConnectionF...
[ "Look", "through", "the", "jobs", "table", "and", "count", "the", "running", "jobs", "whose", "cancel", "field", "is", "true", "." ]
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/database/client_jobs_dao.py#L1662-L1679
[ "def", "jobCountCancellingJobs", "(", "self", ",", ")", ":", "with", "ConnectionFactory", ".", "get", "(", ")", "as", "conn", ":", "query", "=", "'SELECT COUNT(job_id) '", "'FROM %s '", "'WHERE (status<>%%s AND cancel is TRUE)'", "%", "(", "self", ".", "jobsTableNam...
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
ClientJobsDAO.jobGetCancellingJobs
Look through the jobs table and get the list of running jobs whose cancel field is true. Parameters: ---------------------------------------------------------------- retval: A (possibly empty) sequence of running job IDs with cancel field set to true
src/nupic/database/client_jobs_dao.py
def jobGetCancellingJobs(self,): """ Look through the jobs table and get the list of running jobs whose cancel field is true. Parameters: ---------------------------------------------------------------- retval: A (possibly empty) sequence of running job IDs with cancel field ...
def jobGetCancellingJobs(self,): """ Look through the jobs table and get the list of running jobs whose cancel field is true. Parameters: ---------------------------------------------------------------- retval: A (possibly empty) sequence of running job IDs with cancel field ...
[ "Look", "through", "the", "jobs", "table", "and", "get", "the", "list", "of", "running", "jobs", "whose", "cancel", "field", "is", "true", "." ]
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/database/client_jobs_dao.py#L1684-L1701
[ "def", "jobGetCancellingJobs", "(", "self", ",", ")", ":", "with", "ConnectionFactory", ".", "get", "(", ")", "as", "conn", ":", "query", "=", "'SELECT job_id '", "'FROM %s '", "'WHERE (status<>%%s AND cancel is TRUE)'", "%", "(", "self", ".", "jobsTableName", ","...
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
ClientJobsDAO.partitionAtIntervals
Generator to allow iterating slices at dynamic intervals Parameters: ---------------------------------------------------------------- data: Any data structure that supports slicing (i.e. list or tuple) *intervals: Iterable of intervals. The sum of intervals should be less than, o...
src/nupic/database/client_jobs_dao.py
def partitionAtIntervals(data, intervals): """ Generator to allow iterating slices at dynamic intervals Parameters: ---------------------------------------------------------------- data: Any data structure that supports slicing (i.e. list or tuple) *intervals: Iterable of intervals. The sum ...
def partitionAtIntervals(data, intervals): """ Generator to allow iterating slices at dynamic intervals Parameters: ---------------------------------------------------------------- data: Any data structure that supports slicing (i.e. list or tuple) *intervals: Iterable of intervals. The sum ...
[ "Generator", "to", "allow", "iterating", "slices", "at", "dynamic", "intervals" ]
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/database/client_jobs_dao.py#L1706-L1724
[ "def", "partitionAtIntervals", "(", "data", ",", "intervals", ")", ":", "assert", "sum", "(", "intervals", ")", "<=", "len", "(", "data", ")", "start", "=", "0", "for", "interval", "in", "intervals", ":", "end", "=", "start", "+", "interval", "yield", ...
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
ClientJobsDAO._combineResults
Return a list of namedtuples from the result of a join query. A single database result is partitioned at intervals corresponding to the fields in namedTuples. The return value is the result of applying namedtuple._make() to each of the partitions, for each of the namedTuples. Parameters: --------...
src/nupic/database/client_jobs_dao.py
def _combineResults(result, *namedTuples): """ Return a list of namedtuples from the result of a join query. A single database result is partitioned at intervals corresponding to the fields in namedTuples. The return value is the result of applying namedtuple._make() to each of the partitions, for eac...
def _combineResults(result, *namedTuples): """ Return a list of namedtuples from the result of a join query. A single database result is partitioned at intervals corresponding to the fields in namedTuples. The return value is the result of applying namedtuple._make() to each of the partitions, for eac...
[ "Return", "a", "list", "of", "namedtuples", "from", "the", "result", "of", "a", "join", "query", ".", "A", "single", "database", "result", "is", "partitioned", "at", "intervals", "corresponding", "to", "the", "fields", "in", "namedTuples", ".", "The", "retur...
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/database/client_jobs_dao.py#L1729-L1743
[ "def", "_combineResults", "(", "result", ",", "*", "namedTuples", ")", ":", "results", "=", "ClientJobsDAO", ".", "partitionAtIntervals", "(", "result", ",", "[", "len", "(", "nt", ".", "_fields", ")", "for", "nt", "in", "namedTuples", "]", ")", "return", ...
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
ClientJobsDAO.jobInfoWithModels
Get all info about a job, with model details, if available. Parameters: ---------------------------------------------------------------- job: jobID of the job to query retval: A sequence of two-tuples if the jobID exists in the jobs table (exeption is raised if it doesn't exist). Each t...
src/nupic/database/client_jobs_dao.py
def jobInfoWithModels(self, jobID): """ Get all info about a job, with model details, if available. Parameters: ---------------------------------------------------------------- job: jobID of the job to query retval: A sequence of two-tuples if the jobID exists in the jobs table (exe...
def jobInfoWithModels(self, jobID): """ Get all info about a job, with model details, if available. Parameters: ---------------------------------------------------------------- job: jobID of the job to query retval: A sequence of two-tuples if the jobID exists in the jobs table (exe...
[ "Get", "all", "info", "about", "a", "job", "with", "model", "details", "if", "available", "." ]
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/database/client_jobs_dao.py#L1748-L1790
[ "def", "jobInfoWithModels", "(", "self", ",", "jobID", ")", ":", "# Get a database connection and cursor", "combinedResults", "=", "None", "with", "ConnectionFactory", ".", "get", "(", ")", "as", "conn", ":", "# NOTE: Since we're using a LEFT JOIN on the models table, there...
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
ClientJobsDAO.jobInfo
Get all info about a job Parameters: ---------------------------------------------------------------- job: jobID of the job to query retval: namedtuple containing the job info.
src/nupic/database/client_jobs_dao.py
def jobInfo(self, jobID): """ Get all info about a job Parameters: ---------------------------------------------------------------- job: jobID of the job to query retval: namedtuple containing the job info. """ row = self._getOneMatchingRowWithRetries( self._jobs, dict(job_id=job...
def jobInfo(self, jobID): """ Get all info about a job Parameters: ---------------------------------------------------------------- job: jobID of the job to query retval: namedtuple containing the job info. """ row = self._getOneMatchingRowWithRetries( self._jobs, dict(job_id=job...
[ "Get", "all", "info", "about", "a", "job" ]
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/database/client_jobs_dao.py#L1794-L1812
[ "def", "jobInfo", "(", "self", ",", "jobID", ")", ":", "row", "=", "self", ".", "_getOneMatchingRowWithRetries", "(", "self", ".", "_jobs", ",", "dict", "(", "job_id", "=", "jobID", ")", ",", "[", "self", ".", "_jobs", ".", "pubToDBNameDict", "[", "n",...
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
ClientJobsDAO.jobSetStatus
Change the status on the given job Parameters: ---------------------------------------------------------------- job: jobID of the job to change status status: new status string (ClientJobsDAO.STATUS_xxxxx) useConnectionID: True if the connection id of the calling function must be th...
src/nupic/database/client_jobs_dao.py
def jobSetStatus(self, jobID, status, useConnectionID=True,): """ Change the status on the given job Parameters: ---------------------------------------------------------------- job: jobID of the job to change status status: new status string (ClientJobsDAO.STATUS_xxxxx) useConnecti...
def jobSetStatus(self, jobID, status, useConnectionID=True,): """ Change the status on the given job Parameters: ---------------------------------------------------------------- job: jobID of the job to change status status: new status string (ClientJobsDAO.STATUS_xxxxx) useConnecti...
[ "Change", "the", "status", "on", "the", "given", "job" ]
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/database/client_jobs_dao.py#L1817-L1846
[ "def", "jobSetStatus", "(", "self", ",", "jobID", ",", "status", ",", "useConnectionID", "=", "True", ",", ")", ":", "# Get a database connection and cursor", "with", "ConnectionFactory", ".", "get", "(", ")", "as", "conn", ":", "query", "=", "'UPDATE %s SET sta...
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
ClientJobsDAO.jobSetCompleted
Change the status on the given job to completed Parameters: ---------------------------------------------------------------- job: jobID of the job to mark as completed completionReason: completionReason string completionMsg: completionMsg string useConnectionID: True i...
src/nupic/database/client_jobs_dao.py
def jobSetCompleted(self, jobID, completionReason, completionMsg, useConnectionID = True): """ Change the status on the given job to completed Parameters: ---------------------------------------------------------------- job: jobID of the job to mark as completed ...
def jobSetCompleted(self, jobID, completionReason, completionMsg, useConnectionID = True): """ Change the status on the given job to completed Parameters: ---------------------------------------------------------------- job: jobID of the job to mark as completed ...
[ "Change", "the", "status", "on", "the", "given", "job", "to", "completed" ]
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/database/client_jobs_dao.py#L1851-L1887
[ "def", "jobSetCompleted", "(", "self", ",", "jobID", ",", "completionReason", ",", "completionMsg", ",", "useConnectionID", "=", "True", ")", ":", "# Get a database connection and cursor", "with", "ConnectionFactory", ".", "get", "(", ")", "as", "conn", ":", "quer...
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
ClientJobsDAO.jobCancel
Cancel the given job. This will update the cancel field in the jobs table and will result in the job being cancelled. Parameters: ---------------------------------------------------------------- jobID: jobID of the job to mark as completed to False for hypersearch workers
src/nupic/database/client_jobs_dao.py
def jobCancel(self, jobID): """ Cancel the given job. This will update the cancel field in the jobs table and will result in the job being cancelled. Parameters: ---------------------------------------------------------------- jobID: jobID of the job to mark as completed to Fal...
def jobCancel(self, jobID): """ Cancel the given job. This will update the cancel field in the jobs table and will result in the job being cancelled. Parameters: ---------------------------------------------------------------- jobID: jobID of the job to mark as completed to Fal...
[ "Cancel", "the", "given", "job", ".", "This", "will", "update", "the", "cancel", "field", "in", "the", "jobs", "table", "and", "will", "result", "in", "the", "job", "being", "cancelled", "." ]
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/database/client_jobs_dao.py#L1891-L1903
[ "def", "jobCancel", "(", "self", ",", "jobID", ")", ":", "self", ".", "_logger", ".", "info", "(", "'Canceling jobID=%s'", ",", "jobID", ")", "# NOTE: jobSetFields does retries on transient mysql failures", "self", ".", "jobSetFields", "(", "jobID", ",", "{", "\"c...
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
ClientJobsDAO.jobGetModelIDs
Fetch all the modelIDs that correspond to a given jobID; empty sequence if none
src/nupic/database/client_jobs_dao.py
def jobGetModelIDs(self, jobID): """Fetch all the modelIDs that correspond to a given jobID; empty sequence if none""" rows = self._getMatchingRowsWithRetries(self._models, dict(job_id=jobID), ['model_id']) return [r[0] for r in rows]
def jobGetModelIDs(self, jobID): """Fetch all the modelIDs that correspond to a given jobID; empty sequence if none""" rows = self._getMatchingRowsWithRetries(self._models, dict(job_id=jobID), ['model_id']) return [r[0] for r in rows]
[ "Fetch", "all", "the", "modelIDs", "that", "correspond", "to", "a", "given", "jobID", ";", "empty", "sequence", "if", "none" ]
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/database/client_jobs_dao.py#L1907-L1913
[ "def", "jobGetModelIDs", "(", "self", ",", "jobID", ")", ":", "rows", "=", "self", ".", "_getMatchingRowsWithRetries", "(", "self", ".", "_models", ",", "dict", "(", "job_id", "=", "jobID", ")", ",", "[", "'model_id'", "]", ")", "return", "[", "r", "["...
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
ClientJobsDAO.getActiveJobCountForClientInfo
Return the number of jobs for the given clientInfo and a status that is not completed.
src/nupic/database/client_jobs_dao.py
def getActiveJobCountForClientInfo(self, clientInfo): """ Return the number of jobs for the given clientInfo and a status that is not completed. """ with ConnectionFactory.get() as conn: query = 'SELECT count(job_id) ' \ 'FROM %s ' \ 'WHERE client_info = %%s ' \ ...
def getActiveJobCountForClientInfo(self, clientInfo): """ Return the number of jobs for the given clientInfo and a status that is not completed. """ with ConnectionFactory.get() as conn: query = 'SELECT count(job_id) ' \ 'FROM %s ' \ 'WHERE client_info = %%s ' \ ...
[ "Return", "the", "number", "of", "jobs", "for", "the", "given", "clientInfo", "and", "a", "status", "that", "is", "not", "completed", "." ]
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/database/client_jobs_dao.py#L1918-L1930
[ "def", "getActiveJobCountForClientInfo", "(", "self", ",", "clientInfo", ")", ":", "with", "ConnectionFactory", ".", "get", "(", ")", "as", "conn", ":", "query", "=", "'SELECT count(job_id) '", "'FROM %s '", "'WHERE client_info = %%s '", "' AND status != %%s'", "%", "...
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
ClientJobsDAO.getActiveJobCountForClientKey
Return the number of jobs for the given clientKey and a status that is not completed.
src/nupic/database/client_jobs_dao.py
def getActiveJobCountForClientKey(self, clientKey): """ Return the number of jobs for the given clientKey and a status that is not completed. """ with ConnectionFactory.get() as conn: query = 'SELECT count(job_id) ' \ 'FROM %s ' \ 'WHERE client_key = %%s ' \ ...
def getActiveJobCountForClientKey(self, clientKey): """ Return the number of jobs for the given clientKey and a status that is not completed. """ with ConnectionFactory.get() as conn: query = 'SELECT count(job_id) ' \ 'FROM %s ' \ 'WHERE client_key = %%s ' \ ...
[ "Return", "the", "number", "of", "jobs", "for", "the", "given", "clientKey", "and", "a", "status", "that", "is", "not", "completed", "." ]
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/database/client_jobs_dao.py#L1935-L1947
[ "def", "getActiveJobCountForClientKey", "(", "self", ",", "clientKey", ")", ":", "with", "ConnectionFactory", ".", "get", "(", ")", "as", "conn", ":", "query", "=", "'SELECT count(job_id) '", "'FROM %s '", "'WHERE client_key = %%s '", "' AND status != %%s'", "%", "sel...
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
ClientJobsDAO.getActiveJobsForClientInfo
Fetch jobIDs for jobs in the table with optional fields given a specific clientInfo
src/nupic/database/client_jobs_dao.py
def getActiveJobsForClientInfo(self, clientInfo, fields=[]): """ Fetch jobIDs for jobs in the table with optional fields given a specific clientInfo """ # Form the sequence of field name strings that will go into the # request dbFields = [self._jobs.pubToDBNameDict[x] for x in fields] dbFields...
def getActiveJobsForClientInfo(self, clientInfo, fields=[]): """ Fetch jobIDs for jobs in the table with optional fields given a specific clientInfo """ # Form the sequence of field name strings that will go into the # request dbFields = [self._jobs.pubToDBNameDict[x] for x in fields] dbFields...
[ "Fetch", "jobIDs", "for", "jobs", "in", "the", "table", "with", "optional", "fields", "given", "a", "specific", "clientInfo" ]
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/database/client_jobs_dao.py#L1952-L1968
[ "def", "getActiveJobsForClientInfo", "(", "self", ",", "clientInfo", ",", "fields", "=", "[", "]", ")", ":", "# Form the sequence of field name strings that will go into the", "# request", "dbFields", "=", "[", "self", ".", "_jobs", ".", "pubToDBNameDict", "[", "x", ...
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
ClientJobsDAO.getFieldsForActiveJobsOfType
Helper function for querying the models table including relevant job info where the job type matches the specified jobType. Only records for which there is a matching jobId in both tables is returned, and only the requested fields are returned in each result, assuming that there is not a conflict. Thi...
src/nupic/database/client_jobs_dao.py
def getFieldsForActiveJobsOfType(self, jobType, fields=[]): """ Helper function for querying the models table including relevant job info where the job type matches the specified jobType. Only records for which there is a matching jobId in both tables is returned, and only the requested fields are retu...
def getFieldsForActiveJobsOfType(self, jobType, fields=[]): """ Helper function for querying the models table including relevant job info where the job type matches the specified jobType. Only records for which there is a matching jobId in both tables is returned, and only the requested fields are retu...
[ "Helper", "function", "for", "querying", "the", "models", "table", "including", "relevant", "job", "info", "where", "the", "job", "type", "matches", "the", "specified", "jobType", ".", "Only", "records", "for", "which", "there", "is", "a", "matching", "jobId",...
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/database/client_jobs_dao.py#L2012-L2041
[ "def", "getFieldsForActiveJobsOfType", "(", "self", ",", "jobType", ",", "fields", "=", "[", "]", ")", ":", "dbFields", "=", "[", "self", ".", "_jobs", ".", "pubToDBNameDict", "[", "x", "]", "for", "x", "in", "fields", "]", "dbFieldsStr", "=", "','", "...
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
ClientJobsDAO.jobGetFields
Fetch the values of 1 or more fields from a job record. Here, 'fields' is a list with the names of the fields to fetch. The names are the public names of the fields (camelBack, not the lower_case_only form as stored in the DB). Parameters: -----------------------------------------------------------...
src/nupic/database/client_jobs_dao.py
def jobGetFields(self, jobID, fields): """ Fetch the values of 1 or more fields from a job record. Here, 'fields' is a list with the names of the fields to fetch. The names are the public names of the fields (camelBack, not the lower_case_only form as stored in the DB). Parameters: ------------...
def jobGetFields(self, jobID, fields): """ Fetch the values of 1 or more fields from a job record. Here, 'fields' is a list with the names of the fields to fetch. The names are the public names of the fields (camelBack, not the lower_case_only form as stored in the DB). Parameters: ------------...
[ "Fetch", "the", "values", "of", "1", "or", "more", "fields", "from", "a", "job", "record", ".", "Here", "fields", "is", "a", "list", "with", "the", "names", "of", "the", "fields", "to", "fetch", ".", "The", "names", "are", "the", "public", "names", "...
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/database/client_jobs_dao.py#L2045-L2060
[ "def", "jobGetFields", "(", "self", ",", "jobID", ",", "fields", ")", ":", "# NOTE: jobsGetFields retries on transient mysql failures", "return", "self", ".", "jobsGetFields", "(", "[", "jobID", "]", ",", "fields", ",", "requireAll", "=", "True", ")", "[", "0", ...
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
ClientJobsDAO.jobsGetFields
Fetch the values of 1 or more fields from a sequence of job records. Here, 'fields' is a sequence (list or tuple) with the names of the fields to fetch. The names are the public names of the fields (camelBack, not the lower_case_only form as stored in the DB). WARNING!!!: The order of the results are N...
src/nupic/database/client_jobs_dao.py
def jobsGetFields(self, jobIDs, fields, requireAll=True): """ Fetch the values of 1 or more fields from a sequence of job records. Here, 'fields' is a sequence (list or tuple) with the names of the fields to fetch. The names are the public names of the fields (camelBack, not the lower_case_only form as ...
def jobsGetFields(self, jobIDs, fields, requireAll=True): """ Fetch the values of 1 or more fields from a sequence of job records. Here, 'fields' is a sequence (list or tuple) with the names of the fields to fetch. The names are the public names of the fields (camelBack, not the lower_case_only form as ...
[ "Fetch", "the", "values", "of", "1", "or", "more", "fields", "from", "a", "sequence", "of", "job", "records", ".", "Here", "fields", "is", "a", "sequence", "(", "list", "or", "tuple", ")", "with", "the", "names", "of", "the", "fields", "to", "fetch", ...
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/database/client_jobs_dao.py#L2064-L2094
[ "def", "jobsGetFields", "(", "self", ",", "jobIDs", ",", "fields", ",", "requireAll", "=", "True", ")", ":", "assert", "isinstance", "(", "jobIDs", ",", "self", ".", "_SEQUENCE_TYPES", ")", "assert", "len", "(", "jobIDs", ")", ">=", "1", "rows", "=", "...
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
ClientJobsDAO.jobSetFields
Change the values of 1 or more fields in a job. Here, 'fields' is a dict with the name/value pairs to change. The names are the public names of the fields (camelBack, not the lower_case_only form as stored in the DB). This method is for private use by the ClientJobManager only. Parameters: --------...
src/nupic/database/client_jobs_dao.py
def jobSetFields(self, jobID, fields, useConnectionID=True, ignoreUnchanged=False): """ Change the values of 1 or more fields in a job. Here, 'fields' is a dict with the name/value pairs to change. The names are the public names of the fields (camelBack, not the lower_case_only form as st...
def jobSetFields(self, jobID, fields, useConnectionID=True, ignoreUnchanged=False): """ Change the values of 1 or more fields in a job. Here, 'fields' is a dict with the name/value pairs to change. The names are the public names of the fields (camelBack, not the lower_case_only form as st...
[ "Change", "the", "values", "of", "1", "or", "more", "fields", "in", "a", "job", ".", "Here", "fields", "is", "a", "dict", "with", "the", "name", "/", "value", "pairs", "to", "change", ".", "The", "names", "are", "the", "public", "names", "of", "the",...
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/database/client_jobs_dao.py#L2099-L2149
[ "def", "jobSetFields", "(", "self", ",", "jobID", ",", "fields", ",", "useConnectionID", "=", "True", ",", "ignoreUnchanged", "=", "False", ")", ":", "# Form the sequecce of key=value strings that will go into the", "# request", "assignmentExpressions", "=", "','", "."...
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
ClientJobsDAO.jobSetFieldIfEqual
Change the value of 1 field in a job to 'newValue', but only if the current value matches 'curValue'. The 'fieldName' is the public name of the field (camelBack, not the lower_case_only form as stored in the DB). This method is used for example by HypersearcWorkers to update the engWorkerState field pe...
src/nupic/database/client_jobs_dao.py
def jobSetFieldIfEqual(self, jobID, fieldName, newValue, curValue): """ Change the value of 1 field in a job to 'newValue', but only if the current value matches 'curValue'. The 'fieldName' is the public name of the field (camelBack, not the lower_case_only form as stored in the DB). This method is use...
def jobSetFieldIfEqual(self, jobID, fieldName, newValue, curValue): """ Change the value of 1 field in a job to 'newValue', but only if the current value matches 'curValue'. The 'fieldName' is the public name of the field (camelBack, not the lower_case_only form as stored in the DB). This method is use...
[ "Change", "the", "value", "of", "1", "field", "in", "a", "job", "to", "newValue", "but", "only", "if", "the", "current", "value", "matches", "curValue", ".", "The", "fieldName", "is", "the", "public", "name", "of", "the", "field", "(", "camelBack", "not"...
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/database/client_jobs_dao.py#L2154-L2196
[ "def", "jobSetFieldIfEqual", "(", "self", ",", "jobID", ",", "fieldName", ",", "newValue", ",", "curValue", ")", ":", "# Get the private field name and string form of the value", "dbFieldName", "=", "self", ".", "_jobs", ".", "pubToDBNameDict", "[", "fieldName", "]", ...
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
ClientJobsDAO.jobIncrementIntField
Incremet the value of 1 field in a job by increment. The 'fieldName' is the public name of the field (camelBack, not the lower_case_only form as stored in the DB). This method is used for example by HypersearcWorkers to update the engWorkerState field periodically. By qualifying on curValue, it insures...
src/nupic/database/client_jobs_dao.py
def jobIncrementIntField(self, jobID, fieldName, increment=1, useConnectionID=False): """ Incremet the value of 1 field in a job by increment. The 'fieldName' is the public name of the field (camelBack, not the lower_case_only form as stored in the DB). This method is used fo...
def jobIncrementIntField(self, jobID, fieldName, increment=1, useConnectionID=False): """ Incremet the value of 1 field in a job by increment. The 'fieldName' is the public name of the field (camelBack, not the lower_case_only form as stored in the DB). This method is used fo...
[ "Incremet", "the", "value", "of", "1", "field", "in", "a", "job", "by", "increment", ".", "The", "fieldName", "is", "the", "public", "name", "of", "the", "field", "(", "camelBack", "not", "the", "lower_case_only", "form", "as", "stored", "in", "the", "DB...
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/database/client_jobs_dao.py#L2201-L2238
[ "def", "jobIncrementIntField", "(", "self", ",", "jobID", ",", "fieldName", ",", "increment", "=", "1", ",", "useConnectionID", "=", "False", ")", ":", "# Get the private field name and string form of the value", "dbFieldName", "=", "self", ".", "_jobs", ".", "pubTo...
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
ClientJobsDAO.jobUpdateResults
Update the results string and last-update-time fields of a model. Parameters: ---------------------------------------------------------------- jobID: job ID of model to modify results: new results (json dict string)
src/nupic/database/client_jobs_dao.py
def jobUpdateResults(self, jobID, results): """ Update the results string and last-update-time fields of a model. Parameters: ---------------------------------------------------------------- jobID: job ID of model to modify results: new results (json dict string) """ with Connection...
def jobUpdateResults(self, jobID, results): """ Update the results string and last-update-time fields of a model. Parameters: ---------------------------------------------------------------- jobID: job ID of model to modify results: new results (json dict string) """ with Connection...
[ "Update", "the", "results", "string", "and", "last", "-", "update", "-", "time", "fields", "of", "a", "model", "." ]
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/database/client_jobs_dao.py#L2243-L2255
[ "def", "jobUpdateResults", "(", "self", ",", "jobID", ",", "results", ")", ":", "with", "ConnectionFactory", ".", "get", "(", ")", "as", "conn", ":", "query", "=", "'UPDATE %s SET _eng_last_update_time=UTC_TIMESTAMP(), '", "' results=%%s '", "' WHE...
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
ClientJobsDAO.modelsClearAll
Delete all models from the models table Parameters: ----------------------------------------------------------------
src/nupic/database/client_jobs_dao.py
def modelsClearAll(self): """ Delete all models from the models table Parameters: ---------------------------------------------------------------- """ self._logger.info('Deleting all rows from models table %r', self.modelsTableName) with ConnectionFactory.get() as conn: ...
def modelsClearAll(self): """ Delete all models from the models table Parameters: ---------------------------------------------------------------- """ self._logger.info('Deleting all rows from models table %r', self.modelsTableName) with ConnectionFactory.get() as conn: ...
[ "Delete", "all", "models", "from", "the", "models", "table" ]
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/database/client_jobs_dao.py#L2260-L2270
[ "def", "modelsClearAll", "(", "self", ")", ":", "self", ".", "_logger", ".", "info", "(", "'Deleting all rows from models table %r'", ",", "self", ".", "modelsTableName", ")", "with", "ConnectionFactory", ".", "get", "(", ")", "as", "conn", ":", "query", "=", ...
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
ClientJobsDAO.modelInsertAndStart
Insert a new unique model (based on params) into the model table in the "running" state. This will return two things: whether or not the model was actually inserted (i.e. that set of params isn't already in the table) and the modelID chosen for that set of params. Even if the model was not inserted by t...
src/nupic/database/client_jobs_dao.py
def modelInsertAndStart(self, jobID, params, paramsHash, particleHash=None): """ Insert a new unique model (based on params) into the model table in the "running" state. This will return two things: whether or not the model was actually inserted (i.e. that set of params isn't already in the table) and t...
def modelInsertAndStart(self, jobID, params, paramsHash, particleHash=None): """ Insert a new unique model (based on params) into the model table in the "running" state. This will return two things: whether or not the model was actually inserted (i.e. that set of params isn't already in the table) and t...
[ "Insert", "a", "new", "unique", "model", "(", "based", "on", "params", ")", "into", "the", "model", "table", "in", "the", "running", "state", ".", "This", "will", "return", "two", "things", ":", "whether", "or", "not", "the", "model", "was", "actually", ...
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/database/client_jobs_dao.py#L2274-L2411
[ "def", "modelInsertAndStart", "(", "self", ",", "jobID", ",", "params", ",", "paramsHash", ",", "particleHash", "=", "None", ")", ":", "# Fill in default particleHash", "if", "particleHash", "is", "None", ":", "particleHash", "=", "paramsHash", "# Normalize hashes",...
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
ClientJobsDAO.modelsInfo
Get ALL info for a set of models WARNING!!!: The order of the results are NOT necessarily in the same order as the order of the model IDs passed in!!! Parameters: ---------------------------------------------------------------- modelIDs: list of model IDs retval: list of nametuples con...
src/nupic/database/client_jobs_dao.py
def modelsInfo(self, modelIDs): """ Get ALL info for a set of models WARNING!!!: The order of the results are NOT necessarily in the same order as the order of the model IDs passed in!!! Parameters: ---------------------------------------------------------------- modelIDs: list of model IDs...
def modelsInfo(self, modelIDs): """ Get ALL info for a set of models WARNING!!!: The order of the results are NOT necessarily in the same order as the order of the model IDs passed in!!! Parameters: ---------------------------------------------------------------- modelIDs: list of model IDs...
[ "Get", "ALL", "info", "for", "a", "set", "of", "models" ]
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/database/client_jobs_dao.py#L2415-L2442
[ "def", "modelsInfo", "(", "self", ",", "modelIDs", ")", ":", "assert", "isinstance", "(", "modelIDs", ",", "self", ".", "_SEQUENCE_TYPES", ")", ",", "(", "\"wrong modelIDs type: %s\"", ")", "%", "(", "type", "(", "modelIDs", ")", ",", ")", "assert", "model...
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
ClientJobsDAO.modelsGetFields
Fetch the values of 1 or more fields from a sequence of model records. Here, 'fields' is a list with the names of the fields to fetch. The names are the public names of the fields (camelBack, not the lower_case_only form as stored in the DB). WARNING!!!: The order of the results are NOT necessarily in ...
src/nupic/database/client_jobs_dao.py
def modelsGetFields(self, modelIDs, fields): """ Fetch the values of 1 or more fields from a sequence of model records. Here, 'fields' is a list with the names of the fields to fetch. The names are the public names of the fields (camelBack, not the lower_case_only form as stored in the DB). WARNING...
def modelsGetFields(self, modelIDs, fields): """ Fetch the values of 1 or more fields from a sequence of model records. Here, 'fields' is a list with the names of the fields to fetch. The names are the public names of the fields (camelBack, not the lower_case_only form as stored in the DB). WARNING...
[ "Fetch", "the", "values", "of", "1", "or", "more", "fields", "from", "a", "sequence", "of", "model", "records", ".", "Here", "fields", "is", "a", "list", "with", "the", "names", "of", "the", "fields", "to", "fetch", ".", "The", "names", "are", "the", ...
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/database/client_jobs_dao.py#L2446-L2488
[ "def", "modelsGetFields", "(", "self", ",", "modelIDs", ",", "fields", ")", ":", "assert", "len", "(", "fields", ")", ">=", "1", ",", "'fields is empty'", "# Form the sequence of field name strings that will go into the", "# request", "isSequence", "=", "isinstance", ...
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
ClientJobsDAO.modelsGetFieldsForJob
Gets the specified fields for all the models for a single job. This is similar to modelsGetFields Parameters: ---------------------------------------------------------------- jobID: jobID for the models to be searched fields: A list of fields to return ignoreKilled: ...
src/nupic/database/client_jobs_dao.py
def modelsGetFieldsForJob(self, jobID, fields, ignoreKilled=False): """ Gets the specified fields for all the models for a single job. This is similar to modelsGetFields Parameters: ---------------------------------------------------------------- jobID: jobID for the models to be searc...
def modelsGetFieldsForJob(self, jobID, fields, ignoreKilled=False): """ Gets the specified fields for all the models for a single job. This is similar to modelsGetFields Parameters: ---------------------------------------------------------------- jobID: jobID for the models to be searc...
[ "Gets", "the", "specified", "fields", "for", "all", "the", "models", "for", "a", "single", "job", ".", "This", "is", "similar", "to", "modelsGetFields" ]
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/database/client_jobs_dao.py#L2493-L2546
[ "def", "modelsGetFieldsForJob", "(", "self", ",", "jobID", ",", "fields", ",", "ignoreKilled", "=", "False", ")", ":", "assert", "len", "(", "fields", ")", ">=", "1", ",", "'fields is empty'", "# Form the sequence of field name strings that will go into the", "# requ...
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
ClientJobsDAO.modelsGetFieldsForCheckpointed
Gets fields from all models in a job that have been checkpointed. This is used to figure out whether or not a new model should be checkpointed. Parameters: ----------------------------------------------------------------------- jobID: The jobID for the models to be searched field...
src/nupic/database/client_jobs_dao.py
def modelsGetFieldsForCheckpointed(self, jobID, fields): """ Gets fields from all models in a job that have been checkpointed. This is used to figure out whether or not a new model should be checkpointed. Parameters: ----------------------------------------------------------------------- jobID:...
def modelsGetFieldsForCheckpointed(self, jobID, fields): """ Gets fields from all models in a job that have been checkpointed. This is used to figure out whether or not a new model should be checkpointed. Parameters: ----------------------------------------------------------------------- jobID:...
[ "Gets", "fields", "from", "all", "models", "in", "a", "job", "that", "have", "been", "checkpointed", ".", "This", "is", "used", "to", "figure", "out", "whether", "or", "not", "a", "new", "model", "should", "be", "checkpointed", "." ]
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/database/client_jobs_dao.py#L2551-L2584
[ "def", "modelsGetFieldsForCheckpointed", "(", "self", ",", "jobID", ",", "fields", ")", ":", "assert", "len", "(", "fields", ")", ">=", "1", ",", "\"fields is empty\"", "# Get a database connection and cursor", "with", "ConnectionFactory", ".", "get", "(", ")", "a...
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
ClientJobsDAO.modelSetFields
Change the values of 1 or more fields in a model. Here, 'fields' is a dict with the name/value pairs to change. The names are the public names of the fields (camelBack, not the lower_case_only form as stored in the DB). Parameters: ---------------------------------------------------------------- jo...
src/nupic/database/client_jobs_dao.py
def modelSetFields(self, modelID, fields, ignoreUnchanged = False): """ Change the values of 1 or more fields in a model. Here, 'fields' is a dict with the name/value pairs to change. The names are the public names of the fields (camelBack, not the lower_case_only form as stored in the DB). Parameters:...
def modelSetFields(self, modelID, fields, ignoreUnchanged = False): """ Change the values of 1 or more fields in a model. Here, 'fields' is a dict with the name/value pairs to change. The names are the public names of the fields (camelBack, not the lower_case_only form as stored in the DB). Parameters:...
[ "Change", "the", "values", "of", "1", "or", "more", "fields", "in", "a", "model", ".", "Here", "fields", "is", "a", "dict", "with", "the", "name", "/", "value", "pairs", "to", "change", ".", "The", "names", "are", "the", "public", "names", "of", "the...
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/database/client_jobs_dao.py#L2589-L2632
[ "def", "modelSetFields", "(", "self", ",", "modelID", ",", "fields", ",", "ignoreUnchanged", "=", "False", ")", ":", "# Form the sequence of key=value strings that will go into the", "# request", "assignmentExpressions", "=", "','", ".", "join", "(", "'%s=%%s'", "%", ...
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
ClientJobsDAO.modelsGetParams
Get the params and paramsHash for a set of models. WARNING!!!: The order of the results are NOT necessarily in the same order as the order of the model IDs passed in!!! Parameters: ---------------------------------------------------------------- modelIDs: list of model IDs retval: list...
src/nupic/database/client_jobs_dao.py
def modelsGetParams(self, modelIDs): """ Get the params and paramsHash for a set of models. WARNING!!!: The order of the results are NOT necessarily in the same order as the order of the model IDs passed in!!! Parameters: ---------------------------------------------------------------- modelID...
def modelsGetParams(self, modelIDs): """ Get the params and paramsHash for a set of models. WARNING!!!: The order of the results are NOT necessarily in the same order as the order of the model IDs passed in!!! Parameters: ---------------------------------------------------------------- modelID...
[ "Get", "the", "params", "and", "paramsHash", "for", "a", "set", "of", "models", "." ]
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/database/client_jobs_dao.py#L2636-L2663
[ "def", "modelsGetParams", "(", "self", ",", "modelIDs", ")", ":", "assert", "isinstance", "(", "modelIDs", ",", "self", ".", "_SEQUENCE_TYPES", ")", ",", "(", "\"Wrong modelIDs type: %r\"", ")", "%", "(", "type", "(", "modelIDs", ")", ",", ")", "assert", "...
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
ClientJobsDAO.modelsGetResultAndStatus
Get the results string and other status fields for a set of models. WARNING!!!: The order of the results are NOT necessarily in the same order as the order of the model IDs passed in!!! For each model, this returns a tuple containing: (modelID, results, status, updateCounter, numRecords, completionRe...
src/nupic/database/client_jobs_dao.py
def modelsGetResultAndStatus(self, modelIDs): """ Get the results string and other status fields for a set of models. WARNING!!!: The order of the results are NOT necessarily in the same order as the order of the model IDs passed in!!! For each model, this returns a tuple containing: (modelID, re...
def modelsGetResultAndStatus(self, modelIDs): """ Get the results string and other status fields for a set of models. WARNING!!!: The order of the results are NOT necessarily in the same order as the order of the model IDs passed in!!! For each model, this returns a tuple containing: (modelID, re...
[ "Get", "the", "results", "string", "and", "other", "status", "fields", "for", "a", "set", "of", "models", "." ]
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/database/client_jobs_dao.py#L2667-L2698
[ "def", "modelsGetResultAndStatus", "(", "self", ",", "modelIDs", ")", ":", "assert", "isinstance", "(", "modelIDs", ",", "self", ".", "_SEQUENCE_TYPES", ")", ",", "(", "\"Wrong modelIDs type: %r\"", ")", "%", "type", "(", "modelIDs", ")", "assert", "len", "(",...
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
ClientJobsDAO.modelsGetUpdateCounters
Return info on all of the models that are in already in the models table for a given job. For each model, this returns a tuple containing: (modelID, updateCounter). Note that we don't return the results for all models, since the results string could be quite large. The information we are returning is ...
src/nupic/database/client_jobs_dao.py
def modelsGetUpdateCounters(self, jobID): """ Return info on all of the models that are in already in the models table for a given job. For each model, this returns a tuple containing: (modelID, updateCounter). Note that we don't return the results for all models, since the results string could be ...
def modelsGetUpdateCounters(self, jobID): """ Return info on all of the models that are in already in the models table for a given job. For each model, this returns a tuple containing: (modelID, updateCounter). Note that we don't return the results for all models, since the results string could be ...
[ "Return", "info", "on", "all", "of", "the", "models", "that", "are", "in", "already", "in", "the", "models", "table", "for", "a", "given", "job", ".", "For", "each", "model", "this", "returns", "a", "tuple", "containing", ":", "(", "modelID", "updateCoun...
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/database/client_jobs_dao.py#L2702-L2723
[ "def", "modelsGetUpdateCounters", "(", "self", ",", "jobID", ")", ":", "rows", "=", "self", ".", "_getMatchingRowsWithRetries", "(", "self", ".", "_models", ",", "{", "'job_id'", ":", "jobID", "}", ",", "[", "self", ".", "_models", ".", "pubToDBNameDict", ...
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
ClientJobsDAO.modelUpdateResults
Update the results string, and/or num_records fields of a model. This will fail if the model does not currently belong to this client (connection_id doesn't match). Parameters: ---------------------------------------------------------------- modelID: model ID of model to modify results: ...
src/nupic/database/client_jobs_dao.py
def modelUpdateResults(self, modelID, results=None, metricValue =None, numRecords=None): """ Update the results string, and/or num_records fields of a model. This will fail if the model does not currently belong to this client (connection_id doesn't match). Parameters: ----...
def modelUpdateResults(self, modelID, results=None, metricValue =None, numRecords=None): """ Update the results string, and/or num_records fields of a model. This will fail if the model does not currently belong to this client (connection_id doesn't match). Parameters: ----...
[ "Update", "the", "results", "string", "and", "/", "or", "num_records", "fields", "of", "a", "model", ".", "This", "will", "fail", "if", "the", "model", "does", "not", "currently", "belong", "to", "this", "client", "(", "connection_id", "doesn", "t", "match...
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/database/client_jobs_dao.py#L2728-L2773
[ "def", "modelUpdateResults", "(", "self", ",", "modelID", ",", "results", "=", "None", ",", "metricValue", "=", "None", ",", "numRecords", "=", "None", ")", ":", "assignmentExpressions", "=", "[", "'_eng_last_update_time=UTC_TIMESTAMP()'", ",", "'update_counter=upda...
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
ClientJobsDAO.modelSetCompleted
Mark a model as completed, with the given completionReason and completionMsg. This will fail if the model does not currently belong to this client (connection_id doesn't match). Parameters: ---------------------------------------------------------------- modelID: model ID of model to mo...
src/nupic/database/client_jobs_dao.py
def modelSetCompleted(self, modelID, completionReason, completionMsg, cpuTime=0, useConnectionID=True): """ Mark a model as completed, with the given completionReason and completionMsg. This will fail if the model does not currently belong to this client (connection_id doesn't match)...
def modelSetCompleted(self, modelID, completionReason, completionMsg, cpuTime=0, useConnectionID=True): """ Mark a model as completed, with the given completionReason and completionMsg. This will fail if the model does not currently belong to this client (connection_id doesn't match)...
[ "Mark", "a", "model", "as", "completed", "with", "the", "given", "completionReason", "and", "completionMsg", ".", "This", "will", "fail", "if", "the", "model", "does", "not", "currently", "belong", "to", "this", "client", "(", "connection_id", "doesn", "t", ...
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/database/client_jobs_dao.py#L2782-L2825
[ "def", "modelSetCompleted", "(", "self", ",", "modelID", ",", "completionReason", ",", "completionMsg", ",", "cpuTime", "=", "0", ",", "useConnectionID", "=", "True", ")", ":", "if", "completionMsg", "is", "None", ":", "completionMsg", "=", "''", "query", "=...
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
ClientJobsDAO.modelAdoptNextOrphan
Look through the models table for an orphaned model, which is a model that is not completed yet, whose _eng_last_update_time is more than maxUpdateInterval seconds ago. If one is found, change its _eng_worker_conn_id to the current worker's and return the model id. Parameters: ----------------...
src/nupic/database/client_jobs_dao.py
def modelAdoptNextOrphan(self, jobId, maxUpdateInterval): """ Look through the models table for an orphaned model, which is a model that is not completed yet, whose _eng_last_update_time is more than maxUpdateInterval seconds ago. If one is found, change its _eng_worker_conn_id to the current worker's ...
def modelAdoptNextOrphan(self, jobId, maxUpdateInterval): """ Look through the models table for an orphaned model, which is a model that is not completed yet, whose _eng_last_update_time is more than maxUpdateInterval seconds ago. If one is found, change its _eng_worker_conn_id to the current worker's ...
[ "Look", "through", "the", "models", "table", "for", "an", "orphaned", "model", "which", "is", "a", "model", "that", "is", "not", "completed", "yet", "whose", "_eng_last_update_time", "is", "more", "than", "maxUpdateInterval", "seconds", "ago", "." ]
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/database/client_jobs_dao.py#L2829-L2907
[ "def", "modelAdoptNextOrphan", "(", "self", ",", "jobId", ",", "maxUpdateInterval", ")", ":", "@", "g_retrySQL", "def", "findCandidateModelWithRetries", "(", ")", ":", "modelID", "=", "None", "with", "ConnectionFactory", ".", "get", "(", ")", "as", "conn", ":"...
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
profileSP
profiling performance of SpatialPooler (SP) using the python cProfile module and ordered by cumulative time, see how to run on command-line above. @param spClass implementation of SP (cpp, py, ..) @param spDim number of columns in SP (in 1D, for 2D see colDim in code) @param nRuns number of calls of the prof...
scripts/profiling/sp_profile.py
def profileSP(spClass, spDim, nRuns): """ profiling performance of SpatialPooler (SP) using the python cProfile module and ordered by cumulative time, see how to run on command-line above. @param spClass implementation of SP (cpp, py, ..) @param spDim number of columns in SP (in 1D, for 2D see colDim in co...
def profileSP(spClass, spDim, nRuns): """ profiling performance of SpatialPooler (SP) using the python cProfile module and ordered by cumulative time, see how to run on command-line above. @param spClass implementation of SP (cpp, py, ..) @param spDim number of columns in SP (in 1D, for 2D see colDim in co...
[ "profiling", "performance", "of", "SpatialPooler", "(", "SP", ")", "using", "the", "python", "cProfile", "module", "and", "ordered", "by", "cumulative", "time", "see", "how", "to", "run", "on", "command", "-", "line", "above", "." ]
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/scripts/profiling/sp_profile.py#L31-L79
[ "def", "profileSP", "(", "spClass", ",", "spDim", ",", "nRuns", ")", ":", "# you can change dimensionality here, eg to 2D", "inDim", "=", "[", "10000", ",", "1", ",", "1", "]", "colDim", "=", "[", "spDim", ",", "1", ",", "1", "]", "# create SP instance to me...
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
KNNClassifierRegion.getSpec
Overrides :meth:`nupic.bindings.regions.PyRegion.PyRegion.getSpec`.
src/nupic/regions/knn_classifier_region.py
def getSpec(cls): """ Overrides :meth:`nupic.bindings.regions.PyRegion.PyRegion.getSpec`. """ ns = dict( description=KNNClassifierRegion.__doc__, singleNodeOnly=True, inputs=dict( categoryIn=dict( description='Vector of zero or more category indices for this...
def getSpec(cls): """ Overrides :meth:`nupic.bindings.regions.PyRegion.PyRegion.getSpec`. """ ns = dict( description=KNNClassifierRegion.__doc__, singleNodeOnly=True, inputs=dict( categoryIn=dict( description='Vector of zero or more category indices for this...
[ "Overrides", ":", "meth", ":", "nupic", ".", "bindings", ".", "regions", ".", "PyRegion", ".", "PyRegion", ".", "getSpec", "." ]
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/regions/knn_classifier_region.py#L82-L489
[ "def", "getSpec", "(", "cls", ")", ":", "ns", "=", "dict", "(", "description", "=", "KNNClassifierRegion", ".", "__doc__", ",", "singleNodeOnly", "=", "True", ",", "inputs", "=", "dict", "(", "categoryIn", "=", "dict", "(", "description", "=", "'Vector of ...
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
KNNClassifierRegion._initEphemerals
Initialize attributes that are not saved with the checkpoint.
src/nupic/regions/knn_classifier_region.py
def _initEphemerals(self): """ Initialize attributes that are not saved with the checkpoint. """ self._firstComputeCall = True self._accuracy = None self._protoScores = None self._categoryDistances = None self._knn = knn_classifier.KNNClassifier(**self.knnParams) for x in ('_partit...
def _initEphemerals(self): """ Initialize attributes that are not saved with the checkpoint. """ self._firstComputeCall = True self._accuracy = None self._protoScores = None self._categoryDistances = None self._knn = knn_classifier.KNNClassifier(**self.knnParams) for x in ('_partit...
[ "Initialize", "attributes", "that", "are", "not", "saved", "with", "the", "checkpoint", "." ]
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/regions/knn_classifier_region.py#L605-L619
[ "def", "_initEphemerals", "(", "self", ")", ":", "self", ".", "_firstComputeCall", "=", "True", "self", ".", "_accuracy", "=", "None", "self", ".", "_protoScores", "=", "None", "self", ".", "_categoryDistances", "=", "None", "self", ".", "_knn", "=", "knn_...
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
KNNClassifierRegion.getParameter
Overrides :meth:`nupic.bindings.regions.PyRegion.PyRegion.getParameter`.
src/nupic/regions/knn_classifier_region.py
def getParameter(self, name, index=-1): """ Overrides :meth:`nupic.bindings.regions.PyRegion.PyRegion.getParameter`. """ if name == "patternCount": return self._knn._numPatterns elif name == "patternMatrix": return self._getPatternMatrix() elif name == "k": return self._knn.k ...
def getParameter(self, name, index=-1): """ Overrides :meth:`nupic.bindings.regions.PyRegion.PyRegion.getParameter`. """ if name == "patternCount": return self._knn._numPatterns elif name == "patternMatrix": return self._getPatternMatrix() elif name == "k": return self._knn.k ...
[ "Overrides", ":", "meth", ":", "nupic", ".", "bindings", ".", "regions", ".", "PyRegion", ".", "PyRegion", ".", "getParameter", "." ]
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/regions/knn_classifier_region.py#L704-L756
[ "def", "getParameter", "(", "self", ",", "name", ",", "index", "=", "-", "1", ")", ":", "if", "name", "==", "\"patternCount\"", ":", "return", "self", ".", "_knn", ".", "_numPatterns", "elif", "name", "==", "\"patternMatrix\"", ":", "return", "self", "."...
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
KNNClassifierRegion.setParameter
Overrides :meth:`nupic.bindings.regions.PyRegion.PyRegion.setParameter`.
src/nupic/regions/knn_classifier_region.py
def setParameter(self, name, index, value): """ Overrides :meth:`nupic.bindings.regions.PyRegion.PyRegion.setParameter`. """ if name == "learningMode": self.learningMode = bool(int(value)) self._epoch = 0 elif name == "inferenceMode": self._epoch = 0 if int(value) and not sel...
def setParameter(self, name, index, value): """ Overrides :meth:`nupic.bindings.regions.PyRegion.PyRegion.setParameter`. """ if name == "learningMode": self.learningMode = bool(int(value)) self._epoch = 0 elif name == "inferenceMode": self._epoch = 0 if int(value) and not sel...
[ "Overrides", ":", "meth", ":", "nupic", ".", "bindings", ".", "regions", ".", "PyRegion", ".", "PyRegion", ".", "setParameter", "." ]
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/regions/knn_classifier_region.py#L759-L789
[ "def", "setParameter", "(", "self", ",", "name", ",", "index", ",", "value", ")", ":", "if", "name", "==", "\"learningMode\"", ":", "self", ".", "learningMode", "=", "bool", "(", "int", "(", "value", ")", ")", "self", ".", "_epoch", "=", "0", "elif",...
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
KNNClassifierRegion.enableTap
Begin writing output tap files. :param tapPath: (string) base name of the output tap files to write.
src/nupic/regions/knn_classifier_region.py
def enableTap(self, tapPath): """ Begin writing output tap files. :param tapPath: (string) base name of the output tap files to write. """ self._tapFileIn = open(tapPath + '.in', 'w') self._tapFileOut = open(tapPath + '.out', 'w')
def enableTap(self, tapPath): """ Begin writing output tap files. :param tapPath: (string) base name of the output tap files to write. """ self._tapFileIn = open(tapPath + '.in', 'w') self._tapFileOut = open(tapPath + '.out', 'w')
[ "Begin", "writing", "output", "tap", "files", "." ]
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/regions/knn_classifier_region.py#L807-L815
[ "def", "enableTap", "(", "self", ",", "tapPath", ")", ":", "self", ".", "_tapFileIn", "=", "open", "(", "tapPath", "+", "'.in'", ",", "'w'", ")", "self", ".", "_tapFileOut", "=", "open", "(", "tapPath", "+", "'.out'", ",", "'w'", ")" ]
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
KNNClassifierRegion.disableTap
Disable writing of output tap files.
src/nupic/regions/knn_classifier_region.py
def disableTap(self): """ Disable writing of output tap files. """ if self._tapFileIn is not None: self._tapFileIn.close() self._tapFileIn = None if self._tapFileOut is not None: self._tapFileOut.close() self._tapFileOut = None
def disableTap(self): """ Disable writing of output tap files. """ if self._tapFileIn is not None: self._tapFileIn.close() self._tapFileIn = None if self._tapFileOut is not None: self._tapFileOut.close() self._tapFileOut = None
[ "Disable", "writing", "of", "output", "tap", "files", "." ]
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/regions/knn_classifier_region.py#L818-L828
[ "def", "disableTap", "(", "self", ")", ":", "if", "self", ".", "_tapFileIn", "is", "not", "None", ":", "self", ".", "_tapFileIn", ".", "close", "(", ")", "self", ".", "_tapFileIn", "=", "None", "if", "self", ".", "_tapFileOut", "is", "not", "None", "...
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
KNNClassifierRegion.handleLogInput
Write inputs to output tap file. :param inputs: (iter) some inputs.
src/nupic/regions/knn_classifier_region.py
def handleLogInput(self, inputs): """ Write inputs to output tap file. :param inputs: (iter) some inputs. """ if self._tapFileIn is not None: for input in inputs: for k in range(len(input)): print >> self._tapFileIn, input[k], print >> self._tapFileIn
def handleLogInput(self, inputs): """ Write inputs to output tap file. :param inputs: (iter) some inputs. """ if self._tapFileIn is not None: for input in inputs: for k in range(len(input)): print >> self._tapFileIn, input[k], print >> self._tapFileIn
[ "Write", "inputs", "to", "output", "tap", "file", ".", ":", "param", "inputs", ":", "(", "iter", ")", "some", "inputs", "." ]
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/regions/knn_classifier_region.py#L831-L842
[ "def", "handleLogInput", "(", "self", ",", "inputs", ")", ":", "if", "self", ".", "_tapFileIn", "is", "not", "None", ":", "for", "input", "in", "inputs", ":", "for", "k", "in", "range", "(", "len", "(", "input", ")", ")", ":", "print", ">>", "self"...
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
KNNClassifierRegion.handleLogOutput
Write outputs to output tap file. :param outputs: (iter) some outputs.
src/nupic/regions/knn_classifier_region.py
def handleLogOutput(self, output): """ Write outputs to output tap file. :param outputs: (iter) some outputs. """ #raise Exception('MULTI-LINE DUMMY\nMULTI-LINE DUMMY') if self._tapFileOut is not None: for k in range(len(output)): print >> self._tapFileOut, output[k], print ...
def handleLogOutput(self, output): """ Write outputs to output tap file. :param outputs: (iter) some outputs. """ #raise Exception('MULTI-LINE DUMMY\nMULTI-LINE DUMMY') if self._tapFileOut is not None: for k in range(len(output)): print >> self._tapFileOut, output[k], print ...
[ "Write", "outputs", "to", "output", "tap", "file", "." ]
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/regions/knn_classifier_region.py#L845-L855
[ "def", "handleLogOutput", "(", "self", ",", "output", ")", ":", "#raise Exception('MULTI-LINE DUMMY\\nMULTI-LINE DUMMY')", "if", "self", ".", "_tapFileOut", "is", "not", "None", ":", "for", "k", "in", "range", "(", "len", "(", "output", ")", ")", ":", "print",...
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
KNNClassifierRegion._storeSample
Store a training sample and associated category label
src/nupic/regions/knn_classifier_region.py
def _storeSample(self, inputVector, trueCatIndex, partition=0): """ Store a training sample and associated category label """ # If this is the first sample, then allocate a numpy array # of the appropriate size in which to store all samples. if self._samples is None: self._samples = numpy...
def _storeSample(self, inputVector, trueCatIndex, partition=0): """ Store a training sample and associated category label """ # If this is the first sample, then allocate a numpy array # of the appropriate size in which to store all samples. if self._samples is None: self._samples = numpy...
[ "Store", "a", "training", "sample", "and", "associated", "category", "label" ]
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/regions/knn_classifier_region.py#L858-L879
[ "def", "_storeSample", "(", "self", ",", "inputVector", ",", "trueCatIndex", ",", "partition", "=", "0", ")", ":", "# If this is the first sample, then allocate a numpy array", "# of the appropriate size in which to store all samples.", "if", "self", ".", "_samples", "is", ...
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
KNNClassifierRegion.compute
Process one input sample. This method is called by the runtime engine. .. note:: the number of input categories may vary, but the array size is fixed to the max number of categories allowed (by a lower region), so "unused" indices of the input category array are filled with -1s. TODO: confusio...
src/nupic/regions/knn_classifier_region.py
def compute(self, inputs, outputs): """ Process one input sample. This method is called by the runtime engine. .. note:: the number of input categories may vary, but the array size is fixed to the max number of categories allowed (by a lower region), so "unused" indices of the input categor...
def compute(self, inputs, outputs): """ Process one input sample. This method is called by the runtime engine. .. note:: the number of input categories may vary, but the array size is fixed to the max number of categories allowed (by a lower region), so "unused" indices of the input categor...
[ "Process", "one", "input", "sample", ".", "This", "method", "is", "called", "by", "the", "runtime", "engine", "." ]
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/regions/knn_classifier_region.py#L882-L1071
[ "def", "compute", "(", "self", ",", "inputs", ",", "outputs", ")", ":", "#raise Exception('MULTI-LINE DUMMY\\nMULTI-LINE DUMMY')", "#For backward compatibility", "if", "self", ".", "_useAuxiliary", "is", "None", ":", "self", ".", "_useAuxiliary", "=", "False", "# If t...
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
KNNClassifierRegion._finishLearning
Does nothing. Kept here for API compatibility
src/nupic/regions/knn_classifier_region.py
def _finishLearning(self): """Does nothing. Kept here for API compatibility """ if self._doSphering: self._finishSphering() self._knn.finishLearning() # Compute leave-one-out validation accuracy if # we actually received non-trivial partition info self._accuracy = None
def _finishLearning(self): """Does nothing. Kept here for API compatibility """ if self._doSphering: self._finishSphering() self._knn.finishLearning() # Compute leave-one-out validation accuracy if # we actually received non-trivial partition info self._accuracy = None
[ "Does", "nothing", ".", "Kept", "here", "for", "API", "compatibility" ]
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/regions/knn_classifier_region.py#L1142-L1151
[ "def", "_finishLearning", "(", "self", ")", ":", "if", "self", ".", "_doSphering", ":", "self", ".", "_finishSphering", "(", ")", "self", ".", "_knn", ".", "finishLearning", "(", ")", "# Compute leave-one-out validation accuracy if", "# we actually received non-trivia...
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
KNNClassifierRegion._finishSphering
Compute normalization constants for each feature dimension based on the collected training samples. Then normalize our training samples using these constants (so that each input dimension has mean and variance of zero and one, respectively.) Then feed these "sphered" training samples into the underlyin...
src/nupic/regions/knn_classifier_region.py
def _finishSphering(self): """ Compute normalization constants for each feature dimension based on the collected training samples. Then normalize our training samples using these constants (so that each input dimension has mean and variance of zero and one, respectively.) Then feed these "spher...
def _finishSphering(self): """ Compute normalization constants for each feature dimension based on the collected training samples. Then normalize our training samples using these constants (so that each input dimension has mean and variance of zero and one, respectively.) Then feed these "spher...
[ "Compute", "normalization", "constants", "for", "each", "feature", "dimension", "based", "on", "the", "collected", "training", "samples", ".", "Then", "normalize", "our", "training", "samples", "using", "these", "constants", "(", "so", "that", "each", "input", "...
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/regions/knn_classifier_region.py#L1154-L1181
[ "def", "_finishSphering", "(", "self", ")", ":", "# If we are sphering our data, we need to compute the", "# per-dimension normalization constants", "# First normalize the means (to zero)", "self", ".", "_normOffset", "=", "self", ".", "_samples", ".", "mean", "(", "axis", "=...
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
KNNClassifierRegion.getOutputElementCount
Overrides :meth:`nupic.bindings.regions.PyRegion.PyRegion.getOutputElementCount`.
src/nupic/regions/knn_classifier_region.py
def getOutputElementCount(self, name): """ Overrides :meth:`nupic.bindings.regions.PyRegion.PyRegion.getOutputElementCount`. """ if name == 'categoriesOut': return self.maxCategoryCount elif name == 'categoryProbabilitiesOut': return self.maxCategoryCount elif name == 'bestPrototypeI...
def getOutputElementCount(self, name): """ Overrides :meth:`nupic.bindings.regions.PyRegion.PyRegion.getOutputElementCount`. """ if name == 'categoriesOut': return self.maxCategoryCount elif name == 'categoryProbabilitiesOut': return self.maxCategoryCount elif name == 'bestPrototypeI...
[ "Overrides", ":", "meth", ":", "nupic", ".", "bindings", ".", "regions", ".", "PyRegion", ".", "PyRegion", ".", "getOutputElementCount", "." ]
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/regions/knn_classifier_region.py#L1191-L1202
[ "def", "getOutputElementCount", "(", "self", ",", "name", ")", ":", "if", "name", "==", "'categoriesOut'", ":", "return", "self", ".", "maxCategoryCount", "elif", "name", "==", "'categoryProbabilitiesOut'", ":", "return", "self", ".", "maxCategoryCount", "elif", ...
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
generateStats
Generate requested statistics for a dataset and cache to a file. If filename is None, then don't cache to a file
src/nupic/data/stats.py
def generateStats(filename, statsInfo, maxSamples = None, filters=[], cache=True): """Generate requested statistics for a dataset and cache to a file. If filename is None, then don't cache to a file""" # Sanity checking if not isinstance(statsInfo, dict): raise RuntimeError("statsInfo must be a dict -- " ...
def generateStats(filename, statsInfo, maxSamples = None, filters=[], cache=True): """Generate requested statistics for a dataset and cache to a file. If filename is None, then don't cache to a file""" # Sanity checking if not isinstance(statsInfo, dict): raise RuntimeError("statsInfo must be a dict -- " ...
[ "Generate", "requested", "statistics", "for", "a", "dataset", "and", "cache", "to", "a", "file", ".", "If", "filename", "is", "None", "then", "don", "t", "cache", "to", "a", "file" ]
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/data/stats.py#L123-L202
[ "def", "generateStats", "(", "filename", ",", "statsInfo", ",", "maxSamples", "=", "None", ",", "filters", "=", "[", "]", ",", "cache", "=", "True", ")", ":", "# Sanity checking", "if", "not", "isinstance", "(", "statsInfo", ",", "dict", ")", ":", "raise...
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
getScalarMetricWithTimeOfDayAnomalyParams
Return a dict that can be used to create an anomaly model via :meth:`nupic.frameworks.opf.model_factory.ModelFactory.create`. Example: .. code-block:: python from nupic.frameworks.opf.model_factory import ModelFactory from nupic.frameworks.opf.common_models.cluster_params import ( getScalarMetric...
src/nupic/frameworks/opf/common_models/cluster_params.py
def getScalarMetricWithTimeOfDayAnomalyParams(metricData, minVal=None, maxVal=None, minResolution=None, tmImplementation = "cpp"): """...
def getScalarMetricWithTimeOfDayAnomalyParams(metricData, minVal=None, maxVal=None, minResolution=None, tmImplementation = "cpp"): """...
[ "Return", "a", "dict", "that", "can", "be", "used", "to", "create", "an", "anomaly", "model", "via", ":", "meth", ":", "nupic", ".", "frameworks", ".", "opf", ".", "model_factory", ".", "ModelFactory", ".", "create", "." ]
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/frameworks/opf/common_models/cluster_params.py#L29-L117
[ "def", "getScalarMetricWithTimeOfDayAnomalyParams", "(", "metricData", ",", "minVal", "=", "None", ",", "maxVal", "=", "None", ",", "minResolution", "=", "None", ",", "tmImplementation", "=", "\"cpp\"", ")", ":", "# Default values", "if", "minResolution", "is", "N...
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
_rangeGen
Return reasonable min/max values to use given the data.
src/nupic/frameworks/opf/common_models/cluster_params.py
def _rangeGen(data, std=1): """ Return reasonable min/max values to use given the data. """ dataStd = np.std(data) if dataStd == 0: dataStd = 1 minval = np.min(data) - std * dataStd maxval = np.max(data) + std * dataStd return minval, maxval
def _rangeGen(data, std=1): """ Return reasonable min/max values to use given the data. """ dataStd = np.std(data) if dataStd == 0: dataStd = 1 minval = np.min(data) - std * dataStd maxval = np.max(data) + std * dataStd return minval, maxval
[ "Return", "reasonable", "min", "/", "max", "values", "to", "use", "given", "the", "data", "." ]
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/frameworks/opf/common_models/cluster_params.py#L120-L129
[ "def", "_rangeGen", "(", "data", ",", "std", "=", "1", ")", ":", "dataStd", "=", "np", ".", "std", "(", "data", ")", "if", "dataStd", "==", "0", ":", "dataStd", "=", "1", "minval", "=", "np", ".", "min", "(", "data", ")", "-", "std", "*", "da...
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
_fixupRandomEncoderParams
Given model params, figure out the correct parameters for the RandomDistributed encoder. Modifies params in place.
src/nupic/frameworks/opf/common_models/cluster_params.py
def _fixupRandomEncoderParams(params, minVal, maxVal, minResolution): """ Given model params, figure out the correct parameters for the RandomDistributed encoder. Modifies params in place. """ encodersDict = ( params["modelConfig"]["modelParams"]["sensorParams"]["encoders"] ) for encoder in encodersD...
def _fixupRandomEncoderParams(params, minVal, maxVal, minResolution): """ Given model params, figure out the correct parameters for the RandomDistributed encoder. Modifies params in place. """ encodersDict = ( params["modelConfig"]["modelParams"]["sensorParams"]["encoders"] ) for encoder in encodersD...
[ "Given", "model", "params", "figure", "out", "the", "correct", "parameters", "for", "the", "RandomDistributed", "encoder", ".", "Modifies", "params", "in", "place", "." ]
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/frameworks/opf/common_models/cluster_params.py#L133-L148
[ "def", "_fixupRandomEncoderParams", "(", "params", ",", "minVal", ",", "maxVal", ",", "minResolution", ")", ":", "encodersDict", "=", "(", "params", "[", "\"modelConfig\"", "]", "[", "\"modelParams\"", "]", "[", "\"sensorParams\"", "]", "[", "\"encoders\"", "]",...
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
MonitoredTemporalMemory.read
Intercepts TemporalMemory deserialization request in order to initialize `TemporalMemoryMonitorMixin` state @param proto (DynamicStructBuilder) Proto object @return (TemporalMemory) TemporalMemory shim instance
src/nupic/algorithms/backtracking_tm_shim.py
def read(cls, proto): """ Intercepts TemporalMemory deserialization request in order to initialize `TemporalMemoryMonitorMixin` state @param proto (DynamicStructBuilder) Proto object @return (TemporalMemory) TemporalMemory shim instance """ tm = super(TemporalMemoryMonitorMixin, cls).read(...
def read(cls, proto): """ Intercepts TemporalMemory deserialization request in order to initialize `TemporalMemoryMonitorMixin` state @param proto (DynamicStructBuilder) Proto object @return (TemporalMemory) TemporalMemory shim instance """ tm = super(TemporalMemoryMonitorMixin, cls).read(...
[ "Intercepts", "TemporalMemory", "deserialization", "request", "in", "order", "to", "initialize", "TemporalMemoryMonitorMixin", "state" ]
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/algorithms/backtracking_tm_shim.py#L42-L59
[ "def", "read", "(", "cls", ",", "proto", ")", ":", "tm", "=", "super", "(", "TemporalMemoryMonitorMixin", ",", "cls", ")", ".", "read", "(", "proto", ")", "# initialize `TemporalMemoryMonitorMixin` attributes", "tm", ".", "mmName", "=", "None", "tm", ".", "_...
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
TMShimMixin.read
Intercepts TemporalMemory deserialization request in order to initialize `self.infActiveState` @param proto (DynamicStructBuilder) Proto object @return (TemporalMemory) TemporalMemory shim instance
src/nupic/algorithms/backtracking_tm_shim.py
def read(cls, proto): """ Intercepts TemporalMemory deserialization request in order to initialize `self.infActiveState` @param proto (DynamicStructBuilder) Proto object @return (TemporalMemory) TemporalMemory shim instance """ tm = super(TMShimMixin, cls).read(proto) tm.infActiveState...
def read(cls, proto): """ Intercepts TemporalMemory deserialization request in order to initialize `self.infActiveState` @param proto (DynamicStructBuilder) Proto object @return (TemporalMemory) TemporalMemory shim instance """ tm = super(TMShimMixin, cls).read(proto) tm.infActiveState...
[ "Intercepts", "TemporalMemory", "deserialization", "request", "in", "order", "to", "initialize", "self", ".", "infActiveState" ]
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/algorithms/backtracking_tm_shim.py#L109-L120
[ "def", "read", "(", "cls", ",", "proto", ")", ":", "tm", "=", "super", "(", "TMShimMixin", ",", "cls", ")", ".", "read", "(", "proto", ")", "tm", ".", "infActiveState", "=", "{", "\"t\"", ":", "None", "}", "return", "tm" ]
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
TMShimMixin.topDownCompute
(From `backtracking_tm.py`) Top-down compute - generate expected input given output of the TM @param topDownIn top down input from the level above us @returns best estimate of the TM input that would have generated bottomUpOut.
src/nupic/algorithms/backtracking_tm_shim.py
def topDownCompute(self, topDownIn=None): """ (From `backtracking_tm.py`) Top-down compute - generate expected input given output of the TM @param topDownIn top down input from the level above us @returns best estimate of the TM input that would have generated bottomUpOut. """ output = num...
def topDownCompute(self, topDownIn=None): """ (From `backtracking_tm.py`) Top-down compute - generate expected input given output of the TM @param topDownIn top down input from the level above us @returns best estimate of the TM input that would have generated bottomUpOut. """ output = num...
[ "(", "From", "backtracking_tm", ".", "py", ")", "Top", "-", "down", "compute", "-", "generate", "expected", "input", "given", "output", "of", "the", "TM" ]
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/algorithms/backtracking_tm_shim.py#L150-L162
[ "def", "topDownCompute", "(", "self", ",", "topDownIn", "=", "None", ")", ":", "output", "=", "numpy", ".", "zeros", "(", "self", ".", "numberOfColumns", "(", ")", ")", "columns", "=", "[", "self", ".", "columnForCell", "(", "idx", ")", "for", "idx", ...
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
MonitoredTMShim.read
Intercepts TemporalMemory deserialization request in order to initialize `self.infActiveState` @param proto (DynamicStructBuilder) Proto object @return (TemporalMemory) TemporalMemory shim instance
src/nupic/algorithms/backtracking_tm_shim.py
def read(cls, proto): """ Intercepts TemporalMemory deserialization request in order to initialize `self.infActiveState` @param proto (DynamicStructBuilder) Proto object @return (TemporalMemory) TemporalMemory shim instance """ tm = super(MonitoredTMShim, cls).read(proto) tm.infActiveS...
def read(cls, proto): """ Intercepts TemporalMemory deserialization request in order to initialize `self.infActiveState` @param proto (DynamicStructBuilder) Proto object @return (TemporalMemory) TemporalMemory shim instance """ tm = super(MonitoredTMShim, cls).read(proto) tm.infActiveS...
[ "Intercepts", "TemporalMemory", "deserialization", "request", "in", "order", "to", "initialize", "self", ".", "infActiveState" ]
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/algorithms/backtracking_tm_shim.py#L242-L253
[ "def", "read", "(", "cls", ",", "proto", ")", ":", "tm", "=", "super", "(", "MonitoredTMShim", ",", "cls", ")", ".", "read", "(", "proto", ")", "tm", ".", "infActiveState", "=", "{", "\"t\"", ":", "None", "}", "return", "tm" ]
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
MonitoredTMShim.compute
(From `backtracking_tm.py`) Handle one compute, possibly learning. @param bottomUpInput The bottom-up input, typically from a spatial pooler @param enableLearn If true, perform learning @param computeInfOutput If None, default behavior is to disable the inference ...
src/nupic/algorithms/backtracking_tm_shim.py
def compute(self, bottomUpInput, enableLearn, computeInfOutput=None): """ (From `backtracking_tm.py`) Handle one compute, possibly learning. @param bottomUpInput The bottom-up input, typically from a spatial pooler @param enableLearn If true, perform learning @param computeInfOutput ...
def compute(self, bottomUpInput, enableLearn, computeInfOutput=None): """ (From `backtracking_tm.py`) Handle one compute, possibly learning. @param bottomUpInput The bottom-up input, typically from a spatial pooler @param enableLearn If true, perform learning @param computeInfOutput ...
[ "(", "From", "backtracking_tm", ".", "py", ")", "Handle", "one", "compute", "possibly", "learning", "." ]
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/algorithms/backtracking_tm_shim.py#L256-L278
[ "def", "compute", "(", "self", ",", "bottomUpInput", ",", "enableLearn", ",", "computeInfOutput", "=", "None", ")", ":", "super", "(", "MonitoredTMShim", ",", "self", ")", ".", "compute", "(", "set", "(", "bottomUpInput", ".", "nonzero", "(", ")", "[", "...
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
pickByDistribution
Pick a value according to the provided distribution. Example: :: pickByDistribution([.2, .1]) Returns 0 two thirds of the time and 1 one third of the time. :param distribution: Probability distribution. Need not be normalized. :param r: Instance of random.Random. Uses the system instance if one is ...
src/nupic/math/stats.py
def pickByDistribution(distribution, r=None): """ Pick a value according to the provided distribution. Example: :: pickByDistribution([.2, .1]) Returns 0 two thirds of the time and 1 one third of the time. :param distribution: Probability distribution. Need not be normalized. :param r: Instance o...
def pickByDistribution(distribution, r=None): """ Pick a value according to the provided distribution. Example: :: pickByDistribution([.2, .1]) Returns 0 two thirds of the time and 1 one third of the time. :param distribution: Probability distribution. Need not be normalized. :param r: Instance o...
[ "Pick", "a", "value", "according", "to", "the", "provided", "distribution", "." ]
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/math/stats.py#L36-L60
[ "def", "pickByDistribution", "(", "distribution", ",", "r", "=", "None", ")", ":", "if", "r", "is", "None", ":", "r", "=", "random", "x", "=", "r", ".", "uniform", "(", "0", ",", "sum", "(", "distribution", ")", ")", "for", "i", ",", "d", "in", ...
5922fafffdccc8812e72b3324965ad2f7d4bbdad
valid
Indicator
Returns an array of length size and type dtype that is everywhere 0, except in the index in pos. :param pos: (int) specifies the position of the one entry that will be set. :param size: (int) The total size of the array to be returned. :param dtype: The element type (compatible with NumPy array()) of ...
src/nupic/math/stats.py
def Indicator(pos, size, dtype): """ Returns an array of length size and type dtype that is everywhere 0, except in the index in pos. :param pos: (int) specifies the position of the one entry that will be set. :param size: (int) The total size of the array to be returned. :param dtype: The element type (co...
def Indicator(pos, size, dtype): """ Returns an array of length size and type dtype that is everywhere 0, except in the index in pos. :param pos: (int) specifies the position of the one entry that will be set. :param size: (int) The total size of the array to be returned. :param dtype: The element type (co...
[ "Returns", "an", "array", "of", "length", "size", "and", "type", "dtype", "that", "is", "everywhere", "0", "except", "in", "the", "index", "in", "pos", "." ]
numenta/nupic
python
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/math/stats.py#L64-L77
[ "def", "Indicator", "(", "pos", ",", "size", ",", "dtype", ")", ":", "x", "=", "numpy", ".", "zeros", "(", "size", ",", "dtype", "=", "dtype", ")", "x", "[", "pos", "]", "=", "1", "return", "x" ]
5922fafffdccc8812e72b3324965ad2f7d4bbdad