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 | _getAdditionalSpecs | Build the additional specs in three groups (for the inspector)
Use the type of the default argument to set the Spec type, defaulting
to 'Byte' for None and complex types
Determines the spatial parameters based on the selected implementation.
It defaults to TemporalMemory.
Determines the temporal parameters ... | src/nupic/regions/tm_region.py | def _getAdditionalSpecs(temporalImp, kwargs={}):
"""Build the additional specs in three groups (for the inspector)
Use the type of the default argument to set the Spec type, defaulting
to 'Byte' for None and complex types
Determines the spatial parameters based on the selected implementation.
It defaults to... | def _getAdditionalSpecs(temporalImp, kwargs={}):
"""Build the additional specs in three groups (for the inspector)
Use the type of the default argument to set the Spec type, defaulting
to 'Byte' for None and complex types
Determines the spatial parameters based on the selected implementation.
It defaults to... | [
"Build",
"the",
"additional",
"specs",
"in",
"three",
"groups",
"(",
"for",
"the",
"inspector",
")"
] | numenta/nupic | python | https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/regions/tm_region.py#L117-L287 | [
"def",
"_getAdditionalSpecs",
"(",
"temporalImp",
",",
"kwargs",
"=",
"{",
"}",
")",
":",
"typeNames",
"=",
"{",
"int",
":",
"'UInt32'",
",",
"float",
":",
"'Real32'",
",",
"str",
":",
"'Byte'",
",",
"bool",
":",
"'bool'",
",",
"tuple",
":",
"'tuple'",... | 5922fafffdccc8812e72b3324965ad2f7d4bbdad |
valid | TMRegion.initialize | Overrides :meth:`~nupic.bindings.regions.PyRegion.initialize`. | src/nupic/regions/tm_region.py | def initialize(self):
"""
Overrides :meth:`~nupic.bindings.regions.PyRegion.initialize`.
"""
# Allocate appropriate temporal memory object
# Retrieve the necessary extra arguments that were handled automatically
autoArgs = dict((name, getattr(self, name))
for name in self._te... | def initialize(self):
"""
Overrides :meth:`~nupic.bindings.regions.PyRegion.initialize`.
"""
# Allocate appropriate temporal memory object
# Retrieve the necessary extra arguments that were handled automatically
autoArgs = dict((name, getattr(self, name))
for name in self._te... | [
"Overrides",
":",
"meth",
":",
"~nupic",
".",
"bindings",
".",
"regions",
".",
"PyRegion",
".",
"initialize",
"."
] | numenta/nupic | python | https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/regions/tm_region.py#L407-L427 | [
"def",
"initialize",
"(",
"self",
")",
":",
"# Allocate appropriate temporal memory object",
"# Retrieve the necessary extra arguments that were handled automatically",
"autoArgs",
"=",
"dict",
"(",
"(",
"name",
",",
"getattr",
"(",
"self",
",",
"name",
")",
")",
"for",
... | 5922fafffdccc8812e72b3324965ad2f7d4bbdad |
valid | TMRegion._compute | Run one iteration of TMRegion's compute | src/nupic/regions/tm_region.py | def _compute(self, inputs, outputs):
"""
Run one iteration of TMRegion's compute
"""
#if self.topDownMode and (not 'topDownIn' in inputs):
# raise RuntimeError("The input topDownIn must be linked in if "
# "topDownMode is True")
if self._tfdr is None:
raise Runtime... | def _compute(self, inputs, outputs):
"""
Run one iteration of TMRegion's compute
"""
#if self.topDownMode and (not 'topDownIn' in inputs):
# raise RuntimeError("The input topDownIn must be linked in if "
# "topDownMode is True")
if self._tfdr is None:
raise Runtime... | [
"Run",
"one",
"iteration",
"of",
"TMRegion",
"s",
"compute"
] | numenta/nupic | python | https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/regions/tm_region.py#L479-L555 | [
"def",
"_compute",
"(",
"self",
",",
"inputs",
",",
"outputs",
")",
":",
"#if self.topDownMode and (not 'topDownIn' in inputs):",
"# raise RuntimeError(\"The input topDownIn must be linked in if \"",
"# \"topDownMode is True\")",
"if",
"self",
".",
"_tfdr",
"is",... | 5922fafffdccc8812e72b3324965ad2f7d4bbdad |
valid | TMRegion.getBaseSpec | Doesn't include the spatial, temporal and other parameters
:returns: (dict) the base Spec for TMRegion. | src/nupic/regions/tm_region.py | def getBaseSpec(cls):
"""
Doesn't include the spatial, temporal and other parameters
:returns: (dict) the base Spec for TMRegion.
"""
spec = dict(
description=TMRegion.__doc__,
singleNodeOnly=True,
inputs=dict(
bottomUpIn=dict(
description="""The input signal, co... | def getBaseSpec(cls):
"""
Doesn't include the spatial, temporal and other parameters
:returns: (dict) the base Spec for TMRegion.
"""
spec = dict(
description=TMRegion.__doc__,
singleNodeOnly=True,
inputs=dict(
bottomUpIn=dict(
description="""The input signal, co... | [
"Doesn",
"t",
"include",
"the",
"spatial",
"temporal",
"and",
"other",
"parameters"
] | numenta/nupic | python | https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/regions/tm_region.py#L566-L680 | [
"def",
"getBaseSpec",
"(",
"cls",
")",
":",
"spec",
"=",
"dict",
"(",
"description",
"=",
"TMRegion",
".",
"__doc__",
",",
"singleNodeOnly",
"=",
"True",
",",
"inputs",
"=",
"dict",
"(",
"bottomUpIn",
"=",
"dict",
"(",
"description",
"=",
"\"\"\"The input ... | 5922fafffdccc8812e72b3324965ad2f7d4bbdad |
valid | TMRegion.getSpec | Overrides :meth:`~nupic.bindings.regions.PyRegion.PyRegion.getSpec`.
The parameters collection is constructed based on the parameters specified
by the various components (spatialSpec, temporalSpec and otherSpec) | src/nupic/regions/tm_region.py | def getSpec(cls):
"""
Overrides :meth:`~nupic.bindings.regions.PyRegion.PyRegion.getSpec`.
The parameters collection is constructed based on the parameters specified
by the various components (spatialSpec, temporalSpec and otherSpec)
"""
spec = cls.getBaseSpec()
t, o = _getAdditionalSpecs(t... | def getSpec(cls):
"""
Overrides :meth:`~nupic.bindings.regions.PyRegion.PyRegion.getSpec`.
The parameters collection is constructed based on the parameters specified
by the various components (spatialSpec, temporalSpec and otherSpec)
"""
spec = cls.getBaseSpec()
t, o = _getAdditionalSpecs(t... | [
"Overrides",
":",
"meth",
":",
"~nupic",
".",
"bindings",
".",
"regions",
".",
"PyRegion",
".",
"PyRegion",
".",
"getSpec",
"."
] | numenta/nupic | python | https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/regions/tm_region.py#L683-L695 | [
"def",
"getSpec",
"(",
"cls",
")",
":",
"spec",
"=",
"cls",
".",
"getBaseSpec",
"(",
")",
"t",
",",
"o",
"=",
"_getAdditionalSpecs",
"(",
"temporalImp",
"=",
"gDefaultTemporalImp",
")",
"spec",
"[",
"'parameters'",
"]",
".",
"update",
"(",
"t",
")",
"s... | 5922fafffdccc8812e72b3324965ad2f7d4bbdad |
valid | TMRegion.getParameter | Overrides :meth:`~nupic.bindings.regions.PyRegion.PyRegion.getParameter`.
Get the value of a parameter. Most parameters are handled automatically by
:class:`~nupic.bindings.regions.PyRegion.PyRegion`'s parameter get mechanism. The
ones that need special treatment are explicitly handled here. | src/nupic/regions/tm_region.py | def getParameter(self, parameterName, index=-1):
"""
Overrides :meth:`~nupic.bindings.regions.PyRegion.PyRegion.getParameter`.
Get the value of a parameter. Most parameters are handled automatically by
:class:`~nupic.bindings.regions.PyRegion.PyRegion`'s parameter get mechanism. The
ones that need... | def getParameter(self, parameterName, index=-1):
"""
Overrides :meth:`~nupic.bindings.regions.PyRegion.PyRegion.getParameter`.
Get the value of a parameter. Most parameters are handled automatically by
:class:`~nupic.bindings.regions.PyRegion.PyRegion`'s parameter get mechanism. The
ones that need... | [
"Overrides",
":",
"meth",
":",
"~nupic",
".",
"bindings",
".",
"regions",
".",
"PyRegion",
".",
"PyRegion",
".",
"getParameter",
"."
] | numenta/nupic | python | https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/regions/tm_region.py#L707-L718 | [
"def",
"getParameter",
"(",
"self",
",",
"parameterName",
",",
"index",
"=",
"-",
"1",
")",
":",
"if",
"parameterName",
"in",
"self",
".",
"_temporalArgNames",
":",
"return",
"getattr",
"(",
"self",
".",
"_tfdr",
",",
"parameterName",
")",
"else",
":",
"... | 5922fafffdccc8812e72b3324965ad2f7d4bbdad |
valid | TMRegion.setParameter | Overrides :meth:`~nupic.bindings.regions.PyRegion.PyRegion.setParameter`. | src/nupic/regions/tm_region.py | def setParameter(self, parameterName, index, parameterValue):
"""
Overrides :meth:`~nupic.bindings.regions.PyRegion.PyRegion.setParameter`.
"""
if parameterName in self._temporalArgNames:
setattr(self._tfdr, parameterName, parameterValue)
elif parameterName == "logPathOutput":
self.logP... | def setParameter(self, parameterName, index, parameterValue):
"""
Overrides :meth:`~nupic.bindings.regions.PyRegion.PyRegion.setParameter`.
"""
if parameterName in self._temporalArgNames:
setattr(self._tfdr, parameterName, parameterValue)
elif parameterName == "logPathOutput":
self.logP... | [
"Overrides",
":",
"meth",
":",
"~nupic",
".",
"bindings",
".",
"regions",
".",
"PyRegion",
".",
"PyRegion",
".",
"setParameter",
"."
] | numenta/nupic | python | https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/regions/tm_region.py#L721-L743 | [
"def",
"setParameter",
"(",
"self",
",",
"parameterName",
",",
"index",
",",
"parameterValue",
")",
":",
"if",
"parameterName",
"in",
"self",
".",
"_temporalArgNames",
":",
"setattr",
"(",
"self",
".",
"_tfdr",
",",
"parameterName",
",",
"parameterValue",
")",... | 5922fafffdccc8812e72b3324965ad2f7d4bbdad |
valid | TMRegion.finishLearning | Perform an internal optimization step that speeds up inference if we know
learning will not be performed anymore. This call may, for example, remove
all potential inputs to each column. | src/nupic/regions/tm_region.py | def finishLearning(self):
"""
Perform an internal optimization step that speeds up inference if we know
learning will not be performed anymore. This call may, for example, remove
all potential inputs to each column.
"""
if self._tfdr is None:
raise RuntimeError("Temporal memory has not bee... | def finishLearning(self):
"""
Perform an internal optimization step that speeds up inference if we know
learning will not be performed anymore. This call may, for example, remove
all potential inputs to each column.
"""
if self._tfdr is None:
raise RuntimeError("Temporal memory has not bee... | [
"Perform",
"an",
"internal",
"optimization",
"step",
"that",
"speeds",
"up",
"inference",
"if",
"we",
"know",
"learning",
"will",
"not",
"be",
"performed",
"anymore",
".",
"This",
"call",
"may",
"for",
"example",
"remove",
"all",
"potential",
"inputs",
"to",
... | numenta/nupic | python | https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/regions/tm_region.py#L760-L771 | [
"def",
"finishLearning",
"(",
"self",
")",
":",
"if",
"self",
".",
"_tfdr",
"is",
"None",
":",
"raise",
"RuntimeError",
"(",
"\"Temporal memory has not been initialized\"",
")",
"if",
"hasattr",
"(",
"self",
".",
"_tfdr",
",",
"'finishLearning'",
")",
":",
"se... | 5922fafffdccc8812e72b3324965ad2f7d4bbdad |
valid | TMRegion.writeToProto | Overrides :meth:`~nupic.bindings.regions.PyRegion.PyRegion.writeToProto`.
Write state to proto object.
:param proto: TMRegionProto capnproto object | src/nupic/regions/tm_region.py | def writeToProto(self, proto):
"""
Overrides :meth:`~nupic.bindings.regions.PyRegion.PyRegion.writeToProto`.
Write state to proto object.
:param proto: TMRegionProto capnproto object
"""
proto.temporalImp = self.temporalImp
proto.columnCount = self.columnCount
proto.inputWidth = self.i... | def writeToProto(self, proto):
"""
Overrides :meth:`~nupic.bindings.regions.PyRegion.PyRegion.writeToProto`.
Write state to proto object.
:param proto: TMRegionProto capnproto object
"""
proto.temporalImp = self.temporalImp
proto.columnCount = self.columnCount
proto.inputWidth = self.i... | [
"Overrides",
":",
"meth",
":",
"~nupic",
".",
"bindings",
".",
"regions",
".",
"PyRegion",
".",
"PyRegion",
".",
"writeToProto",
"."
] | numenta/nupic | python | https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/regions/tm_region.py#L788-L821 | [
"def",
"writeToProto",
"(",
"self",
",",
"proto",
")",
":",
"proto",
".",
"temporalImp",
"=",
"self",
".",
"temporalImp",
"proto",
".",
"columnCount",
"=",
"self",
".",
"columnCount",
"proto",
".",
"inputWidth",
"=",
"self",
".",
"inputWidth",
"proto",
"."... | 5922fafffdccc8812e72b3324965ad2f7d4bbdad |
valid | TMRegion.readFromProto | Overrides :meth:`~nupic.bindings.regions.PyRegion.PyRegion.readFromProto`.
Read state from proto object.
:param proto: TMRegionProto capnproto object | src/nupic/regions/tm_region.py | def readFromProto(cls, proto):
"""
Overrides :meth:`~nupic.bindings.regions.PyRegion.PyRegion.readFromProto`.
Read state from proto object.
:param proto: TMRegionProto capnproto object
"""
instance = cls(proto.columnCount, proto.inputWidth, proto.cellsPerColumn)
instance.temporalImp = pro... | def readFromProto(cls, proto):
"""
Overrides :meth:`~nupic.bindings.regions.PyRegion.PyRegion.readFromProto`.
Read state from proto object.
:param proto: TMRegionProto capnproto object
"""
instance = cls(proto.columnCount, proto.inputWidth, proto.cellsPerColumn)
instance.temporalImp = pro... | [
"Overrides",
":",
"meth",
":",
"~nupic",
".",
"bindings",
".",
"regions",
".",
"PyRegion",
".",
"PyRegion",
".",
"readFromProto",
"."
] | numenta/nupic | python | https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/regions/tm_region.py#L825-L859 | [
"def",
"readFromProto",
"(",
"cls",
",",
"proto",
")",
":",
"instance",
"=",
"cls",
"(",
"proto",
".",
"columnCount",
",",
"proto",
".",
"inputWidth",
",",
"proto",
".",
"cellsPerColumn",
")",
"instance",
".",
"temporalImp",
"=",
"proto",
".",
"temporalImp... | 5922fafffdccc8812e72b3324965ad2f7d4bbdad |
valid | TMRegion.getOutputElementCount | Overrides :meth:`~nupic.bindings.regions.PyRegion.PyRegion.getOutputElementCount`. | src/nupic/regions/tm_region.py | def getOutputElementCount(self, name):
"""
Overrides :meth:`~nupic.bindings.regions.PyRegion.PyRegion.getOutputElementCount`.
"""
if name == 'bottomUpOut':
return self.outputWidth
elif name == 'topDownOut':
return self.columnCount
elif name == 'lrnActiveStateT':
return self.out... | def getOutputElementCount(self, name):
"""
Overrides :meth:`~nupic.bindings.regions.PyRegion.PyRegion.getOutputElementCount`.
"""
if name == 'bottomUpOut':
return self.outputWidth
elif name == 'topDownOut':
return self.columnCount
elif name == 'lrnActiveStateT':
return self.out... | [
"Overrides",
":",
"meth",
":",
"~nupic",
".",
"bindings",
".",
"regions",
".",
"PyRegion",
".",
"PyRegion",
".",
"getOutputElementCount",
"."
] | numenta/nupic | python | https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/regions/tm_region.py#L986-L1001 | [
"def",
"getOutputElementCount",
"(",
"self",
",",
"name",
")",
":",
"if",
"name",
"==",
"'bottomUpOut'",
":",
"return",
"self",
".",
"outputWidth",
"elif",
"name",
"==",
"'topDownOut'",
":",
"return",
"self",
".",
"columnCount",
"elif",
"name",
"==",
"'lrnAc... | 5922fafffdccc8812e72b3324965ad2f7d4bbdad |
valid | computeRawAnomalyScore | Computes the raw anomaly score.
The raw anomaly score is the fraction of active columns not predicted.
:param activeColumns: array of active column indices
:param prevPredictedColumns: array of columns indices predicted in prev step
:returns: anomaly score 0..1 (float) | src/nupic/algorithms/anomaly.py | def computeRawAnomalyScore(activeColumns, prevPredictedColumns):
"""Computes the raw anomaly score.
The raw anomaly score is the fraction of active columns not predicted.
:param activeColumns: array of active column indices
:param prevPredictedColumns: array of columns indices predicted in prev step
:return... | def computeRawAnomalyScore(activeColumns, prevPredictedColumns):
"""Computes the raw anomaly score.
The raw anomaly score is the fraction of active columns not predicted.
:param activeColumns: array of active column indices
:param prevPredictedColumns: array of columns indices predicted in prev step
:return... | [
"Computes",
"the",
"raw",
"anomaly",
"score",
"."
] | numenta/nupic | python | https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/algorithms/anomaly.py#L30-L52 | [
"def",
"computeRawAnomalyScore",
"(",
"activeColumns",
",",
"prevPredictedColumns",
")",
":",
"nActiveColumns",
"=",
"len",
"(",
"activeColumns",
")",
"if",
"nActiveColumns",
">",
"0",
":",
"# Test whether each element of a 1-D array is also present in a second",
"# array. Su... | 5922fafffdccc8812e72b3324965ad2f7d4bbdad |
valid | Anomaly.compute | Compute the anomaly score as the percent of active columns not predicted.
:param activeColumns: array of active column indices
:param predictedColumns: array of columns indices predicted in this step
(used for anomaly in step T+1)
:param inputValue: (optional) value of current ... | src/nupic/algorithms/anomaly.py | def compute(self, activeColumns, predictedColumns,
inputValue=None, timestamp=None):
"""Compute the anomaly score as the percent of active columns not predicted.
:param activeColumns: array of active column indices
:param predictedColumns: array of columns indices predicted in this step
... | def compute(self, activeColumns, predictedColumns,
inputValue=None, timestamp=None):
"""Compute the anomaly score as the percent of active columns not predicted.
:param activeColumns: array of active column indices
:param predictedColumns: array of columns indices predicted in this step
... | [
"Compute",
"the",
"anomaly",
"score",
"as",
"the",
"percent",
"of",
"active",
"columns",
"not",
"predicted",
"."
] | numenta/nupic | python | https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/algorithms/anomaly.py#L125-L170 | [
"def",
"compute",
"(",
"self",
",",
"activeColumns",
",",
"predictedColumns",
",",
"inputValue",
"=",
"None",
",",
"timestamp",
"=",
"None",
")",
":",
"# Start by computing the raw anomaly score.",
"anomalyScore",
"=",
"computeRawAnomalyScore",
"(",
"activeColumns",
"... | 5922fafffdccc8812e72b3324965ad2f7d4bbdad |
valid | Plot.addGraph | Adds a graph to the plot's figure.
@param data See matplotlib.Axes.plot documentation.
@param position A 3-digit number. The first two digits define a 2D grid
where subplots may be added. The final digit specifies the nth grid
location for the added subplot
@param xlabel text to be ... | src/nupic/algorithms/monitor_mixin/plot.py | def addGraph(self, data, position=111, xlabel=None, ylabel=None):
""" Adds a graph to the plot's figure.
@param data See matplotlib.Axes.plot documentation.
@param position A 3-digit number. The first two digits define a 2D grid
where subplots may be added. The final digit specifies the nth gri... | def addGraph(self, data, position=111, xlabel=None, ylabel=None):
""" Adds a graph to the plot's figure.
@param data See matplotlib.Axes.plot documentation.
@param position A 3-digit number. The first two digits define a 2D grid
where subplots may be added. The final digit specifies the nth gri... | [
"Adds",
"a",
"graph",
"to",
"the",
"plot",
"s",
"figure",
"."
] | numenta/nupic | python | https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/algorithms/monitor_mixin/plot.py#L74-L86 | [
"def",
"addGraph",
"(",
"self",
",",
"data",
",",
"position",
"=",
"111",
",",
"xlabel",
"=",
"None",
",",
"ylabel",
"=",
"None",
")",
":",
"ax",
"=",
"self",
".",
"_addBase",
"(",
"position",
",",
"xlabel",
"=",
"xlabel",
",",
"ylabel",
"=",
"ylab... | 5922fafffdccc8812e72b3324965ad2f7d4bbdad |
valid | Plot.addHistogram | Adds a histogram to the plot's figure.
@param data See matplotlib.Axes.hist documentation.
@param position A 3-digit number. The first two digits define a 2D grid
where subplots may be added. The final digit specifies the nth grid
location for the added subplot
@param xlabel text to... | src/nupic/algorithms/monitor_mixin/plot.py | def addHistogram(self, data, position=111, xlabel=None, ylabel=None,
bins=None):
""" Adds a histogram to the plot's figure.
@param data See matplotlib.Axes.hist documentation.
@param position A 3-digit number. The first two digits define a 2D grid
where subplots may be added.... | def addHistogram(self, data, position=111, xlabel=None, ylabel=None,
bins=None):
""" Adds a histogram to the plot's figure.
@param data See matplotlib.Axes.hist documentation.
@param position A 3-digit number. The first two digits define a 2D grid
where subplots may be added.... | [
"Adds",
"a",
"histogram",
"to",
"the",
"plot",
"s",
"figure",
"."
] | numenta/nupic | python | https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/algorithms/monitor_mixin/plot.py#L89-L102 | [
"def",
"addHistogram",
"(",
"self",
",",
"data",
",",
"position",
"=",
"111",
",",
"xlabel",
"=",
"None",
",",
"ylabel",
"=",
"None",
",",
"bins",
"=",
"None",
")",
":",
"ax",
"=",
"self",
".",
"_addBase",
"(",
"position",
",",
"xlabel",
"=",
"xlab... | 5922fafffdccc8812e72b3324965ad2f7d4bbdad |
valid | Plot.add2DArray | Adds an image to the plot's figure.
@param data a 2D array. See matplotlib.Axes.imshow documentation.
@param position A 3-digit number. The first two digits define a 2D grid
where subplots may be added. The final digit specifies the nth grid
location for the added subplot
@param xla... | src/nupic/algorithms/monitor_mixin/plot.py | def add2DArray(self, data, position=111, xlabel=None, ylabel=None, cmap=None,
aspect="auto", interpolation="nearest", name=None):
""" Adds an image to the plot's figure.
@param data a 2D array. See matplotlib.Axes.imshow documentation.
@param position A 3-digit number. The first two digits... | def add2DArray(self, data, position=111, xlabel=None, ylabel=None, cmap=None,
aspect="auto", interpolation="nearest", name=None):
""" Adds an image to the plot's figure.
@param data a 2D array. See matplotlib.Axes.imshow documentation.
@param position A 3-digit number. The first two digits... | [
"Adds",
"an",
"image",
"to",
"the",
"plot",
"s",
"figure",
"."
] | numenta/nupic | python | https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/algorithms/monitor_mixin/plot.py#L105-L133 | [
"def",
"add2DArray",
"(",
"self",
",",
"data",
",",
"position",
"=",
"111",
",",
"xlabel",
"=",
"None",
",",
"ylabel",
"=",
"None",
",",
"cmap",
"=",
"None",
",",
"aspect",
"=",
"\"auto\"",
",",
"interpolation",
"=",
"\"nearest\"",
",",
"name",
"=",
... | 5922fafffdccc8812e72b3324965ad2f7d4bbdad |
valid | Plot._addBase | Adds a subplot to the plot's figure at specified position.
@param position A 3-digit number. The first two digits define a 2D grid
where subplots may be added. The final digit specifies the nth grid
location for the added subplot
@param xlabel text to be displayed on the x-axis
@par... | src/nupic/algorithms/monitor_mixin/plot.py | def _addBase(self, position, xlabel=None, ylabel=None):
""" Adds a subplot to the plot's figure at specified position.
@param position A 3-digit number. The first two digits define a 2D grid
where subplots may be added. The final digit specifies the nth grid
location for the added subpl... | def _addBase(self, position, xlabel=None, ylabel=None):
""" Adds a subplot to the plot's figure at specified position.
@param position A 3-digit number. The first two digits define a 2D grid
where subplots may be added. The final digit specifies the nth grid
location for the added subpl... | [
"Adds",
"a",
"subplot",
"to",
"the",
"plot",
"s",
"figure",
"at",
"specified",
"position",
"."
] | numenta/nupic | python | https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/algorithms/monitor_mixin/plot.py#L137-L150 | [
"def",
"_addBase",
"(",
"self",
",",
"position",
",",
"xlabel",
"=",
"None",
",",
"ylabel",
"=",
"None",
")",
":",
"ax",
"=",
"self",
".",
"_fig",
".",
"add_subplot",
"(",
"position",
")",
"ax",
".",
"set_xlabel",
"(",
"xlabel",
")",
"ax",
".",
"se... | 5922fafffdccc8812e72b3324965ad2f7d4bbdad |
valid | _generateOverlapping | Generate a temporal dataset containing sequences that overlap one or more
elements with other sequences.
Parameters:
----------------------------------------------------
filename: name of the file to produce, including extension. It will
be created in a 'datasets' sub-directory withi... | examples/opf/experiments/multistep/make_datasets.py | def _generateOverlapping(filename="overlap.csv", numSequences=2, elementsPerSeq=3,
numRepeats=10, hub=[0,1], hubOffset=1, resets=False):
""" Generate a temporal dataset containing sequences that overlap one or more
elements with other sequences.
Parameters:
--------------------------... | def _generateOverlapping(filename="overlap.csv", numSequences=2, elementsPerSeq=3,
numRepeats=10, hub=[0,1], hubOffset=1, resets=False):
""" Generate a temporal dataset containing sequences that overlap one or more
elements with other sequences.
Parameters:
--------------------------... | [
"Generate",
"a",
"temporal",
"dataset",
"containing",
"sequences",
"that",
"overlap",
"one",
"or",
"more",
"elements",
"with",
"other",
"sequences",
".",
"Parameters",
":",
"----------------------------------------------------",
"filename",
":",
"name",
"of",
"the",
"... | numenta/nupic | python | https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/examples/opf/experiments/multistep/make_datasets.py#L83-L146 | [
"def",
"_generateOverlapping",
"(",
"filename",
"=",
"\"overlap.csv\"",
",",
"numSequences",
"=",
"2",
",",
"elementsPerSeq",
"=",
"3",
",",
"numRepeats",
"=",
"10",
",",
"hub",
"=",
"[",
"0",
",",
"1",
"]",
",",
"hubOffset",
"=",
"1",
",",
"resets",
"... | 5922fafffdccc8812e72b3324965ad2f7d4bbdad |
valid | _generateFirstOrder0 | Generate the initial, first order, and second order transition
probabilities for 'probability0'. For this model, we generate the following
set of sequences:
.1 .75
0----1-----2
\ \
\ \ .25
\ \-----3
\
\ .9 .5
\--- 4--------- 2
\
... | examples/opf/experiments/multistep/make_datasets.py | def _generateFirstOrder0():
""" Generate the initial, first order, and second order transition
probabilities for 'probability0'. For this model, we generate the following
set of sequences:
.1 .75
0----1-----2
\ \
\ \ .25
\ \-----3
\
\ .9 .5
\--- 4-----... | def _generateFirstOrder0():
""" Generate the initial, first order, and second order transition
probabilities for 'probability0'. For this model, we generate the following
set of sequences:
.1 .75
0----1-----2
\ \
\ \ .25
\ \-----3
\
\ .9 .5
\--- 4-----... | [
"Generate",
"the",
"initial",
"first",
"order",
"and",
"second",
"order",
"transition",
"probabilities",
"for",
"probability0",
".",
"For",
"this",
"model",
"we",
"generate",
"the",
"following",
"set",
"of",
"sequences",
":",
".",
"1",
".",
"75",
"0",
"----"... | numenta/nupic | python | https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/examples/opf/experiments/multistep/make_datasets.py#L150-L230 | [
"def",
"_generateFirstOrder0",
"(",
")",
":",
"# --------------------------------------------------------------------",
"# Initial probabilities, 'a' and 'e' equally likely",
"numCategories",
"=",
"5",
"initProb",
"=",
"numpy",
".",
"zeros",
"(",
"numCategories",
")",
"initProb",... | 5922fafffdccc8812e72b3324965ad2f7d4bbdad |
valid | _generateFileFromProb | Generate a set of records reflecting a set of probabilities.
Parameters:
----------------------------------------------------------------
filename: name of .csv file to generate
numRecords: number of records to generate
categoryList: list of category names
initProb: Initial prob... | examples/opf/experiments/multistep/make_datasets.py | def _generateFileFromProb(filename, numRecords, categoryList, initProb,
firstOrderProb, secondOrderProb, seqLen, numNoise=0, resetsEvery=None):
""" Generate a set of records reflecting a set of probabilities.
Parameters:
----------------------------------------------------------------
filename: ... | def _generateFileFromProb(filename, numRecords, categoryList, initProb,
firstOrderProb, secondOrderProb, seqLen, numNoise=0, resetsEvery=None):
""" Generate a set of records reflecting a set of probabilities.
Parameters:
----------------------------------------------------------------
filename: ... | [
"Generate",
"a",
"set",
"of",
"records",
"reflecting",
"a",
"set",
"of",
"probabilities",
".",
"Parameters",
":",
"----------------------------------------------------------------",
"filename",
":",
"name",
"of",
".",
"csv",
"file",
"to",
"generate",
"numRecords",
":"... | numenta/nupic | python | https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/examples/opf/experiments/multistep/make_datasets.py#L234-L373 | [
"def",
"_generateFileFromProb",
"(",
"filename",
",",
"numRecords",
",",
"categoryList",
",",
"initProb",
",",
"firstOrderProb",
",",
"secondOrderProb",
",",
"seqLen",
",",
"numNoise",
"=",
"0",
",",
"resetsEvery",
"=",
"None",
")",
":",
"# Create the file",
"pr... | 5922fafffdccc8812e72b3324965ad2f7d4bbdad |
valid | getVersion | Get version from local file. | setup.py | def getVersion():
"""
Get version from local file.
"""
with open(os.path.join(REPO_DIR, "VERSION"), "r") as versionFile:
return versionFile.read().strip() | def getVersion():
"""
Get version from local file.
"""
with open(os.path.join(REPO_DIR, "VERSION"), "r") as versionFile:
return versionFile.read().strip() | [
"Get",
"version",
"from",
"local",
"file",
"."
] | numenta/nupic | python | https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/setup.py#L37-L42 | [
"def",
"getVersion",
"(",
")",
":",
"with",
"open",
"(",
"os",
".",
"path",
".",
"join",
"(",
"REPO_DIR",
",",
"\"VERSION\"",
")",
",",
"\"r\"",
")",
"as",
"versionFile",
":",
"return",
"versionFile",
".",
"read",
"(",
")",
".",
"strip",
"(",
")"
] | 5922fafffdccc8812e72b3324965ad2f7d4bbdad |
valid | nupicBindingsPrereleaseInstalled | Make an attempt to determine if a pre-release version of nupic.bindings is
installed already.
@return: boolean | setup.py | def nupicBindingsPrereleaseInstalled():
"""
Make an attempt to determine if a pre-release version of nupic.bindings is
installed already.
@return: boolean
"""
try:
nupicDistribution = pkg_resources.get_distribution("nupic.bindings")
if pkg_resources.parse_version(nupicDistribution.version).is_prere... | def nupicBindingsPrereleaseInstalled():
"""
Make an attempt to determine if a pre-release version of nupic.bindings is
installed already.
@return: boolean
"""
try:
nupicDistribution = pkg_resources.get_distribution("nupic.bindings")
if pkg_resources.parse_version(nupicDistribution.version).is_prere... | [
"Make",
"an",
"attempt",
"to",
"determine",
"if",
"a",
"pre",
"-",
"release",
"version",
"of",
"nupic",
".",
"bindings",
"is",
"installed",
"already",
"."
] | numenta/nupic | python | https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/setup.py#L46-L62 | [
"def",
"nupicBindingsPrereleaseInstalled",
"(",
")",
":",
"try",
":",
"nupicDistribution",
"=",
"pkg_resources",
".",
"get_distribution",
"(",
"\"nupic.bindings\"",
")",
"if",
"pkg_resources",
".",
"parse_version",
"(",
"nupicDistribution",
".",
"version",
")",
".",
... | 5922fafffdccc8812e72b3324965ad2f7d4bbdad |
valid | findRequirements | Read the requirements.txt file and parse into requirements for setup's
install_requirements option. | setup.py | def findRequirements():
"""
Read the requirements.txt file and parse into requirements for setup's
install_requirements option.
"""
requirementsPath = os.path.join(REPO_DIR, "requirements.txt")
requirements = parse_file(requirementsPath)
if nupicBindingsPrereleaseInstalled():
# User has a pre-release... | def findRequirements():
"""
Read the requirements.txt file and parse into requirements for setup's
install_requirements option.
"""
requirementsPath = os.path.join(REPO_DIR, "requirements.txt")
requirements = parse_file(requirementsPath)
if nupicBindingsPrereleaseInstalled():
# User has a pre-release... | [
"Read",
"the",
"requirements",
".",
"txt",
"file",
"and",
"parse",
"into",
"requirements",
"for",
"setup",
"s",
"install_requirements",
"option",
"."
] | numenta/nupic | python | https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/setup.py#L105-L121 | [
"def",
"findRequirements",
"(",
")",
":",
"requirementsPath",
"=",
"os",
".",
"path",
".",
"join",
"(",
"REPO_DIR",
",",
"\"requirements.txt\"",
")",
"requirements",
"=",
"parse_file",
"(",
"requirementsPath",
")",
"if",
"nupicBindingsPrereleaseInstalled",
"(",
")... | 5922fafffdccc8812e72b3324965ad2f7d4bbdad |
valid | _handleDescriptionOption | Parses and validates the --description option args and executes the
request
Parameters:
-----------------------------------------------------------------------
cmdArgStr: JSON string compatible with _gExperimentDescriptionSchema
outDir: where to place generated experiment files
usageStr: program usa... | src/nupic/swarming/exp_generator/experiment_generator.py | def _handleDescriptionOption(cmdArgStr, outDir, usageStr, hsVersion,
claDescriptionTemplateFile):
"""
Parses and validates the --description option args and executes the
request
Parameters:
-----------------------------------------------------------------------
cmdArgStr: JSON... | def _handleDescriptionOption(cmdArgStr, outDir, usageStr, hsVersion,
claDescriptionTemplateFile):
"""
Parses and validates the --description option args and executes the
request
Parameters:
-----------------------------------------------------------------------
cmdArgStr: JSON... | [
"Parses",
"and",
"validates",
"the",
"--",
"description",
"option",
"args",
"and",
"executes",
"the",
"request"
] | numenta/nupic | python | https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/swarming/exp_generator/experiment_generator.py#L160-L194 | [
"def",
"_handleDescriptionOption",
"(",
"cmdArgStr",
",",
"outDir",
",",
"usageStr",
",",
"hsVersion",
",",
"claDescriptionTemplateFile",
")",
":",
"# convert --description arg from JSON string to dict",
"try",
":",
"args",
"=",
"json",
".",
"loads",
"(",
"cmdArgStr",
... | 5922fafffdccc8812e72b3324965ad2f7d4bbdad |
valid | _handleDescriptionFromFileOption | Parses and validates the --descriptionFromFile option and executes the
request
Parameters:
-----------------------------------------------------------------------
filename: File from which we'll extract description JSON
outDir: where to place generated experiment files
usageStr: program usage strin... | src/nupic/swarming/exp_generator/experiment_generator.py | def _handleDescriptionFromFileOption(filename, outDir, usageStr, hsVersion,
claDescriptionTemplateFile):
"""
Parses and validates the --descriptionFromFile option and executes the
request
Parameters:
-----------------------------------------------------------------------
filena... | def _handleDescriptionFromFileOption(filename, outDir, usageStr, hsVersion,
claDescriptionTemplateFile):
"""
Parses and validates the --descriptionFromFile option and executes the
request
Parameters:
-----------------------------------------------------------------------
filena... | [
"Parses",
"and",
"validates",
"the",
"--",
"descriptionFromFile",
"option",
"and",
"executes",
"the",
"request"
] | numenta/nupic | python | https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/swarming/exp_generator/experiment_generator.py#L198-L229 | [
"def",
"_handleDescriptionFromFileOption",
"(",
"filename",
",",
"outDir",
",",
"usageStr",
",",
"hsVersion",
",",
"claDescriptionTemplateFile",
")",
":",
"try",
":",
"fileHandle",
"=",
"open",
"(",
"filename",
",",
"'r'",
")",
"JSONStringFromFile",
"=",
"fileHand... | 5922fafffdccc8812e72b3324965ad2f7d4bbdad |
valid | _isInt | Return (isInt, intValue) for a given floating point number.
Parameters:
----------------------------------------------------------------------
x: floating point number to evaluate
precision: desired precision
retval: (isInt, intValue)
isInt: True if x is close enough to an integer value
... | src/nupic/swarming/exp_generator/experiment_generator.py | def _isInt(x, precision = 0.0001):
"""
Return (isInt, intValue) for a given floating point number.
Parameters:
----------------------------------------------------------------------
x: floating point number to evaluate
precision: desired precision
retval: (isInt, intValue)
isInt: True if x... | def _isInt(x, precision = 0.0001):
"""
Return (isInt, intValue) for a given floating point number.
Parameters:
----------------------------------------------------------------------
x: floating point number to evaluate
precision: desired precision
retval: (isInt, intValue)
isInt: True if x... | [
"Return",
"(",
"isInt",
"intValue",
")",
"for",
"a",
"given",
"floating",
"point",
"number",
"."
] | numenta/nupic | python | https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/swarming/exp_generator/experiment_generator.py#L233-L247 | [
"def",
"_isInt",
"(",
"x",
",",
"precision",
"=",
"0.0001",
")",
":",
"xInt",
"=",
"int",
"(",
"round",
"(",
"x",
")",
")",
"return",
"(",
"abs",
"(",
"x",
"-",
"xInt",
")",
"<",
"precision",
"*",
"x",
",",
"xInt",
")"
] | 5922fafffdccc8812e72b3324965ad2f7d4bbdad |
valid | _indentLines | Indent all lines in the given string
str: input string
indentLevels: number of levels of indentation to apply
indentFirstLine: if False, the 1st line will not be indented
Returns: The result string with all lines indented | src/nupic/swarming/exp_generator/experiment_generator.py | def _indentLines(str, indentLevels = 1, indentFirstLine=True):
""" Indent all lines in the given string
str: input string
indentLevels: number of levels of indentation to apply
indentFirstLine: if False, the 1st line will not be indented
Returns: The result string with all lines indented
"""... | def _indentLines(str, indentLevels = 1, indentFirstLine=True):
""" Indent all lines in the given string
str: input string
indentLevels: number of levels of indentation to apply
indentFirstLine: if False, the 1st line will not be indented
Returns: The result string with all lines indented
"""... | [
"Indent",
"all",
"lines",
"in",
"the",
"given",
"string"
] | numenta/nupic | python | https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/swarming/exp_generator/experiment_generator.py#L272-L296 | [
"def",
"_indentLines",
"(",
"str",
",",
"indentLevels",
"=",
"1",
",",
"indentFirstLine",
"=",
"True",
")",
":",
"indent",
"=",
"_ONE_INDENT",
"*",
"indentLevels",
"lines",
"=",
"str",
".",
"splitlines",
"(",
"True",
")",
"result",
"=",
"''",
"if",
"len"... | 5922fafffdccc8812e72b3324965ad2f7d4bbdad |
valid | _generateMetricSpecString | Generates the string representation of a MetricSpec object, and returns
the metric key associated with the metric.
Parameters:
-----------------------------------------------------------------------
inferenceElement:
An InferenceElement value that indicates which part of the inference this
metric is c... | src/nupic/swarming/exp_generator/experiment_generator.py | def _generateMetricSpecString(inferenceElement, metric,
params=None, field=None,
returnLabel=False):
""" Generates the string representation of a MetricSpec object, and returns
the metric key associated with the metric.
Parameters:
------------------... | def _generateMetricSpecString(inferenceElement, metric,
params=None, field=None,
returnLabel=False):
""" Generates the string representation of a MetricSpec object, and returns
the metric key associated with the metric.
Parameters:
------------------... | [
"Generates",
"the",
"string",
"representation",
"of",
"a",
"MetricSpec",
"object",
"and",
"returns",
"the",
"metric",
"key",
"associated",
"with",
"the",
"metric",
"."
] | numenta/nupic | python | https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/swarming/exp_generator/experiment_generator.py#L313-L354 | [
"def",
"_generateMetricSpecString",
"(",
"inferenceElement",
",",
"metric",
",",
"params",
"=",
"None",
",",
"field",
"=",
"None",
",",
"returnLabel",
"=",
"False",
")",
":",
"metricSpecArgs",
"=",
"dict",
"(",
"metric",
"=",
"metric",
",",
"field",
"=",
"... | 5922fafffdccc8812e72b3324965ad2f7d4bbdad |
valid | _generateFileFromTemplates | Generates a file by applying token replacements to the given template
file
templateFileName:
A list of template file names; these files are assumed to be in
the same directory as the running experiment_generator.py script.
ExpGenerator will perform the substitu... | src/nupic/swarming/exp_generator/experiment_generator.py | def _generateFileFromTemplates(templateFileNames, outputFilePath,
replacementDict):
""" Generates a file by applying token replacements to the given template
file
templateFileName:
A list of template file names; these files are assumed to be in
th... | def _generateFileFromTemplates(templateFileNames, outputFilePath,
replacementDict):
""" Generates a file by applying token replacements to the given template
file
templateFileName:
A list of template file names; these files are assumed to be in
th... | [
"Generates",
"a",
"file",
"by",
"applying",
"token",
"replacements",
"to",
"the",
"given",
"template",
"file"
] | numenta/nupic | python | https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/swarming/exp_generator/experiment_generator.py#L358-L405 | [
"def",
"_generateFileFromTemplates",
"(",
"templateFileNames",
",",
"outputFilePath",
",",
"replacementDict",
")",
":",
"# Find out where we're running from so we know where to find templates",
"installPath",
"=",
"os",
".",
"path",
".",
"dirname",
"(",
"__file__",
")",
"ou... | 5922fafffdccc8812e72b3324965ad2f7d4bbdad |
valid | _generateEncoderChoicesV1 | Return a list of possible encoder parameter combinations for the given
field and the default aggregation function to use. Each parameter combination
is a dict defining the parameters for the encoder. Here is an example
return value for the encoderChoicesList:
[
None,
{'fieldname':'timestamp',
... | src/nupic/swarming/exp_generator/experiment_generator.py | def _generateEncoderChoicesV1(fieldInfo):
""" Return a list of possible encoder parameter combinations for the given
field and the default aggregation function to use. Each parameter combination
is a dict defining the parameters for the encoder. Here is an example
return value for the encoderChoicesList:
[
... | def _generateEncoderChoicesV1(fieldInfo):
""" Return a list of possible encoder parameter combinations for the given
field and the default aggregation function to use. Each parameter combination
is a dict defining the parameters for the encoder. Here is an example
return value for the encoderChoicesList:
[
... | [
"Return",
"a",
"list",
"of",
"possible",
"encoder",
"parameter",
"combinations",
"for",
"the",
"given",
"field",
"and",
"the",
"default",
"aggregation",
"function",
"to",
"use",
".",
"Each",
"parameter",
"combination",
"is",
"a",
"dict",
"defining",
"the",
"pa... | numenta/nupic | python | https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/swarming/exp_generator/experiment_generator.py#L409-L498 | [
"def",
"_generateEncoderChoicesV1",
"(",
"fieldInfo",
")",
":",
"width",
"=",
"7",
"fieldName",
"=",
"fieldInfo",
"[",
"'fieldName'",
"]",
"fieldType",
"=",
"fieldInfo",
"[",
"'fieldType'",
"]",
"encoderChoicesList",
"=",
"[",
"]",
"# Scalar?",
"if",
"fieldType"... | 5922fafffdccc8812e72b3324965ad2f7d4bbdad |
valid | _generateEncoderStringsV1 | Generate and return the following encoder related substitution variables:
encoderSpecsStr:
For the base description file, this string defines the default
encoding dicts for each encoder. For example:
'__gym_encoder' : { 'fieldname': 'gym',
'n': 13,
'name': 'gym',
'typ... | src/nupic/swarming/exp_generator/experiment_generator.py | def _generateEncoderStringsV1(includedFields):
""" Generate and return the following encoder related substitution variables:
encoderSpecsStr:
For the base description file, this string defines the default
encoding dicts for each encoder. For example:
'__gym_encoder' : { 'fieldname': 'gym',
... | def _generateEncoderStringsV1(includedFields):
""" Generate and return the following encoder related substitution variables:
encoderSpecsStr:
For the base description file, this string defines the default
encoding dicts for each encoder. For example:
'__gym_encoder' : { 'fieldname': 'gym',
... | [
"Generate",
"and",
"return",
"the",
"following",
"encoder",
"related",
"substitution",
"variables",
":"
] | numenta/nupic | python | https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/swarming/exp_generator/experiment_generator.py#L502-L620 | [
"def",
"_generateEncoderStringsV1",
"(",
"includedFields",
")",
":",
"# ------------------------------------------------------------------------",
"# First accumulate the possible choices for each encoder",
"encoderChoicesList",
"=",
"[",
"]",
"for",
"fieldInfo",
"in",
"includedFields"... | 5922fafffdccc8812e72b3324965ad2f7d4bbdad |
valid | _generatePermEncoderStr | Generate the string that defines the permutations to apply for a given
encoder.
Parameters:
-----------------------------------------------------------------------
options: experiment params
encoderDict: the encoder dict, which gets placed into the description.py
For example, if the encoderDict contains:... | src/nupic/swarming/exp_generator/experiment_generator.py | def _generatePermEncoderStr(options, encoderDict):
""" Generate the string that defines the permutations to apply for a given
encoder.
Parameters:
-----------------------------------------------------------------------
options: experiment params
encoderDict: the encoder dict, which gets placed into the des... | def _generatePermEncoderStr(options, encoderDict):
""" Generate the string that defines the permutations to apply for a given
encoder.
Parameters:
-----------------------------------------------------------------------
options: experiment params
encoderDict: the encoder dict, which gets placed into the des... | [
"Generate",
"the",
"string",
"that",
"defines",
"the",
"permutations",
"to",
"apply",
"for",
"a",
"given",
"encoder",
"."
] | numenta/nupic | python | https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/swarming/exp_generator/experiment_generator.py#L624-L756 | [
"def",
"_generatePermEncoderStr",
"(",
"options",
",",
"encoderDict",
")",
":",
"permStr",
"=",
"\"\"",
"# If it's the encoder for the classifier input, then it's always present so",
"# put it in as a dict in the permutations.py file instead of a",
"# PermuteEncoder().",
"if",
"encoder... | 5922fafffdccc8812e72b3324965ad2f7d4bbdad |
valid | _generateEncoderStringsV2 | Generate and return the following encoder related substitution variables:
encoderSpecsStr:
For the base description file, this string defines the default
encoding dicts for each encoder. For example:
__gym_encoder = { 'fieldname': 'gym',
'n': 13,
'name': 'gym',
'type... | src/nupic/swarming/exp_generator/experiment_generator.py | def _generateEncoderStringsV2(includedFields, options):
""" Generate and return the following encoder related substitution variables:
encoderSpecsStr:
For the base description file, this string defines the default
encoding dicts for each encoder. For example:
__gym_encoder = { 'fieldname': 'gym... | def _generateEncoderStringsV2(includedFields, options):
""" Generate and return the following encoder related substitution variables:
encoderSpecsStr:
For the base description file, this string defines the default
encoding dicts for each encoder. For example:
__gym_encoder = { 'fieldname': 'gym... | [
"Generate",
"and",
"return",
"the",
"following",
"encoder",
"related",
"substitution",
"variables",
":"
] | numenta/nupic | python | https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/swarming/exp_generator/experiment_generator.py#L760-L977 | [
"def",
"_generateEncoderStringsV2",
"(",
"includedFields",
",",
"options",
")",
":",
"width",
"=",
"21",
"encoderDictsList",
"=",
"[",
"]",
"# If this is a NontemporalClassification experiment, then the",
"# the \"predicted\" field (the classification value) should be marked to ONLY... | 5922fafffdccc8812e72b3324965ad2f7d4bbdad |
valid | _handleJAVAParameters | Handle legacy options (TEMPORARY) | src/nupic/swarming/exp_generator/experiment_generator.py | def _handleJAVAParameters(options):
""" Handle legacy options (TEMPORARY) """
# Find the correct InferenceType for the Model
if 'inferenceType' not in options:
prediction = options.get('prediction', {InferenceType.TemporalNextStep:
{'optimize':True}})
inferen... | def _handleJAVAParameters(options):
""" Handle legacy options (TEMPORARY) """
# Find the correct InferenceType for the Model
if 'inferenceType' not in options:
prediction = options.get('prediction', {InferenceType.TemporalNextStep:
{'optimize':True}})
inferen... | [
"Handle",
"legacy",
"options",
"(",
"TEMPORARY",
")"
] | numenta/nupic | python | https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/swarming/exp_generator/experiment_generator.py#L981-L1006 | [
"def",
"_handleJAVAParameters",
"(",
"options",
")",
":",
"# Find the correct InferenceType for the Model",
"if",
"'inferenceType'",
"not",
"in",
"options",
":",
"prediction",
"=",
"options",
".",
"get",
"(",
"'prediction'",
",",
"{",
"InferenceType",
".",
"TemporalNe... | 5922fafffdccc8812e72b3324965ad2f7d4bbdad |
valid | _getPropertyValue | Checks to see if property is specified in 'options'. If not, reads the
default value from the schema | src/nupic/swarming/exp_generator/experiment_generator.py | def _getPropertyValue(schema, propertyName, options):
"""Checks to see if property is specified in 'options'. If not, reads the
default value from the schema"""
if propertyName not in options:
paramsSchema = schema['properties'][propertyName]
if 'default' in paramsSchema:
options[propertyName] = pa... | def _getPropertyValue(schema, propertyName, options):
"""Checks to see if property is specified in 'options'. If not, reads the
default value from the schema"""
if propertyName not in options:
paramsSchema = schema['properties'][propertyName]
if 'default' in paramsSchema:
options[propertyName] = pa... | [
"Checks",
"to",
"see",
"if",
"property",
"is",
"specified",
"in",
"options",
".",
"If",
"not",
"reads",
"the",
"default",
"value",
"from",
"the",
"schema"
] | numenta/nupic | python | https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/swarming/exp_generator/experiment_generator.py#L1010-L1019 | [
"def",
"_getPropertyValue",
"(",
"schema",
",",
"propertyName",
",",
"options",
")",
":",
"if",
"propertyName",
"not",
"in",
"options",
":",
"paramsSchema",
"=",
"schema",
"[",
"'properties'",
"]",
"[",
"propertyName",
"]",
"if",
"'default'",
"in",
"paramsSche... | 5922fafffdccc8812e72b3324965ad2f7d4bbdad |
valid | _getExperimentDescriptionSchema | Returns the experiment description schema. This implementation loads it in
from file experimentDescriptionSchema.json.
Parameters:
--------------------------------------------------------------------------
Returns: returns a dict representing the experiment description schema. | src/nupic/swarming/exp_generator/experiment_generator.py | def _getExperimentDescriptionSchema():
"""
Returns the experiment description schema. This implementation loads it in
from file experimentDescriptionSchema.json.
Parameters:
--------------------------------------------------------------------------
Returns: returns a dict representing the experiment des... | def _getExperimentDescriptionSchema():
"""
Returns the experiment description schema. This implementation loads it in
from file experimentDescriptionSchema.json.
Parameters:
--------------------------------------------------------------------------
Returns: returns a dict representing the experiment des... | [
"Returns",
"the",
"experiment",
"description",
"schema",
".",
"This",
"implementation",
"loads",
"it",
"in",
"from",
"file",
"experimentDescriptionSchema",
".",
"json",
"."
] | numenta/nupic | python | https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/swarming/exp_generator/experiment_generator.py#L1023-L1034 | [
"def",
"_getExperimentDescriptionSchema",
"(",
")",
":",
"installPath",
"=",
"os",
".",
"path",
".",
"dirname",
"(",
"os",
".",
"path",
".",
"abspath",
"(",
"__file__",
")",
")",
"schemaFilePath",
"=",
"os",
".",
"path",
".",
"join",
"(",
"installPath",
... | 5922fafffdccc8812e72b3324965ad2f7d4bbdad |
valid | _generateExperiment | Executes the --description option, which includes:
1. Perform provider compatibility checks
2. Preprocess the training and testing datasets (filter, join providers)
3. If test dataset omitted, split the training dataset into training
and testing datasets.
4. Gather statistics about the... | src/nupic/swarming/exp_generator/experiment_generator.py | def _generateExperiment(options, outputDirPath, hsVersion,
claDescriptionTemplateFile):
""" Executes the --description option, which includes:
1. Perform provider compatibility checks
2. Preprocess the training and testing datasets (filter, join providers)
3. If test da... | def _generateExperiment(options, outputDirPath, hsVersion,
claDescriptionTemplateFile):
""" Executes the --description option, which includes:
1. Perform provider compatibility checks
2. Preprocess the training and testing datasets (filter, join providers)
3. If test da... | [
"Executes",
"the",
"--",
"description",
"option",
"which",
"includes",
":"
] | numenta/nupic | python | https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/swarming/exp_generator/experiment_generator.py#L1038-L1615 | [
"def",
"_generateExperiment",
"(",
"options",
",",
"outputDirPath",
",",
"hsVersion",
",",
"claDescriptionTemplateFile",
")",
":",
"_gExperimentDescriptionSchema",
"=",
"_getExperimentDescriptionSchema",
"(",
")",
"# Validate JSON arg using JSON schema validator",
"try",
":",
... | 5922fafffdccc8812e72b3324965ad2f7d4bbdad |
valid | _generateMetricsSubstitutions | Generate the token substitution for metrics related fields.
This includes:
\$METRICS
\$LOGGED_METRICS
\$PERM_OPTIMIZE_SETTING | src/nupic/swarming/exp_generator/experiment_generator.py | def _generateMetricsSubstitutions(options, tokenReplacements):
"""Generate the token substitution for metrics related fields.
This includes:
\$METRICS
\$LOGGED_METRICS
\$PERM_OPTIMIZE_SETTING
"""
# -----------------------------------------------------------------------
#
options['loggedMetrics']... | def _generateMetricsSubstitutions(options, tokenReplacements):
"""Generate the token substitution for metrics related fields.
This includes:
\$METRICS
\$LOGGED_METRICS
\$PERM_OPTIMIZE_SETTING
"""
# -----------------------------------------------------------------------
#
options['loggedMetrics']... | [
"Generate",
"the",
"token",
"substitution",
"for",
"metrics",
"related",
"fields",
".",
"This",
"includes",
":",
"\\",
"$METRICS",
"\\",
"$LOGGED_METRICS",
"\\",
"$PERM_OPTIMIZE_SETTING"
] | numenta/nupic | python | https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/swarming/exp_generator/experiment_generator.py#L1619-L1649 | [
"def",
"_generateMetricsSubstitutions",
"(",
"options",
",",
"tokenReplacements",
")",
":",
"# -----------------------------------------------------------------------",
"#",
"options",
"[",
"'loggedMetrics'",
"]",
"=",
"[",
"\".*\"",
"]",
"# --------------------------------------... | 5922fafffdccc8812e72b3324965ad2f7d4bbdad |
valid | _generateMetricSpecs | Generates the Metrics for a given InferenceType
Parameters:
-------------------------------------------------------------------------
options: ExpGenerator options
retval: (metricsList, optimizeMetricLabel)
metricsList: list of metric string names
optimizeMetricLabel: Name of the metric... | src/nupic/swarming/exp_generator/experiment_generator.py | def _generateMetricSpecs(options):
""" Generates the Metrics for a given InferenceType
Parameters:
-------------------------------------------------------------------------
options: ExpGenerator options
retval: (metricsList, optimizeMetricLabel)
metricsList: list of metric string names
... | def _generateMetricSpecs(options):
""" Generates the Metrics for a given InferenceType
Parameters:
-------------------------------------------------------------------------
options: ExpGenerator options
retval: (metricsList, optimizeMetricLabel)
metricsList: list of metric string names
... | [
"Generates",
"the",
"Metrics",
"for",
"a",
"given",
"InferenceType"
] | numenta/nupic | python | https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/swarming/exp_generator/experiment_generator.py#L1653-L1855 | [
"def",
"_generateMetricSpecs",
"(",
"options",
")",
":",
"inferenceType",
"=",
"options",
"[",
"'inferenceType'",
"]",
"inferenceArgs",
"=",
"options",
"[",
"'inferenceArgs'",
"]",
"predictionSteps",
"=",
"inferenceArgs",
"[",
"'predictionSteps'",
"]",
"metricWindow",... | 5922fafffdccc8812e72b3324965ad2f7d4bbdad |
valid | _generateExtraMetricSpecs | Generates the non-default metrics specified by the expGenerator params | src/nupic/swarming/exp_generator/experiment_generator.py | def _generateExtraMetricSpecs(options):
"""Generates the non-default metrics specified by the expGenerator params """
_metricSpecSchema = {'properties': {}}
results = []
for metric in options['metrics']:
for propertyName in _metricSpecSchema['properties'].keys():
_getPropertyValue(_metricSpecSchema,... | def _generateExtraMetricSpecs(options):
"""Generates the non-default metrics specified by the expGenerator params """
_metricSpecSchema = {'properties': {}}
results = []
for metric in options['metrics']:
for propertyName in _metricSpecSchema['properties'].keys():
_getPropertyValue(_metricSpecSchema,... | [
"Generates",
"the",
"non",
"-",
"default",
"metrics",
"specified",
"by",
"the",
"expGenerator",
"params"
] | numenta/nupic | python | https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/swarming/exp_generator/experiment_generator.py#L1859-L1882 | [
"def",
"_generateExtraMetricSpecs",
"(",
"options",
")",
":",
"_metricSpecSchema",
"=",
"{",
"'properties'",
":",
"{",
"}",
"}",
"results",
"=",
"[",
"]",
"for",
"metric",
"in",
"options",
"[",
"'metrics'",
"]",
":",
"for",
"propertyName",
"in",
"_metricSpec... | 5922fafffdccc8812e72b3324965ad2f7d4bbdad |
valid | _getPredictedField | Gets the predicted field and it's datatype from the options dictionary
Returns: (predictedFieldName, predictedFieldType) | src/nupic/swarming/exp_generator/experiment_generator.py | def _getPredictedField(options):
""" Gets the predicted field and it's datatype from the options dictionary
Returns: (predictedFieldName, predictedFieldType)
"""
if not options['inferenceArgs'] or \
not options['inferenceArgs']['predictedField']:
return None, None
predictedField = options['inferen... | def _getPredictedField(options):
""" Gets the predicted field and it's datatype from the options dictionary
Returns: (predictedFieldName, predictedFieldType)
"""
if not options['inferenceArgs'] or \
not options['inferenceArgs']['predictedField']:
return None, None
predictedField = options['inferen... | [
"Gets",
"the",
"predicted",
"field",
"and",
"it",
"s",
"datatype",
"from",
"the",
"options",
"dictionary"
] | numenta/nupic | python | https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/swarming/exp_generator/experiment_generator.py#L1886-L1910 | [
"def",
"_getPredictedField",
"(",
"options",
")",
":",
"if",
"not",
"options",
"[",
"'inferenceArgs'",
"]",
"or",
"not",
"options",
"[",
"'inferenceArgs'",
"]",
"[",
"'predictedField'",
"]",
":",
"return",
"None",
",",
"None",
"predictedField",
"=",
"options",... | 5922fafffdccc8812e72b3324965ad2f7d4bbdad |
valid | _generateInferenceArgs | Generates the token substitutions related to the predicted field
and the supplemental arguments for prediction | src/nupic/swarming/exp_generator/experiment_generator.py | def _generateInferenceArgs(options, tokenReplacements):
""" Generates the token substitutions related to the predicted field
and the supplemental arguments for prediction
"""
inferenceType = options['inferenceType']
optionInferenceArgs = options.get('inferenceArgs', None)
resultInferenceArgs = {}
predicte... | def _generateInferenceArgs(options, tokenReplacements):
""" Generates the token substitutions related to the predicted field
and the supplemental arguments for prediction
"""
inferenceType = options['inferenceType']
optionInferenceArgs = options.get('inferenceArgs', None)
resultInferenceArgs = {}
predicte... | [
"Generates",
"the",
"token",
"substitutions",
"related",
"to",
"the",
"predicted",
"field",
"and",
"the",
"supplemental",
"arguments",
"for",
"prediction"
] | numenta/nupic | python | https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/swarming/exp_generator/experiment_generator.py#L1914-L1943 | [
"def",
"_generateInferenceArgs",
"(",
"options",
",",
"tokenReplacements",
")",
":",
"inferenceType",
"=",
"options",
"[",
"'inferenceType'",
"]",
"optionInferenceArgs",
"=",
"options",
".",
"get",
"(",
"'inferenceArgs'",
",",
"None",
")",
"resultInferenceArgs",
"="... | 5922fafffdccc8812e72b3324965ad2f7d4bbdad |
valid | expGenerator | Parses, validates, and executes command-line options;
On success: Performs requested operation and exits program normally
On Error: Dumps exception/error info in JSON format to stdout and exits the
program with non-zero status. | src/nupic/swarming/exp_generator/experiment_generator.py | def expGenerator(args):
""" Parses, validates, and executes command-line options;
On success: Performs requested operation and exits program normally
On Error: Dumps exception/error info in JSON format to stdout and exits the
program with non-zero status.
"""
# -----------------------------... | def expGenerator(args):
""" Parses, validates, and executes command-line options;
On success: Performs requested operation and exits program normally
On Error: Dumps exception/error info in JSON format to stdout and exits the
program with non-zero status.
"""
# -----------------------------... | [
"Parses",
"validates",
"and",
"executes",
"command",
"-",
"line",
"options",
";"
] | numenta/nupic | python | https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/swarming/exp_generator/experiment_generator.py#L1947-L2036 | [
"def",
"expGenerator",
"(",
"args",
")",
":",
"# -----------------------------------------------------------------",
"# Parse command line options",
"#",
"parser",
"=",
"OptionParser",
"(",
")",
"parser",
".",
"set_usage",
"(",
"\"%prog [options] --description='{json object with ... | 5922fafffdccc8812e72b3324965ad2f7d4bbdad |
valid | parseTimestamp | Parses a textual datetime format and return a Python datetime object.
The supported format is: ``yyyy-mm-dd h:m:s.ms``
The time component is optional.
- hours are 00..23 (no AM/PM)
- minutes are 00..59
- seconds are 00..59
- micro-seconds are 000000..999999
:param s: (string) input time text
:return... | src/nupic/data/utils.py | def parseTimestamp(s):
"""
Parses a textual datetime format and return a Python datetime object.
The supported format is: ``yyyy-mm-dd h:m:s.ms``
The time component is optional.
- hours are 00..23 (no AM/PM)
- minutes are 00..59
- seconds are 00..59
- micro-seconds are 000000..999999
:param s: (st... | def parseTimestamp(s):
"""
Parses a textual datetime format and return a Python datetime object.
The supported format is: ``yyyy-mm-dd h:m:s.ms``
The time component is optional.
- hours are 00..23 (no AM/PM)
- minutes are 00..59
- seconds are 00..59
- micro-seconds are 000000..999999
:param s: (st... | [
"Parses",
"a",
"textual",
"datetime",
"format",
"and",
"return",
"a",
"Python",
"datetime",
"object",
"."
] | numenta/nupic | python | https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/data/utils.py#L44-L67 | [
"def",
"parseTimestamp",
"(",
"s",
")",
":",
"s",
"=",
"s",
".",
"strip",
"(",
")",
"for",
"pattern",
"in",
"DATETIME_FORMATS",
":",
"try",
":",
"return",
"datetime",
".",
"datetime",
".",
"strptime",
"(",
"s",
",",
"pattern",
")",
"except",
"ValueErro... | 5922fafffdccc8812e72b3324965ad2f7d4bbdad |
valid | parseBool | String to boolean
:param s: (string)
:return: (bool) | src/nupic/data/utils.py | def parseBool(s):
"""
String to boolean
:param s: (string)
:return: (bool)
"""
l = s.lower()
if l in ("true", "t", "1"):
return True
if l in ("false", "f", "0"):
return False
raise Exception("Unable to convert string '%s' to a boolean value" % s) | def parseBool(s):
"""
String to boolean
:param s: (string)
:return: (bool)
"""
l = s.lower()
if l in ("true", "t", "1"):
return True
if l in ("false", "f", "0"):
return False
raise Exception("Unable to convert string '%s' to a boolean value" % s) | [
"String",
"to",
"boolean"
] | numenta/nupic | python | https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/data/utils.py#L95-L107 | [
"def",
"parseBool",
"(",
"s",
")",
":",
"l",
"=",
"s",
".",
"lower",
"(",
")",
"if",
"l",
"in",
"(",
"\"true\"",
",",
"\"t\"",
",",
"\"1\"",
")",
":",
"return",
"True",
"if",
"l",
"in",
"(",
"\"false\"",
",",
"\"f\"",
",",
"\"0\"",
")",
":",
... | 5922fafffdccc8812e72b3324965ad2f7d4bbdad |
valid | escape | Escape commas, tabs, newlines and dashes in a string
Commas are encoded as tabs.
:param s: (string) to escape
:returns: (string) escaped string | src/nupic/data/utils.py | def escape(s):
"""
Escape commas, tabs, newlines and dashes in a string
Commas are encoded as tabs.
:param s: (string) to escape
:returns: (string) escaped string
"""
if s is None:
return ''
assert isinstance(s, basestring), \
"expected %s but got %s; value=%s" % (basestring, type(s), s)
... | def escape(s):
"""
Escape commas, tabs, newlines and dashes in a string
Commas are encoded as tabs.
:param s: (string) to escape
:returns: (string) escaped string
"""
if s is None:
return ''
assert isinstance(s, basestring), \
"expected %s but got %s; value=%s" % (basestring, type(s), s)
... | [
"Escape",
"commas",
"tabs",
"newlines",
"and",
"dashes",
"in",
"a",
"string"
] | numenta/nupic | python | https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/data/utils.py#L137-L155 | [
"def",
"escape",
"(",
"s",
")",
":",
"if",
"s",
"is",
"None",
":",
"return",
"''",
"assert",
"isinstance",
"(",
"s",
",",
"basestring",
")",
",",
"\"expected %s but got %s; value=%s\"",
"%",
"(",
"basestring",
",",
"type",
"(",
"s",
")",
",",
"s",
")",... | 5922fafffdccc8812e72b3324965ad2f7d4bbdad |
valid | unescape | Unescapes a string that may contain commas, tabs, newlines and dashes
Commas are decoded from tabs.
:param s: (string) to unescape
:returns: (string) unescaped string | src/nupic/data/utils.py | def unescape(s):
"""
Unescapes a string that may contain commas, tabs, newlines and dashes
Commas are decoded from tabs.
:param s: (string) to unescape
:returns: (string) unescaped string
"""
assert isinstance(s, basestring)
s = s.replace('\t', ',')
s = s.replace('\\,', ',')
s = s.replace('\\n', '... | def unescape(s):
"""
Unescapes a string that may contain commas, tabs, newlines and dashes
Commas are decoded from tabs.
:param s: (string) to unescape
:returns: (string) unescaped string
"""
assert isinstance(s, basestring)
s = s.replace('\t', ',')
s = s.replace('\\,', ',')
s = s.replace('\\n', '... | [
"Unescapes",
"a",
"string",
"that",
"may",
"contain",
"commas",
"tabs",
"newlines",
"and",
"dashes"
] | numenta/nupic | python | https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/data/utils.py#L159-L174 | [
"def",
"unescape",
"(",
"s",
")",
":",
"assert",
"isinstance",
"(",
"s",
",",
"basestring",
")",
"s",
"=",
"s",
".",
"replace",
"(",
"'\\t'",
",",
"','",
")",
"s",
"=",
"s",
".",
"replace",
"(",
"'\\\\,'",
",",
"','",
")",
"s",
"=",
"s",
".",
... | 5922fafffdccc8812e72b3324965ad2f7d4bbdad |
valid | parseSdr | Parses a string containing only 0's and 1's and return a Python list object.
:param s: (string) string to parse
:returns: (list) SDR out | src/nupic/data/utils.py | def parseSdr(s):
"""
Parses a string containing only 0's and 1's and return a Python list object.
:param s: (string) string to parse
:returns: (list) SDR out
"""
assert isinstance(s, basestring)
sdr = [int(c) for c in s if c in ("0", "1")]
if len(sdr) != len(s):
raise ValueError("The provided strin... | def parseSdr(s):
"""
Parses a string containing only 0's and 1's and return a Python list object.
:param s: (string) string to parse
:returns: (list) SDR out
"""
assert isinstance(s, basestring)
sdr = [int(c) for c in s if c in ("0", "1")]
if len(sdr) != len(s):
raise ValueError("The provided strin... | [
"Parses",
"a",
"string",
"containing",
"only",
"0",
"s",
"and",
"1",
"s",
"and",
"return",
"a",
"Python",
"list",
"object",
"."
] | numenta/nupic | python | https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/data/utils.py#L178-L191 | [
"def",
"parseSdr",
"(",
"s",
")",
":",
"assert",
"isinstance",
"(",
"s",
",",
"basestring",
")",
"sdr",
"=",
"[",
"int",
"(",
"c",
")",
"for",
"c",
"in",
"s",
"if",
"c",
"in",
"(",
"\"0\"",
",",
"\"1\"",
")",
"]",
"if",
"len",
"(",
"sdr",
")"... | 5922fafffdccc8812e72b3324965ad2f7d4bbdad |
valid | parseStringList | Parse a string of space-separated numbers, returning a Python list.
:param s: (string) to parse
:returns: (list) binary SDR | src/nupic/data/utils.py | def parseStringList(s):
"""
Parse a string of space-separated numbers, returning a Python list.
:param s: (string) to parse
:returns: (list) binary SDR
"""
assert isinstance(s, basestring)
return [int(i) for i in s.split()] | def parseStringList(s):
"""
Parse a string of space-separated numbers, returning a Python list.
:param s: (string) to parse
:returns: (list) binary SDR
"""
assert isinstance(s, basestring)
return [int(i) for i in s.split()] | [
"Parse",
"a",
"string",
"of",
"space",
"-",
"separated",
"numbers",
"returning",
"a",
"Python",
"list",
"."
] | numenta/nupic | python | https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/data/utils.py#L207-L215 | [
"def",
"parseStringList",
"(",
"s",
")",
":",
"assert",
"isinstance",
"(",
"s",
",",
"basestring",
")",
"return",
"[",
"int",
"(",
"i",
")",
"for",
"i",
"in",
"s",
".",
"split",
"(",
")",
"]"
] | 5922fafffdccc8812e72b3324965ad2f7d4bbdad |
valid | coordinatesFromIndex | Translate an index into coordinates, using the given coordinate system.
Similar to ``numpy.unravel_index``.
:param index: (int) The index of the point. The coordinates are expressed as a
single index by using the dimensions as a mixed radix definition. For
example, in dimensions 42x10, the poi... | src/nupic/math/topology.py | def coordinatesFromIndex(index, dimensions):
"""
Translate an index into coordinates, using the given coordinate system.
Similar to ``numpy.unravel_index``.
:param index: (int) The index of the point. The coordinates are expressed as a
single index by using the dimensions as a mixed radix definition... | def coordinatesFromIndex(index, dimensions):
"""
Translate an index into coordinates, using the given coordinate system.
Similar to ``numpy.unravel_index``.
:param index: (int) The index of the point. The coordinates are expressed as a
single index by using the dimensions as a mixed radix definition... | [
"Translate",
"an",
"index",
"into",
"coordinates",
"using",
"the",
"given",
"coordinate",
"system",
"."
] | numenta/nupic | python | https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/math/topology.py#L30-L54 | [
"def",
"coordinatesFromIndex",
"(",
"index",
",",
"dimensions",
")",
":",
"coordinates",
"=",
"[",
"0",
"]",
"*",
"len",
"(",
"dimensions",
")",
"shifted",
"=",
"index",
"for",
"i",
"in",
"xrange",
"(",
"len",
"(",
"dimensions",
")",
"-",
"1",
",",
"... | 5922fafffdccc8812e72b3324965ad2f7d4bbdad |
valid | indexFromCoordinates | Translate coordinates into an index, using the given coordinate system.
Similar to ``numpy.ravel_multi_index``.
:param coordinates: (list of ints) A list of coordinates of length
``dimensions.size()``.
:param dimensions: (list of ints) The coordinate system.
:returns: (int) The index of the point.... | src/nupic/math/topology.py | def indexFromCoordinates(coordinates, dimensions):
"""
Translate coordinates into an index, using the given coordinate system.
Similar to ``numpy.ravel_multi_index``.
:param coordinates: (list of ints) A list of coordinates of length
``dimensions.size()``.
:param dimensions: (list of ints) The co... | def indexFromCoordinates(coordinates, dimensions):
"""
Translate coordinates into an index, using the given coordinate system.
Similar to ``numpy.ravel_multi_index``.
:param coordinates: (list of ints) A list of coordinates of length
``dimensions.size()``.
:param dimensions: (list of ints) The co... | [
"Translate",
"coordinates",
"into",
"an",
"index",
"using",
"the",
"given",
"coordinate",
"system",
"."
] | numenta/nupic | python | https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/math/topology.py#L57-L78 | [
"def",
"indexFromCoordinates",
"(",
"coordinates",
",",
"dimensions",
")",
":",
"index",
"=",
"0",
"for",
"i",
",",
"dimension",
"in",
"enumerate",
"(",
"dimensions",
")",
":",
"index",
"*=",
"dimension",
"index",
"+=",
"coordinates",
"[",
"i",
"]",
"retur... | 5922fafffdccc8812e72b3324965ad2f7d4bbdad |
valid | neighborhood | Get the points in the neighborhood of a point.
A point's neighborhood is the n-dimensional hypercube with sides ranging
[center - radius, center + radius], inclusive. For example, if there are two
dimensions and the radius is 3, the neighborhood is 6x6. Neighborhoods are
truncated when they are near an edge.
... | src/nupic/math/topology.py | def neighborhood(centerIndex, radius, dimensions):
"""
Get the points in the neighborhood of a point.
A point's neighborhood is the n-dimensional hypercube with sides ranging
[center - radius, center + radius], inclusive. For example, if there are two
dimensions and the radius is 3, the neighborhood is 6x6. ... | def neighborhood(centerIndex, radius, dimensions):
"""
Get the points in the neighborhood of a point.
A point's neighborhood is the n-dimensional hypercube with sides ranging
[center - radius, center + radius], inclusive. For example, if there are two
dimensions and the radius is 3, the neighborhood is 6x6. ... | [
"Get",
"the",
"points",
"in",
"the",
"neighborhood",
"of",
"a",
"point",
"."
] | numenta/nupic | python | https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/math/topology.py#L81-L119 | [
"def",
"neighborhood",
"(",
"centerIndex",
",",
"radius",
",",
"dimensions",
")",
":",
"centerPosition",
"=",
"coordinatesFromIndex",
"(",
"centerIndex",
",",
"dimensions",
")",
"intervals",
"=",
"[",
"]",
"for",
"i",
",",
"dimension",
"in",
"enumerate",
"(",
... | 5922fafffdccc8812e72b3324965ad2f7d4bbdad |
valid | CoordinateEncoder.encodeIntoArray | See `nupic.encoders.base.Encoder` for more information.
@param inputData (tuple) Contains coordinate (numpy.array, N-dimensional
integer coordinate) and radius (int)
@param output (numpy.array) Stores encoded SDR in this numpy array | src/nupic/encoders/coordinate.py | def encodeIntoArray(self, inputData, output):
"""
See `nupic.encoders.base.Encoder` for more information.
@param inputData (tuple) Contains coordinate (numpy.array, N-dimensional
integer coordinate) and radius (int)
@param output (numpy.array) Stores encoded SDR in this num... | def encodeIntoArray(self, inputData, output):
"""
See `nupic.encoders.base.Encoder` for more information.
@param inputData (tuple) Contains coordinate (numpy.array, N-dimensional
integer coordinate) and radius (int)
@param output (numpy.array) Stores encoded SDR in this num... | [
"See",
"nupic",
".",
"encoders",
".",
"base",
".",
"Encoder",
"for",
"more",
"information",
"."
] | numenta/nupic | python | https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/encoders/coordinate.py#L100-L120 | [
"def",
"encodeIntoArray",
"(",
"self",
",",
"inputData",
",",
"output",
")",
":",
"(",
"coordinate",
",",
"radius",
")",
"=",
"inputData",
"assert",
"isinstance",
"(",
"radius",
",",
"int",
")",
",",
"(",
"\"Expected integer radius, got: {} ({})\"",
".",
"form... | 5922fafffdccc8812e72b3324965ad2f7d4bbdad |
valid | CoordinateEncoder._neighbors | Returns coordinates around given coordinate, within given radius.
Includes given coordinate.
@param coordinate (numpy.array) N-dimensional integer coordinate
@param radius (int) Radius around `coordinate`
@return (numpy.array) List of coordinates | src/nupic/encoders/coordinate.py | def _neighbors(coordinate, radius):
"""
Returns coordinates around given coordinate, within given radius.
Includes given coordinate.
@param coordinate (numpy.array) N-dimensional integer coordinate
@param radius (int) Radius around `coordinate`
@return (numpy.array) List of coordinates
"""... | def _neighbors(coordinate, radius):
"""
Returns coordinates around given coordinate, within given radius.
Includes given coordinate.
@param coordinate (numpy.array) N-dimensional integer coordinate
@param radius (int) Radius around `coordinate`
@return (numpy.array) List of coordinates
"""... | [
"Returns",
"coordinates",
"around",
"given",
"coordinate",
"within",
"given",
"radius",
".",
"Includes",
"given",
"coordinate",
"."
] | numenta/nupic | python | https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/encoders/coordinate.py#L124-L135 | [
"def",
"_neighbors",
"(",
"coordinate",
",",
"radius",
")",
":",
"ranges",
"=",
"(",
"xrange",
"(",
"n",
"-",
"radius",
",",
"n",
"+",
"radius",
"+",
"1",
")",
"for",
"n",
"in",
"coordinate",
".",
"tolist",
"(",
")",
")",
"return",
"numpy",
".",
... | 5922fafffdccc8812e72b3324965ad2f7d4bbdad |
valid | CoordinateEncoder._topWCoordinates | Returns the top W coordinates by order.
@param coordinates (numpy.array) A 2D numpy array, where each element
is a coordinate
@param w (int) Number of top coordinates to return
@return (numpy.array) A subset of `coordinates`, containing only the
... | src/nupic/encoders/coordinate.py | def _topWCoordinates(cls, coordinates, w):
"""
Returns the top W coordinates by order.
@param coordinates (numpy.array) A 2D numpy array, where each element
is a coordinate
@param w (int) Number of top coordinates to return
@return (numpy.array) A subset of `coo... | def _topWCoordinates(cls, coordinates, w):
"""
Returns the top W coordinates by order.
@param coordinates (numpy.array) A 2D numpy array, where each element
is a coordinate
@param w (int) Number of top coordinates to return
@return (numpy.array) A subset of `coo... | [
"Returns",
"the",
"top",
"W",
"coordinates",
"by",
"order",
"."
] | numenta/nupic | python | https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/encoders/coordinate.py#L139-L152 | [
"def",
"_topWCoordinates",
"(",
"cls",
",",
"coordinates",
",",
"w",
")",
":",
"orders",
"=",
"numpy",
".",
"array",
"(",
"[",
"cls",
".",
"_orderForCoordinate",
"(",
"c",
")",
"for",
"c",
"in",
"coordinates",
".",
"tolist",
"(",
")",
"]",
")",
"indi... | 5922fafffdccc8812e72b3324965ad2f7d4bbdad |
valid | CoordinateEncoder._hashCoordinate | Hash a coordinate to a 64 bit integer. | src/nupic/encoders/coordinate.py | def _hashCoordinate(coordinate):
"""Hash a coordinate to a 64 bit integer."""
coordinateStr = ",".join(str(v) for v in coordinate)
# Compute the hash and convert to 64 bit int.
hash = int(int(hashlib.md5(coordinateStr).hexdigest(), 16) % (2 ** 64))
return hash | def _hashCoordinate(coordinate):
"""Hash a coordinate to a 64 bit integer."""
coordinateStr = ",".join(str(v) for v in coordinate)
# Compute the hash and convert to 64 bit int.
hash = int(int(hashlib.md5(coordinateStr).hexdigest(), 16) % (2 ** 64))
return hash | [
"Hash",
"a",
"coordinate",
"to",
"a",
"64",
"bit",
"integer",
"."
] | numenta/nupic | python | https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/encoders/coordinate.py#L156-L161 | [
"def",
"_hashCoordinate",
"(",
"coordinate",
")",
":",
"coordinateStr",
"=",
"\",\"",
".",
"join",
"(",
"str",
"(",
"v",
")",
"for",
"v",
"in",
"coordinate",
")",
"# Compute the hash and convert to 64 bit int.",
"hash",
"=",
"int",
"(",
"int",
"(",
"hashlib",
... | 5922fafffdccc8812e72b3324965ad2f7d4bbdad |
valid | CoordinateEncoder._orderForCoordinate | Returns the order for a coordinate.
@param coordinate (numpy.array) Coordinate
@return (float) A value in the interval [0, 1), representing the
order of the coordinate | src/nupic/encoders/coordinate.py | def _orderForCoordinate(cls, coordinate):
"""
Returns the order for a coordinate.
@param coordinate (numpy.array) Coordinate
@return (float) A value in the interval [0, 1), representing the
order of the coordinate
"""
seed = cls._hashCoordinate(coordinate)
rng = Random(s... | def _orderForCoordinate(cls, coordinate):
"""
Returns the order for a coordinate.
@param coordinate (numpy.array) Coordinate
@return (float) A value in the interval [0, 1), representing the
order of the coordinate
"""
seed = cls._hashCoordinate(coordinate)
rng = Random(s... | [
"Returns",
"the",
"order",
"for",
"a",
"coordinate",
"."
] | numenta/nupic | python | https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/encoders/coordinate.py#L165-L175 | [
"def",
"_orderForCoordinate",
"(",
"cls",
",",
"coordinate",
")",
":",
"seed",
"=",
"cls",
".",
"_hashCoordinate",
"(",
"coordinate",
")",
"rng",
"=",
"Random",
"(",
"seed",
")",
"return",
"rng",
".",
"getReal64",
"(",
")"
] | 5922fafffdccc8812e72b3324965ad2f7d4bbdad |
valid | CoordinateEncoder._bitForCoordinate | Maps the coordinate to a bit in the SDR.
@param coordinate (numpy.array) Coordinate
@param n (int) The number of available bits in the SDR
@return (int) The index to a bit in the SDR | src/nupic/encoders/coordinate.py | def _bitForCoordinate(cls, coordinate, n):
"""
Maps the coordinate to a bit in the SDR.
@param coordinate (numpy.array) Coordinate
@param n (int) The number of available bits in the SDR
@return (int) The index to a bit in the SDR
"""
seed = cls._hashCoordinate(coordinate)
rng = Random(s... | def _bitForCoordinate(cls, coordinate, n):
"""
Maps the coordinate to a bit in the SDR.
@param coordinate (numpy.array) Coordinate
@param n (int) The number of available bits in the SDR
@return (int) The index to a bit in the SDR
"""
seed = cls._hashCoordinate(coordinate)
rng = Random(s... | [
"Maps",
"the",
"coordinate",
"to",
"a",
"bit",
"in",
"the",
"SDR",
"."
] | numenta/nupic | python | https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/encoders/coordinate.py#L179-L189 | [
"def",
"_bitForCoordinate",
"(",
"cls",
",",
"coordinate",
",",
"n",
")",
":",
"seed",
"=",
"cls",
".",
"_hashCoordinate",
"(",
"coordinate",
")",
"rng",
"=",
"Random",
"(",
"seed",
")",
"return",
"rng",
".",
"getUInt32",
"(",
"n",
")"
] | 5922fafffdccc8812e72b3324965ad2f7d4bbdad |
valid | binSearch | Function for running binary search on a sorted list.
:param arr: (list) a sorted list of integers to search
:param val: (int) a integer to search for in the sorted array
:returns: (int) the index of the element if it is found and -1 otherwise. | src/nupic/algorithms/connections.py | def binSearch(arr, val):
"""
Function for running binary search on a sorted list.
:param arr: (list) a sorted list of integers to search
:param val: (int) a integer to search for in the sorted array
:returns: (int) the index of the element if it is found and -1 otherwise.
"""
i = bisect_left(arr, val)
... | def binSearch(arr, val):
"""
Function for running binary search on a sorted list.
:param arr: (list) a sorted list of integers to search
:param val: (int) a integer to search for in the sorted array
:returns: (int) the index of the element if it is found and -1 otherwise.
"""
i = bisect_left(arr, val)
... | [
"Function",
"for",
"running",
"binary",
"search",
"on",
"a",
"sorted",
"list",
"."
] | numenta/nupic | python | https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/algorithms/connections.py#L124-L135 | [
"def",
"binSearch",
"(",
"arr",
",",
"val",
")",
":",
"i",
"=",
"bisect_left",
"(",
"arr",
",",
"val",
")",
"if",
"i",
"!=",
"len",
"(",
"arr",
")",
"and",
"arr",
"[",
"i",
"]",
"==",
"val",
":",
"return",
"i",
"return",
"-",
"1"
] | 5922fafffdccc8812e72b3324965ad2f7d4bbdad |
valid | Connections.createSegment | Adds a new segment on a cell.
:param cell: (int) Cell index
:returns: (int) New segment index | src/nupic/algorithms/connections.py | def createSegment(self, cell):
"""
Adds a new segment on a cell.
:param cell: (int) Cell index
:returns: (int) New segment index
"""
cellData = self._cells[cell]
if len(self._freeFlatIdxs) > 0:
flatIdx = self._freeFlatIdxs.pop()
else:
flatIdx = self._nextFlatIdx
self... | def createSegment(self, cell):
"""
Adds a new segment on a cell.
:param cell: (int) Cell index
:returns: (int) New segment index
"""
cellData = self._cells[cell]
if len(self._freeFlatIdxs) > 0:
flatIdx = self._freeFlatIdxs.pop()
else:
flatIdx = self._nextFlatIdx
self... | [
"Adds",
"a",
"new",
"segment",
"on",
"a",
"cell",
"."
] | numenta/nupic | python | https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/algorithms/connections.py#L260-L283 | [
"def",
"createSegment",
"(",
"self",
",",
"cell",
")",
":",
"cellData",
"=",
"self",
".",
"_cells",
"[",
"cell",
"]",
"if",
"len",
"(",
"self",
".",
"_freeFlatIdxs",
")",
">",
"0",
":",
"flatIdx",
"=",
"self",
".",
"_freeFlatIdxs",
".",
"pop",
"(",
... | 5922fafffdccc8812e72b3324965ad2f7d4bbdad |
valid | Connections.destroySegment | Destroys a segment.
:param segment: (:class:`Segment`) representing the segment to be destroyed. | src/nupic/algorithms/connections.py | def destroySegment(self, segment):
"""
Destroys a segment.
:param segment: (:class:`Segment`) representing the segment to be destroyed.
"""
# Remove the synapses from all data structures outside this Segment.
for synapse in segment._synapses:
self._removeSynapseFromPresynapticMap(synapse)... | def destroySegment(self, segment):
"""
Destroys a segment.
:param segment: (:class:`Segment`) representing the segment to be destroyed.
"""
# Remove the synapses from all data structures outside this Segment.
for synapse in segment._synapses:
self._removeSynapseFromPresynapticMap(synapse)... | [
"Destroys",
"a",
"segment",
"."
] | numenta/nupic | python | https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/algorithms/connections.py#L286-L305 | [
"def",
"destroySegment",
"(",
"self",
",",
"segment",
")",
":",
"# Remove the synapses from all data structures outside this Segment.",
"for",
"synapse",
"in",
"segment",
".",
"_synapses",
":",
"self",
".",
"_removeSynapseFromPresynapticMap",
"(",
"synapse",
")",
"self",
... | 5922fafffdccc8812e72b3324965ad2f7d4bbdad |
valid | Connections.createSynapse | Creates a new synapse on a segment.
:param segment: (:class:`Segment`) Segment object for synapse to be synapsed
to.
:param presynapticCell: (int) Source cell index.
:param permanence: (float) Initial permanence of synapse.
:returns: (:class:`Synapse`) created synapse | src/nupic/algorithms/connections.py | def createSynapse(self, segment, presynapticCell, permanence):
"""
Creates a new synapse on a segment.
:param segment: (:class:`Segment`) Segment object for synapse to be synapsed
to.
:param presynapticCell: (int) Source cell index.
:param permanence: (float) Initial permanence of syna... | def createSynapse(self, segment, presynapticCell, permanence):
"""
Creates a new synapse on a segment.
:param segment: (:class:`Segment`) Segment object for synapse to be synapsed
to.
:param presynapticCell: (int) Source cell index.
:param permanence: (float) Initial permanence of syna... | [
"Creates",
"a",
"new",
"synapse",
"on",
"a",
"segment",
"."
] | numenta/nupic | python | https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/algorithms/connections.py#L308-L328 | [
"def",
"createSynapse",
"(",
"self",
",",
"segment",
",",
"presynapticCell",
",",
"permanence",
")",
":",
"idx",
"=",
"len",
"(",
"segment",
".",
"_synapses",
")",
"synapse",
"=",
"Synapse",
"(",
"segment",
",",
"presynapticCell",
",",
"permanence",
",",
"... | 5922fafffdccc8812e72b3324965ad2f7d4bbdad |
valid | Connections.destroySynapse | Destroys a synapse.
:param synapse: (:class:`Synapse`) synapse to destroy | src/nupic/algorithms/connections.py | def destroySynapse(self, synapse):
"""
Destroys a synapse.
:param synapse: (:class:`Synapse`) synapse to destroy
"""
self._numSynapses -= 1
self._removeSynapseFromPresynapticMap(synapse)
synapse.segment._synapses.remove(synapse) | def destroySynapse(self, synapse):
"""
Destroys a synapse.
:param synapse: (:class:`Synapse`) synapse to destroy
"""
self._numSynapses -= 1
self._removeSynapseFromPresynapticMap(synapse)
synapse.segment._synapses.remove(synapse) | [
"Destroys",
"a",
"synapse",
"."
] | numenta/nupic | python | https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/algorithms/connections.py#L340-L351 | [
"def",
"destroySynapse",
"(",
"self",
",",
"synapse",
")",
":",
"self",
".",
"_numSynapses",
"-=",
"1",
"self",
".",
"_removeSynapseFromPresynapticMap",
"(",
"synapse",
")",
"synapse",
".",
"segment",
".",
"_synapses",
".",
"remove",
"(",
"synapse",
")"
] | 5922fafffdccc8812e72b3324965ad2f7d4bbdad |
valid | Connections.computeActivity | Compute each segment's number of active synapses for a given input.
In the returned lists, a segment's active synapse count is stored at index
``segment.flatIdx``.
:param activePresynapticCells: (iter) Active cells.
:param connectedPermanence: (float) Permanence threshold for a synapse to be
... | src/nupic/algorithms/connections.py | def computeActivity(self, activePresynapticCells, connectedPermanence):
"""
Compute each segment's number of active synapses for a given input.
In the returned lists, a segment's active synapse count is stored at index
``segment.flatIdx``.
:param activePresynapticCells: (iter) Active cells.
:p... | def computeActivity(self, activePresynapticCells, connectedPermanence):
"""
Compute each segment's number of active synapses for a given input.
In the returned lists, a segment's active synapse count is stored at index
``segment.flatIdx``.
:param activePresynapticCells: (iter) Active cells.
:p... | [
"Compute",
"each",
"segment",
"s",
"number",
"of",
"active",
"synapses",
"for",
"a",
"given",
"input",
".",
"In",
"the",
"returned",
"lists",
"a",
"segment",
"s",
"active",
"synapse",
"count",
"is",
"stored",
"at",
"index",
"segment",
".",
"flatIdx",
"."
] | numenta/nupic | python | https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/algorithms/connections.py#L365-L392 | [
"def",
"computeActivity",
"(",
"self",
",",
"activePresynapticCells",
",",
"connectedPermanence",
")",
":",
"numActiveConnectedSynapsesForSegment",
"=",
"[",
"0",
"]",
"*",
"self",
".",
"_nextFlatIdx",
"numActivePotentialSynapsesForSegment",
"=",
"[",
"0",
"]",
"*",
... | 5922fafffdccc8812e72b3324965ad2f7d4bbdad |
valid | Connections.numSegments | Returns the number of segments.
:param cell: (int) Optional parameter to get the number of segments on a
cell.
:returns: (int) Number of segments on all cells if cell is not specified, or
on a specific specified cell | src/nupic/algorithms/connections.py | def numSegments(self, cell=None):
"""
Returns the number of segments.
:param cell: (int) Optional parameter to get the number of segments on a
cell.
:returns: (int) Number of segments on all cells if cell is not specified, or
on a specific specified cell
"""
if cell ... | def numSegments(self, cell=None):
"""
Returns the number of segments.
:param cell: (int) Optional parameter to get the number of segments on a
cell.
:returns: (int) Number of segments on all cells if cell is not specified, or
on a specific specified cell
"""
if cell ... | [
"Returns",
"the",
"number",
"of",
"segments",
"."
] | numenta/nupic | python | https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/algorithms/connections.py#L395-L407 | [
"def",
"numSegments",
"(",
"self",
",",
"cell",
"=",
"None",
")",
":",
"if",
"cell",
"is",
"not",
"None",
":",
"return",
"len",
"(",
"self",
".",
"_cells",
"[",
"cell",
"]",
".",
"_segments",
")",
"return",
"self",
".",
"_nextFlatIdx",
"-",
"len",
... | 5922fafffdccc8812e72b3324965ad2f7d4bbdad |
valid | Connections.segmentPositionSortKey | Return a numeric key for sorting this segment. This can be used with the
python built-in ``sorted()`` function.
:param segment: (:class:`Segment`) within this :class:`Connections`
instance.
:returns: (float) A numeric key for sorting. | src/nupic/algorithms/connections.py | def segmentPositionSortKey(self, segment):
"""
Return a numeric key for sorting this segment. This can be used with the
python built-in ``sorted()`` function.
:param segment: (:class:`Segment`) within this :class:`Connections`
instance.
:returns: (float) A numeric key for sorting.
... | def segmentPositionSortKey(self, segment):
"""
Return a numeric key for sorting this segment. This can be used with the
python built-in ``sorted()`` function.
:param segment: (:class:`Segment`) within this :class:`Connections`
instance.
:returns: (float) A numeric key for sorting.
... | [
"Return",
"a",
"numeric",
"key",
"for",
"sorting",
"this",
"segment",
".",
"This",
"can",
"be",
"used",
"with",
"the",
"python",
"built",
"-",
"in",
"sorted",
"()",
"function",
"."
] | numenta/nupic | python | https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/algorithms/connections.py#L425-L434 | [
"def",
"segmentPositionSortKey",
"(",
"self",
",",
"segment",
")",
":",
"return",
"segment",
".",
"cell",
"+",
"(",
"segment",
".",
"_ordinal",
"/",
"float",
"(",
"self",
".",
"_nextSegmentOrdinal",
")",
")"
] | 5922fafffdccc8812e72b3324965ad2f7d4bbdad |
valid | Connections.write | Writes serialized data to proto object.
:param proto: (DynamicStructBuilder) Proto object | src/nupic/algorithms/connections.py | def write(self, proto):
"""
Writes serialized data to proto object.
:param proto: (DynamicStructBuilder) Proto object
"""
protoCells = proto.init('cells', self.numCells)
for i in xrange(self.numCells):
segments = self._cells[i]._segments
protoSegments = protoCells[i].init('segment... | def write(self, proto):
"""
Writes serialized data to proto object.
:param proto: (DynamicStructBuilder) Proto object
"""
protoCells = proto.init('cells', self.numCells)
for i in xrange(self.numCells):
segments = self._cells[i]._segments
protoSegments = protoCells[i].init('segment... | [
"Writes",
"serialized",
"data",
"to",
"proto",
"object",
"."
] | numenta/nupic | python | https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/algorithms/connections.py#L437-L455 | [
"def",
"write",
"(",
"self",
",",
"proto",
")",
":",
"protoCells",
"=",
"proto",
".",
"init",
"(",
"'cells'",
",",
"self",
".",
"numCells",
")",
"for",
"i",
"in",
"xrange",
"(",
"self",
".",
"numCells",
")",
":",
"segments",
"=",
"self",
".",
"_cel... | 5922fafffdccc8812e72b3324965ad2f7d4bbdad |
valid | Connections.read | Reads deserialized data from proto object
:param proto: (DynamicStructBuilder) Proto object
:returns: (:class:`Connections`) instance | src/nupic/algorithms/connections.py | def read(cls, proto):
"""
Reads deserialized data from proto object
:param proto: (DynamicStructBuilder) Proto object
:returns: (:class:`Connections`) instance
"""
#pylint: disable=W0212
protoCells = proto.cells
connections = cls(len(protoCells))
for cellIdx, protoCell in enumera... | def read(cls, proto):
"""
Reads deserialized data from proto object
:param proto: (DynamicStructBuilder) Proto object
:returns: (:class:`Connections`) instance
"""
#pylint: disable=W0212
protoCells = proto.cells
connections = cls(len(protoCells))
for cellIdx, protoCell in enumera... | [
"Reads",
"deserialized",
"data",
"from",
"proto",
"object"
] | numenta/nupic | python | https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/algorithms/connections.py#L464-L505 | [
"def",
"read",
"(",
"cls",
",",
"proto",
")",
":",
"#pylint: disable=W0212",
"protoCells",
"=",
"proto",
".",
"cells",
"connections",
"=",
"cls",
"(",
"len",
"(",
"protoCells",
")",
")",
"for",
"cellIdx",
",",
"protoCell",
"in",
"enumerate",
"(",
"protoCel... | 5922fafffdccc8812e72b3324965ad2f7d4bbdad |
valid | Configuration.getString | Retrieve the requested property as a string. If property does not exist,
then KeyError will be raised.
:param prop: (string) name of the property
:raises: KeyError
:returns: (string) property value | src/nupic/support/configuration_base.py | def getString(cls, prop):
""" Retrieve the requested property as a string. If property does not exist,
then KeyError will be raised.
:param prop: (string) name of the property
:raises: KeyError
:returns: (string) property value
"""
if cls._properties is None:
cls._readStdConfigFiles()... | def getString(cls, prop):
""" Retrieve the requested property as a string. If property does not exist,
then KeyError will be raised.
:param prop: (string) name of the property
:raises: KeyError
:returns: (string) property value
"""
if cls._properties is None:
cls._readStdConfigFiles()... | [
"Retrieve",
"the",
"requested",
"property",
"as",
"a",
"string",
".",
"If",
"property",
"does",
"not",
"exist",
"then",
"KeyError",
"will",
"be",
"raised",
"."
] | numenta/nupic | python | https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/support/configuration_base.py#L75-L92 | [
"def",
"getString",
"(",
"cls",
",",
"prop",
")",
":",
"if",
"cls",
".",
"_properties",
"is",
"None",
":",
"cls",
".",
"_readStdConfigFiles",
"(",
")",
"# Allow configuration properties to be overridden via environment variables",
"envValue",
"=",
"os",
".",
"enviro... | 5922fafffdccc8812e72b3324965ad2f7d4bbdad |
valid | Configuration.getBool | Retrieve the requested property and return it as a bool. If property
does not exist, then KeyError will be raised. If the property value is
neither 0 nor 1, then ValueError will be raised
:param prop: (string) name of the property
:raises: KeyError, ValueError
:returns: (bool) property value | src/nupic/support/configuration_base.py | def getBool(cls, prop):
""" Retrieve the requested property and return it as a bool. If property
does not exist, then KeyError will be raised. If the property value is
neither 0 nor 1, then ValueError will be raised
:param prop: (string) name of the property
:raises: KeyError, ValueError
:retur... | def getBool(cls, prop):
""" Retrieve the requested property and return it as a bool. If property
does not exist, then KeyError will be raised. If the property value is
neither 0 nor 1, then ValueError will be raised
:param prop: (string) name of the property
:raises: KeyError, ValueError
:retur... | [
"Retrieve",
"the",
"requested",
"property",
"and",
"return",
"it",
"as",
"a",
"bool",
".",
"If",
"property",
"does",
"not",
"exist",
"then",
"KeyError",
"will",
"be",
"raised",
".",
"If",
"the",
"property",
"value",
"is",
"neither",
"0",
"nor",
"1",
"the... | numenta/nupic | python | https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/support/configuration_base.py#L96-L112 | [
"def",
"getBool",
"(",
"cls",
",",
"prop",
")",
":",
"value",
"=",
"cls",
".",
"getInt",
"(",
"prop",
")",
"if",
"value",
"not",
"in",
"(",
"0",
",",
"1",
")",
":",
"raise",
"ValueError",
"(",
"\"Expected 0 or 1, but got %r in config property %s\"",
"%",
... | 5922fafffdccc8812e72b3324965ad2f7d4bbdad |
valid | Configuration.set | Set the value of the given configuration property.
:param prop: (string) name of the property
:param value: (object) value to set | src/nupic/support/configuration_base.py | def set(cls, prop, value):
""" Set the value of the given configuration property.
:param prop: (string) name of the property
:param value: (object) value to set
"""
if cls._properties is None:
cls._readStdConfigFiles()
cls._properties[prop] = str(value) | def set(cls, prop, value):
""" Set the value of the given configuration property.
:param prop: (string) name of the property
:param value: (object) value to set
"""
if cls._properties is None:
cls._readStdConfigFiles()
cls._properties[prop] = str(value) | [
"Set",
"the",
"value",
"of",
"the",
"given",
"configuration",
"property",
"."
] | numenta/nupic | python | https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/support/configuration_base.py#L163-L173 | [
"def",
"set",
"(",
"cls",
",",
"prop",
",",
"value",
")",
":",
"if",
"cls",
".",
"_properties",
"is",
"None",
":",
"cls",
".",
"_readStdConfigFiles",
"(",
")",
"cls",
".",
"_properties",
"[",
"prop",
"]",
"=",
"str",
"(",
"value",
")"
] | 5922fafffdccc8812e72b3324965ad2f7d4bbdad |
valid | Configuration.dict | Return a dict containing all of the configuration properties
:returns: (dict) containing all configuration properties. | src/nupic/support/configuration_base.py | def dict(cls):
""" Return a dict containing all of the configuration properties
:returns: (dict) containing all configuration properties.
"""
if cls._properties is None:
cls._readStdConfigFiles()
# Make a copy so we can update any current values obtained from environment
# variables
... | def dict(cls):
""" Return a dict containing all of the configuration properties
:returns: (dict) containing all configuration properties.
"""
if cls._properties is None:
cls._readStdConfigFiles()
# Make a copy so we can update any current values obtained from environment
# variables
... | [
"Return",
"a",
"dict",
"containing",
"all",
"of",
"the",
"configuration",
"properties"
] | numenta/nupic | python | https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/support/configuration_base.py#L177-L197 | [
"def",
"dict",
"(",
"cls",
")",
":",
"if",
"cls",
".",
"_properties",
"is",
"None",
":",
"cls",
".",
"_readStdConfigFiles",
"(",
")",
"# Make a copy so we can update any current values obtained from environment",
"# variables",
"result",
"=",
"dict",
"(",
"cls",
".... | 5922fafffdccc8812e72b3324965ad2f7d4bbdad |
valid | Configuration.readConfigFile | Parse the given XML file and store all properties it describes.
:param filename: (string) name of XML file to parse (no path)
:param path: (string) path of the XML file. If None, then use the standard
configuration search path. | src/nupic/support/configuration_base.py | def readConfigFile(cls, filename, path=None):
""" Parse the given XML file and store all properties it describes.
:param filename: (string) name of XML file to parse (no path)
:param path: (string) path of the XML file. If None, then use the standard
configuration search path.
"""
... | def readConfigFile(cls, filename, path=None):
""" Parse the given XML file and store all properties it describes.
:param filename: (string) name of XML file to parse (no path)
:param path: (string) path of the XML file. If None, then use the standard
configuration search path.
"""
... | [
"Parse",
"the",
"given",
"XML",
"file",
"and",
"store",
"all",
"properties",
"it",
"describes",
"."
] | numenta/nupic | python | https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/support/configuration_base.py#L201-L216 | [
"def",
"readConfigFile",
"(",
"cls",
",",
"filename",
",",
"path",
"=",
"None",
")",
":",
"properties",
"=",
"cls",
".",
"_readConfigFile",
"(",
"filename",
",",
"path",
")",
"# Create properties dict if necessary",
"if",
"cls",
".",
"_properties",
"is",
"None... | 5922fafffdccc8812e72b3324965ad2f7d4bbdad |
valid | Configuration.findConfigFile | Search the configuration path (specified via the NTA_CONF_PATH
environment variable) for the given filename. If found, return the complete
path to the file.
:param filename: (string) name of file to locate | src/nupic/support/configuration_base.py | def findConfigFile(cls, filename):
""" Search the configuration path (specified via the NTA_CONF_PATH
environment variable) for the given filename. If found, return the complete
path to the file.
:param filename: (string) name of file to locate
"""
paths = cls.getConfigPaths()
for p in pat... | def findConfigFile(cls, filename):
""" Search the configuration path (specified via the NTA_CONF_PATH
environment variable) for the given filename. If found, return the complete
path to the file.
:param filename: (string) name of file to locate
"""
paths = cls.getConfigPaths()
for p in pat... | [
"Search",
"the",
"configuration",
"path",
"(",
"specified",
"via",
"the",
"NTA_CONF_PATH",
"environment",
"variable",
")",
"for",
"the",
"given",
"filename",
".",
"If",
"found",
"return",
"the",
"complete",
"path",
"to",
"the",
"file",
"."
] | numenta/nupic | python | https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/support/configuration_base.py#L359-L371 | [
"def",
"findConfigFile",
"(",
"cls",
",",
"filename",
")",
":",
"paths",
"=",
"cls",
".",
"getConfigPaths",
"(",
")",
"for",
"p",
"in",
"paths",
":",
"testPath",
"=",
"os",
".",
"path",
".",
"join",
"(",
"p",
",",
"filename",
")",
"if",
"os",
".",
... | 5922fafffdccc8812e72b3324965ad2f7d4bbdad |
valid | Configuration.getConfigPaths | Return the list of paths to search for configuration files.
:returns: (list) of paths | src/nupic/support/configuration_base.py | def getConfigPaths(cls):
""" Return the list of paths to search for configuration files.
:returns: (list) of paths
"""
configPaths = []
if cls._configPaths is not None:
return cls._configPaths
else:
if 'NTA_CONF_PATH' in os.environ:
configVar = os.environ['NTA_CONF_PATH']
... | def getConfigPaths(cls):
""" Return the list of paths to search for configuration files.
:returns: (list) of paths
"""
configPaths = []
if cls._configPaths is not None:
return cls._configPaths
else:
if 'NTA_CONF_PATH' in os.environ:
configVar = os.environ['NTA_CONF_PATH']
... | [
"Return",
"the",
"list",
"of",
"paths",
"to",
"search",
"for",
"configuration",
"files",
"."
] | numenta/nupic | python | https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/support/configuration_base.py#L375-L390 | [
"def",
"getConfigPaths",
"(",
"cls",
")",
":",
"configPaths",
"=",
"[",
"]",
"if",
"cls",
".",
"_configPaths",
"is",
"not",
"None",
":",
"return",
"cls",
".",
"_configPaths",
"else",
":",
"if",
"'NTA_CONF_PATH'",
"in",
"os",
".",
"environ",
":",
"configV... | 5922fafffdccc8812e72b3324965ad2f7d4bbdad |
valid | addNoise | Add noise to the given input.
Parameters:
-----------------------------------------------
input: the input to add noise to
noise: how much noise to add
doForeground: If true, turn off some of the 1 bits in the input
doBackground: If true, turn on some of the 0 bits in the input | src/nupic/algorithms/fdrutilities.py | def addNoise(input, noise=0.1, doForeground=True, doBackground=True):
"""
Add noise to the given input.
Parameters:
-----------------------------------------------
input: the input to add noise to
noise: how much noise to add
doForeground: If true, turn off some of the 1 bits in the inpu... | def addNoise(input, noise=0.1, doForeground=True, doBackground=True):
"""
Add noise to the given input.
Parameters:
-----------------------------------------------
input: the input to add noise to
noise: how much noise to add
doForeground: If true, turn off some of the 1 bits in the inpu... | [
"Add",
"noise",
"to",
"the",
"given",
"input",
"."
] | numenta/nupic | python | https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/algorithms/fdrutilities.py#L42-L61 | [
"def",
"addNoise",
"(",
"input",
",",
"noise",
"=",
"0.1",
",",
"doForeground",
"=",
"True",
",",
"doBackground",
"=",
"True",
")",
":",
"if",
"doForeground",
"and",
"doBackground",
":",
"return",
"numpy",
".",
"abs",
"(",
"input",
"-",
"(",
"numpy",
"... | 5922fafffdccc8812e72b3324965ad2f7d4bbdad |
valid | generateCoincMatrix | Generate a coincidence matrix. This is used to generate random inputs to the
temporal learner and to compare the predicted output against.
It generates a matrix of nCoinc rows, each row has length 'length' and has
a total of 'activity' bits on.
Parameters:
-----------------------------------------------
n... | src/nupic/algorithms/fdrutilities.py | def generateCoincMatrix(nCoinc=10, length=500, activity=50):
"""
Generate a coincidence matrix. This is used to generate random inputs to the
temporal learner and to compare the predicted output against.
It generates a matrix of nCoinc rows, each row has length 'length' and has
a total of 'activity' bits on.... | def generateCoincMatrix(nCoinc=10, length=500, activity=50):
"""
Generate a coincidence matrix. This is used to generate random inputs to the
temporal learner and to compare the predicted output against.
It generates a matrix of nCoinc rows, each row has length 'length' and has
a total of 'activity' bits on.... | [
"Generate",
"a",
"coincidence",
"matrix",
".",
"This",
"is",
"used",
"to",
"generate",
"random",
"inputs",
"to",
"the",
"temporal",
"learner",
"and",
"to",
"compare",
"the",
"predicted",
"output",
"against",
"."
] | numenta/nupic | python | https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/algorithms/fdrutilities.py#L65-L94 | [
"def",
"generateCoincMatrix",
"(",
"nCoinc",
"=",
"10",
",",
"length",
"=",
"500",
",",
"activity",
"=",
"50",
")",
":",
"coincMatrix0",
"=",
"SM32",
"(",
"int",
"(",
"nCoinc",
")",
",",
"int",
"(",
"length",
")",
")",
"theOnes",
"=",
"numpy",
".",
... | 5922fafffdccc8812e72b3324965ad2f7d4bbdad |
valid | generateVectors | Generate a list of random sparse distributed vectors. This is used to generate
training vectors to the spatial or temporal learner and to compare the predicted
output against.
It generates a list of 'numVectors' elements, each element has length 'length'
and has a total of 'activity' bits on.
Parameters:
... | src/nupic/algorithms/fdrutilities.py | def generateVectors(numVectors=100, length=500, activity=50):
"""
Generate a list of random sparse distributed vectors. This is used to generate
training vectors to the spatial or temporal learner and to compare the predicted
output against.
It generates a list of 'numVectors' elements, each element has len... | def generateVectors(numVectors=100, length=500, activity=50):
"""
Generate a list of random sparse distributed vectors. This is used to generate
training vectors to the spatial or temporal learner and to compare the predicted
output against.
It generates a list of 'numVectors' elements, each element has len... | [
"Generate",
"a",
"list",
"of",
"random",
"sparse",
"distributed",
"vectors",
".",
"This",
"is",
"used",
"to",
"generate",
"training",
"vectors",
"to",
"the",
"spatial",
"or",
"temporal",
"learner",
"and",
"to",
"compare",
"the",
"predicted",
"output",
"against... | numenta/nupic | python | https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/algorithms/fdrutilities.py#L98-L124 | [
"def",
"generateVectors",
"(",
"numVectors",
"=",
"100",
",",
"length",
"=",
"500",
",",
"activity",
"=",
"50",
")",
":",
"vectors",
"=",
"[",
"]",
"coinc",
"=",
"numpy",
".",
"zeros",
"(",
"length",
",",
"dtype",
"=",
"'int32'",
")",
"indexList",
"=... | 5922fafffdccc8812e72b3324965ad2f7d4bbdad |
valid | generateSimpleSequences | Generate a set of simple sequences. The elements of the sequences will be
integers from 0 to 'nCoinc'-1. The length of each sequence will be
randomly chosen from the 'seqLength' list.
Parameters:
-----------------------------------------------
nCoinc: the number of elements available to use in the seque... | src/nupic/algorithms/fdrutilities.py | def generateSimpleSequences(nCoinc=10, seqLength=[5,6,7], nSeq=100):
"""
Generate a set of simple sequences. The elements of the sequences will be
integers from 0 to 'nCoinc'-1. The length of each sequence will be
randomly chosen from the 'seqLength' list.
Parameters:
--------------------------------------... | def generateSimpleSequences(nCoinc=10, seqLength=[5,6,7], nSeq=100):
"""
Generate a set of simple sequences. The elements of the sequences will be
integers from 0 to 'nCoinc'-1. The length of each sequence will be
randomly chosen from the 'seqLength' list.
Parameters:
--------------------------------------... | [
"Generate",
"a",
"set",
"of",
"simple",
"sequences",
".",
"The",
"elements",
"of",
"the",
"sequences",
"will",
"be",
"integers",
"from",
"0",
"to",
"nCoinc",
"-",
"1",
".",
"The",
"length",
"of",
"each",
"sequence",
"will",
"be",
"randomly",
"chosen",
"f... | numenta/nupic | python | https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/algorithms/fdrutilities.py#L128-L158 | [
"def",
"generateSimpleSequences",
"(",
"nCoinc",
"=",
"10",
",",
"seqLength",
"=",
"[",
"5",
",",
"6",
",",
"7",
"]",
",",
"nSeq",
"=",
"100",
")",
":",
"coincList",
"=",
"range",
"(",
"nCoinc",
")",
"seqList",
"=",
"[",
"]",
"for",
"i",
"in",
"x... | 5922fafffdccc8812e72b3324965ad2f7d4bbdad |
valid | generateHubSequences | Generate a set of hub sequences. These are sequences which contain a hub
element in the middle. The elements of the sequences will be integers
from 0 to 'nCoinc'-1. The hub elements will only appear in the middle of
each sequence. The length of each sequence will be randomly chosen from the
'seqLength' list.
... | src/nupic/algorithms/fdrutilities.py | def generateHubSequences(nCoinc=10, hubs = [2,6], seqLength=[5,6,7], nSeq=100):
"""
Generate a set of hub sequences. These are sequences which contain a hub
element in the middle. The elements of the sequences will be integers
from 0 to 'nCoinc'-1. The hub elements will only appear in the middle of
each seque... | def generateHubSequences(nCoinc=10, hubs = [2,6], seqLength=[5,6,7], nSeq=100):
"""
Generate a set of hub sequences. These are sequences which contain a hub
element in the middle. The elements of the sequences will be integers
from 0 to 'nCoinc'-1. The hub elements will only appear in the middle of
each seque... | [
"Generate",
"a",
"set",
"of",
"hub",
"sequences",
".",
"These",
"are",
"sequences",
"which",
"contain",
"a",
"hub",
"element",
"in",
"the",
"middle",
".",
"The",
"elements",
"of",
"the",
"sequences",
"will",
"be",
"integers",
"from",
"0",
"to",
"nCoinc",
... | numenta/nupic | python | https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/algorithms/fdrutilities.py#L162-L194 | [
"def",
"generateHubSequences",
"(",
"nCoinc",
"=",
"10",
",",
"hubs",
"=",
"[",
"2",
",",
"6",
"]",
",",
"seqLength",
"=",
"[",
"5",
",",
"6",
",",
"7",
"]",
",",
"nSeq",
"=",
"100",
")",
":",
"coincList",
"=",
"range",
"(",
"nCoinc",
")",
"for... | 5922fafffdccc8812e72b3324965ad2f7d4bbdad |
valid | generateSimpleCoincMatrix | Generate a non overlapping coincidence matrix. This is used to generate random
inputs to the temporal learner and to compare the predicted output against.
It generates a matrix of nCoinc rows, each row has length 'length' and has
a total of 'activity' bits on.
Parameters:
-----------------------------------... | src/nupic/algorithms/fdrutilities.py | def generateSimpleCoincMatrix(nCoinc=10, length=500, activity=50):
"""
Generate a non overlapping coincidence matrix. This is used to generate random
inputs to the temporal learner and to compare the predicted output against.
It generates a matrix of nCoinc rows, each row has length 'length' and has
a total ... | def generateSimpleCoincMatrix(nCoinc=10, length=500, activity=50):
"""
Generate a non overlapping coincidence matrix. This is used to generate random
inputs to the temporal learner and to compare the predicted output against.
It generates a matrix of nCoinc rows, each row has length 'length' and has
a total ... | [
"Generate",
"a",
"non",
"overlapping",
"coincidence",
"matrix",
".",
"This",
"is",
"used",
"to",
"generate",
"random",
"inputs",
"to",
"the",
"temporal",
"learner",
"and",
"to",
"compare",
"the",
"predicted",
"output",
"against",
"."
] | numenta/nupic | python | https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/algorithms/fdrutilities.py#L250-L274 | [
"def",
"generateSimpleCoincMatrix",
"(",
"nCoinc",
"=",
"10",
",",
"length",
"=",
"500",
",",
"activity",
"=",
"50",
")",
":",
"assert",
"nCoinc",
"*",
"activity",
"<=",
"length",
",",
"\"can't generate non-overlapping coincidences\"",
"coincMatrix",
"=",
"SM32",
... | 5922fafffdccc8812e72b3324965ad2f7d4bbdad |
valid | generateSequences | Generate a set of simple and hub sequences. A simple sequence contains
a randomly chosen set of elements from 0 to 'nCoinc-1'. A hub sequence
always contains a hub element in the middle of it.
Parameters:
-----------------------------------------------
nPatterns: the number of patterns to use in the s... | src/nupic/algorithms/fdrutilities.py | def generateSequences(nPatterns=10, patternLen=500, patternActivity=50,
hubs=[2,6], seqLength=[5,6,7],
nSimpleSequences=50, nHubSequences=50):
"""
Generate a set of simple and hub sequences. A simple sequence contains
a randomly chosen set of elements from 0 to 'nCoinc-1'... | def generateSequences(nPatterns=10, patternLen=500, patternActivity=50,
hubs=[2,6], seqLength=[5,6,7],
nSimpleSequences=50, nHubSequences=50):
"""
Generate a set of simple and hub sequences. A simple sequence contains
a randomly chosen set of elements from 0 to 'nCoinc-1'... | [
"Generate",
"a",
"set",
"of",
"simple",
"and",
"hub",
"sequences",
".",
"A",
"simple",
"sequence",
"contains",
"a",
"randomly",
"chosen",
"set",
"of",
"elements",
"from",
"0",
"to",
"nCoinc",
"-",
"1",
".",
"A",
"hub",
"sequence",
"always",
"contains",
"... | numenta/nupic | python | https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/algorithms/fdrutilities.py#L278-L315 | [
"def",
"generateSequences",
"(",
"nPatterns",
"=",
"10",
",",
"patternLen",
"=",
"500",
",",
"patternActivity",
"=",
"50",
",",
"hubs",
"=",
"[",
"2",
",",
"6",
"]",
",",
"seqLength",
"=",
"[",
"5",
",",
"6",
",",
"7",
"]",
",",
"nSimpleSequences",
... | 5922fafffdccc8812e72b3324965ad2f7d4bbdad |
valid | generateL2Sequences | Generate the simulated output from a spatial pooler that's sitting
on top of another spatial pooler / temporal memory pair. The average on-time
of the outputs from the simulated TM is given by the l1Pooling argument.
In this routine, L1 refers to the first spatial and temporal memory and L2
refers to the spat... | src/nupic/algorithms/fdrutilities.py | def generateL2Sequences(nL1Patterns=10, l1Hubs=[2,6], l1SeqLength=[5,6,7],
nL1SimpleSequences=50, nL1HubSequences=50,
l1Pooling=4, perfectStability=False, spHysteresisFactor=1.0,
patternLen=500, patternActivity=50):
"""
Generate the simulated output from a spat... | def generateL2Sequences(nL1Patterns=10, l1Hubs=[2,6], l1SeqLength=[5,6,7],
nL1SimpleSequences=50, nL1HubSequences=50,
l1Pooling=4, perfectStability=False, spHysteresisFactor=1.0,
patternLen=500, patternActivity=50):
"""
Generate the simulated output from a spat... | [
"Generate",
"the",
"simulated",
"output",
"from",
"a",
"spatial",
"pooler",
"that",
"s",
"sitting",
"on",
"top",
"of",
"another",
"spatial",
"pooler",
"/",
"temporal",
"memory",
"pair",
".",
"The",
"average",
"on",
"-",
"time",
"of",
"the",
"outputs",
"fro... | numenta/nupic | python | https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/algorithms/fdrutilities.py#L319-L411 | [
"def",
"generateL2Sequences",
"(",
"nL1Patterns",
"=",
"10",
",",
"l1Hubs",
"=",
"[",
"2",
",",
"6",
"]",
",",
"l1SeqLength",
"=",
"[",
"5",
",",
"6",
",",
"7",
"]",
",",
"nL1SimpleSequences",
"=",
"50",
",",
"nL1HubSequences",
"=",
"50",
",",
"l1Poo... | 5922fafffdccc8812e72b3324965ad2f7d4bbdad |
valid | vectorsFromSeqList | Convert a list of sequences of pattern indices, and a pattern lookup table
into a an array of patterns
Parameters:
-----------------------------------------------
seq: the sequence, given as indices into the patternMatrix
patternMatrix: a SparseMatrix contaning the possible patterns used in
... | src/nupic/algorithms/fdrutilities.py | def vectorsFromSeqList(seqList, patternMatrix):
"""
Convert a list of sequences of pattern indices, and a pattern lookup table
into a an array of patterns
Parameters:
-----------------------------------------------
seq: the sequence, given as indices into the patternMatrix
patternMatrix: ... | def vectorsFromSeqList(seqList, patternMatrix):
"""
Convert a list of sequences of pattern indices, and a pattern lookup table
into a an array of patterns
Parameters:
-----------------------------------------------
seq: the sequence, given as indices into the patternMatrix
patternMatrix: ... | [
"Convert",
"a",
"list",
"of",
"sequences",
"of",
"pattern",
"indices",
"and",
"a",
"pattern",
"lookup",
"table",
"into",
"a",
"an",
"array",
"of",
"patterns"
] | numenta/nupic | python | https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/algorithms/fdrutilities.py#L415-L439 | [
"def",
"vectorsFromSeqList",
"(",
"seqList",
",",
"patternMatrix",
")",
":",
"totalLen",
"=",
"0",
"for",
"seq",
"in",
"seqList",
":",
"totalLen",
"+=",
"len",
"(",
"seq",
")",
"vectors",
"=",
"numpy",
".",
"zeros",
"(",
"(",
"totalLen",
",",
"patternMat... | 5922fafffdccc8812e72b3324965ad2f7d4bbdad |
valid | sameTMParams | Given two TM instances, see if any parameters are different. | src/nupic/algorithms/fdrutilities.py | def sameTMParams(tp1, tp2):
"""Given two TM instances, see if any parameters are different."""
result = True
for param in ["numberOfCols", "cellsPerColumn", "initialPerm", "connectedPerm",
"minThreshold", "newSynapseCount", "permanenceInc", "permanenceDec",
"permanenceMax", "global... | def sameTMParams(tp1, tp2):
"""Given two TM instances, see if any parameters are different."""
result = True
for param in ["numberOfCols", "cellsPerColumn", "initialPerm", "connectedPerm",
"minThreshold", "newSynapseCount", "permanenceInc", "permanenceDec",
"permanenceMax", "global... | [
"Given",
"two",
"TM",
"instances",
"see",
"if",
"any",
"parameters",
"are",
"different",
"."
] | numenta/nupic | python | https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/algorithms/fdrutilities.py#L445-L457 | [
"def",
"sameTMParams",
"(",
"tp1",
",",
"tp2",
")",
":",
"result",
"=",
"True",
"for",
"param",
"in",
"[",
"\"numberOfCols\"",
",",
"\"cellsPerColumn\"",
",",
"\"initialPerm\"",
",",
"\"connectedPerm\"",
",",
"\"minThreshold\"",
",",
"\"newSynapseCount\"",
",",
... | 5922fafffdccc8812e72b3324965ad2f7d4bbdad |
valid | sameSynapse | Given a synapse and a list of synapses, check whether this synapse
exist in the list. A synapse is represented as [col, cell, permanence].
A synapse matches if col and cell are identical and the permanence value is
within 0.001. | src/nupic/algorithms/fdrutilities.py | def sameSynapse(syn, synapses):
"""Given a synapse and a list of synapses, check whether this synapse
exist in the list. A synapse is represented as [col, cell, permanence].
A synapse matches if col and cell are identical and the permanence value is
within 0.001."""
for s in synapses:
if (s[0]==syn[0]) a... | def sameSynapse(syn, synapses):
"""Given a synapse and a list of synapses, check whether this synapse
exist in the list. A synapse is represented as [col, cell, permanence].
A synapse matches if col and cell are identical and the permanence value is
within 0.001."""
for s in synapses:
if (s[0]==syn[0]) a... | [
"Given",
"a",
"synapse",
"and",
"a",
"list",
"of",
"synapses",
"check",
"whether",
"this",
"synapse",
"exist",
"in",
"the",
"list",
".",
"A",
"synapse",
"is",
"represented",
"as",
"[",
"col",
"cell",
"permanence",
"]",
".",
"A",
"synapse",
"matches",
"if... | numenta/nupic | python | https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/algorithms/fdrutilities.py#L459-L467 | [
"def",
"sameSynapse",
"(",
"syn",
",",
"synapses",
")",
":",
"for",
"s",
"in",
"synapses",
":",
"if",
"(",
"s",
"[",
"0",
"]",
"==",
"syn",
"[",
"0",
"]",
")",
"and",
"(",
"s",
"[",
"1",
"]",
"==",
"syn",
"[",
"1",
"]",
")",
"and",
"(",
"... | 5922fafffdccc8812e72b3324965ad2f7d4bbdad |
valid | sameSegment | Return True if seg1 and seg2 are identical, ignoring order of synapses | src/nupic/algorithms/fdrutilities.py | def sameSegment(seg1, seg2):
"""Return True if seg1 and seg2 are identical, ignoring order of synapses"""
result = True
# check sequence segment, total activations etc. In case any are floats,
# check that they are within 0.001.
for field in [1, 2, 3, 4, 5, 6]:
if abs(seg1[0][field] - seg2[0][field]) > 0... | def sameSegment(seg1, seg2):
"""Return True if seg1 and seg2 are identical, ignoring order of synapses"""
result = True
# check sequence segment, total activations etc. In case any are floats,
# check that they are within 0.001.
for field in [1, 2, 3, 4, 5, 6]:
if abs(seg1[0][field] - seg2[0][field]) > 0... | [
"Return",
"True",
"if",
"seg1",
"and",
"seg2",
"are",
"identical",
"ignoring",
"order",
"of",
"synapses"
] | numenta/nupic | python | https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/algorithms/fdrutilities.py#L469-L497 | [
"def",
"sameSegment",
"(",
"seg1",
",",
"seg2",
")",
":",
"result",
"=",
"True",
"# check sequence segment, total activations etc. In case any are floats,",
"# check that they are within 0.001.",
"for",
"field",
"in",
"[",
"1",
",",
"2",
",",
"3",
",",
"4",
",",
"5"... | 5922fafffdccc8812e72b3324965ad2f7d4bbdad |
valid | tmDiff | Given two TM instances, list the difference between them and returns False
if there is a difference. This function checks the major parameters. If this
passes (and checkLearn is true) it checks the number of segments on
each cell. If this passes, checks each synapse on each segment.
When comparing C++ and Py, t... | src/nupic/algorithms/fdrutilities.py | def tmDiff(tm1, tm2, verbosity = 0, relaxSegmentTests =True):
"""
Given two TM instances, list the difference between them and returns False
if there is a difference. This function checks the major parameters. If this
passes (and checkLearn is true) it checks the number of segments on
each cell. If this passe... | def tmDiff(tm1, tm2, verbosity = 0, relaxSegmentTests =True):
"""
Given two TM instances, list the difference between them and returns False
if there is a difference. This function checks the major parameters. If this
passes (and checkLearn is true) it checks the number of segments on
each cell. If this passe... | [
"Given",
"two",
"TM",
"instances",
"list",
"the",
"difference",
"between",
"them",
"and",
"returns",
"False",
"if",
"there",
"is",
"a",
"difference",
".",
"This",
"function",
"checks",
"the",
"major",
"parameters",
".",
"If",
"this",
"passes",
"(",
"and",
... | numenta/nupic | python | https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/algorithms/fdrutilities.py#L499-L579 | [
"def",
"tmDiff",
"(",
"tm1",
",",
"tm2",
",",
"verbosity",
"=",
"0",
",",
"relaxSegmentTests",
"=",
"True",
")",
":",
"# First check basic parameters. If we fail here, don't continue",
"if",
"sameTMParams",
"(",
"tm1",
",",
"tm2",
")",
"==",
"False",
":",
"print... | 5922fafffdccc8812e72b3324965ad2f7d4bbdad |
valid | tmDiff2 | Given two TM instances, list the difference between them and returns False
if there is a difference. This function checks the major parameters. If this
passes (and checkLearn is true) it checks the number of segments on each cell.
If this passes, checks each synapse on each segment.
When comparing C++ and Py, t... | src/nupic/algorithms/fdrutilities.py | def tmDiff2(tm1, tm2, verbosity = 0, relaxSegmentTests =True,
checkLearn = True, checkStates = True):
"""
Given two TM instances, list the difference between them and returns False
if there is a difference. This function checks the major parameters. If this
passes (and checkLearn is true) it checks ... | def tmDiff2(tm1, tm2, verbosity = 0, relaxSegmentTests =True,
checkLearn = True, checkStates = True):
"""
Given two TM instances, list the difference between them and returns False
if there is a difference. This function checks the major parameters. If this
passes (and checkLearn is true) it checks ... | [
"Given",
"two",
"TM",
"instances",
"list",
"the",
"difference",
"between",
"them",
"and",
"returns",
"False",
"if",
"there",
"is",
"a",
"difference",
".",
"This",
"function",
"checks",
"the",
"major",
"parameters",
".",
"If",
"this",
"passes",
"(",
"and",
... | numenta/nupic | python | https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/algorithms/fdrutilities.py#L581-L686 | [
"def",
"tmDiff2",
"(",
"tm1",
",",
"tm2",
",",
"verbosity",
"=",
"0",
",",
"relaxSegmentTests",
"=",
"True",
",",
"checkLearn",
"=",
"True",
",",
"checkStates",
"=",
"True",
")",
":",
"# First check basic parameters. If we fail here, don't continue",
"if",
"sameTM... | 5922fafffdccc8812e72b3324965ad2f7d4bbdad |
valid | spDiff | Function that compares two spatial pooler instances. Compares the
static variables between the two poolers to make sure that they are equivalent.
Parameters
-----------------------------------------
SP1 first spatial pooler to be compared
SP2 second spatial pooler to be compared
To establish ... | src/nupic/algorithms/fdrutilities.py | def spDiff(SP1,SP2):
"""
Function that compares two spatial pooler instances. Compares the
static variables between the two poolers to make sure that they are equivalent.
Parameters
-----------------------------------------
SP1 first spatial pooler to be compared
SP2 second spatial pooler ... | def spDiff(SP1,SP2):
"""
Function that compares two spatial pooler instances. Compares the
static variables between the two poolers to make sure that they are equivalent.
Parameters
-----------------------------------------
SP1 first spatial pooler to be compared
SP2 second spatial pooler ... | [
"Function",
"that",
"compares",
"two",
"spatial",
"pooler",
"instances",
".",
"Compares",
"the",
"static",
"variables",
"between",
"the",
"two",
"poolers",
"to",
"make",
"sure",
"that",
"they",
"are",
"equivalent",
"."
] | numenta/nupic | python | https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/algorithms/fdrutilities.py#L690-L767 | [
"def",
"spDiff",
"(",
"SP1",
",",
"SP2",
")",
":",
"if",
"(",
"len",
"(",
"SP1",
".",
"_masterConnectedM",
")",
"!=",
"len",
"(",
"SP2",
".",
"_masterConnectedM",
")",
")",
":",
"print",
"\"Connected synapse matrices are different sizes\"",
"return",
"False",
... | 5922fafffdccc8812e72b3324965ad2f7d4bbdad |
valid | removeSeqStarts | Convert a list of sequences of pattern indices, and a pattern lookup table
into a an array of patterns
Parameters:
-----------------------------------------------
vectors: the data vectors. Row 0 contains the outputs from time
step 0, row 1 from time step 1, etc.
resets: ... | src/nupic/algorithms/fdrutilities.py | def removeSeqStarts(vectors, resets, numSteps=1):
"""
Convert a list of sequences of pattern indices, and a pattern lookup table
into a an array of patterns
Parameters:
-----------------------------------------------
vectors: the data vectors. Row 0 contains the outputs from time
... | def removeSeqStarts(vectors, resets, numSteps=1):
"""
Convert a list of sequences of pattern indices, and a pattern lookup table
into a an array of patterns
Parameters:
-----------------------------------------------
vectors: the data vectors. Row 0 contains the outputs from time
... | [
"Convert",
"a",
"list",
"of",
"sequences",
"of",
"pattern",
"indices",
"and",
"a",
"pattern",
"lookup",
"table",
"into",
"a",
"an",
"array",
"of",
"patterns"
] | numenta/nupic | python | https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/algorithms/fdrutilities.py#L771-L800 | [
"def",
"removeSeqStarts",
"(",
"vectors",
",",
"resets",
",",
"numSteps",
"=",
"1",
")",
":",
"# Do nothing if numSteps is 0",
"if",
"numSteps",
"==",
"0",
":",
"return",
"vectors",
"resetIndices",
"=",
"resets",
".",
"nonzero",
"(",
")",
"[",
"0",
"]",
"r... | 5922fafffdccc8812e72b3324965ad2f7d4bbdad |
valid | _accumulateFrequencyCounts | Accumulate a list of values 'values' into the frequency counts 'freqCounts',
and return the updated frequency counts
For example, if values contained the following: [1,1,3,5,1,3,5], and the initial
freqCounts was None, then the return value would be:
[0,3,0,2,0,2]
which corresponds to how many of each value ... | src/nupic/algorithms/fdrutilities.py | def _accumulateFrequencyCounts(values, freqCounts=None):
"""
Accumulate a list of values 'values' into the frequency counts 'freqCounts',
and return the updated frequency counts
For example, if values contained the following: [1,1,3,5,1,3,5], and the initial
freqCounts was None, then the return value would b... | def _accumulateFrequencyCounts(values, freqCounts=None):
"""
Accumulate a list of values 'values' into the frequency counts 'freqCounts',
and return the updated frequency counts
For example, if values contained the following: [1,1,3,5,1,3,5], and the initial
freqCounts was None, then the return value would b... | [
"Accumulate",
"a",
"list",
"of",
"values",
"values",
"into",
"the",
"frequency",
"counts",
"freqCounts",
"and",
"return",
"the",
"updated",
"frequency",
"counts"
] | numenta/nupic | python | https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/algorithms/fdrutilities.py#L804-L844 | [
"def",
"_accumulateFrequencyCounts",
"(",
"values",
",",
"freqCounts",
"=",
"None",
")",
":",
"# How big does our freqCounts vector need to be?",
"values",
"=",
"numpy",
".",
"array",
"(",
"values",
")",
"numEntries",
"=",
"values",
".",
"max",
"(",
")",
"+",
"1... | 5922fafffdccc8812e72b3324965ad2f7d4bbdad |
valid | _listOfOnTimesInVec | Returns 3 things for a vector:
* the total on time
* the number of runs
* a list of the durations of each run.
Parameters:
-----------------------------------------------
input stream: 11100000001100000000011111100000
return value: (11, 3, [3, 2, 6]) | src/nupic/algorithms/fdrutilities.py | def _listOfOnTimesInVec(vector):
"""
Returns 3 things for a vector:
* the total on time
* the number of runs
* a list of the durations of each run.
Parameters:
-----------------------------------------------
input stream: 11100000001100000000011111100000
return value: (11, 3, [3, 2, 6])
"""
... | def _listOfOnTimesInVec(vector):
"""
Returns 3 things for a vector:
* the total on time
* the number of runs
* a list of the durations of each run.
Parameters:
-----------------------------------------------
input stream: 11100000001100000000011111100000
return value: (11, 3, [3, 2, 6])
"""
... | [
"Returns",
"3",
"things",
"for",
"a",
"vector",
":",
"*",
"the",
"total",
"on",
"time",
"*",
"the",
"number",
"of",
"runs",
"*",
"a",
"list",
"of",
"the",
"durations",
"of",
"each",
"run",
"."
] | numenta/nupic | python | https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/algorithms/fdrutilities.py#L848-L896 | [
"def",
"_listOfOnTimesInVec",
"(",
"vector",
")",
":",
"# init counters",
"durations",
"=",
"[",
"]",
"numOnTimes",
"=",
"0",
"totalOnTime",
"=",
"0",
"# Find where the nonzeros are",
"nonzeros",
"=",
"numpy",
".",
"array",
"(",
"vector",
")",
".",
"nonzero",
... | 5922fafffdccc8812e72b3324965ad2f7d4bbdad |
valid | _fillInOnTimes | Helper function used by averageOnTimePerTimestep. 'durations' is a vector
which must be the same len as vector. For each "on" in vector, it fills in
the corresponding element of duration with the duration of that "on" signal
up until that time
Parameters:
-----------------------------------------------
vec... | src/nupic/algorithms/fdrutilities.py | def _fillInOnTimes(vector, durations):
"""
Helper function used by averageOnTimePerTimestep. 'durations' is a vector
which must be the same len as vector. For each "on" in vector, it fills in
the corresponding element of duration with the duration of that "on" signal
up until that time
Parameters:
------... | def _fillInOnTimes(vector, durations):
"""
Helper function used by averageOnTimePerTimestep. 'durations' is a vector
which must be the same len as vector. For each "on" in vector, it fills in
the corresponding element of duration with the duration of that "on" signal
up until that time
Parameters:
------... | [
"Helper",
"function",
"used",
"by",
"averageOnTimePerTimestep",
".",
"durations",
"is",
"a",
"vector",
"which",
"must",
"be",
"the",
"same",
"len",
"as",
"vector",
".",
"For",
"each",
"on",
"in",
"vector",
"it",
"fills",
"in",
"the",
"corresponding",
"elemen... | numenta/nupic | python | https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/algorithms/fdrutilities.py#L900-L946 | [
"def",
"_fillInOnTimes",
"(",
"vector",
",",
"durations",
")",
":",
"# Find where the nonzeros are",
"nonzeros",
"=",
"numpy",
".",
"array",
"(",
"vector",
")",
".",
"nonzero",
"(",
")",
"[",
"0",
"]",
"# Nothing to do if vector is empty",
"if",
"len",
"(",
"n... | 5922fafffdccc8812e72b3324965ad2f7d4bbdad |
valid | averageOnTimePerTimestep | Computes the average on-time of the outputs that are on at each time step, and
then averages this over all time steps.
This metric is resiliant to the number of outputs that are on at each time
step. That is, if time step 0 has many more outputs on than time step 100, it
won't skew the results. This is particu... | src/nupic/algorithms/fdrutilities.py | def averageOnTimePerTimestep(vectors, numSamples=None):
"""
Computes the average on-time of the outputs that are on at each time step, and
then averages this over all time steps.
This metric is resiliant to the number of outputs that are on at each time
step. That is, if time step 0 has many more outputs on ... | def averageOnTimePerTimestep(vectors, numSamples=None):
"""
Computes the average on-time of the outputs that are on at each time step, and
then averages this over all time steps.
This metric is resiliant to the number of outputs that are on at each time
step. That is, if time step 0 has many more outputs on ... | [
"Computes",
"the",
"average",
"on",
"-",
"time",
"of",
"the",
"outputs",
"that",
"are",
"on",
"at",
"each",
"time",
"step",
"and",
"then",
"averages",
"this",
"over",
"all",
"time",
"steps",
"."
] | numenta/nupic | python | https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/algorithms/fdrutilities.py#L950-L1002 | [
"def",
"averageOnTimePerTimestep",
"(",
"vectors",
",",
"numSamples",
"=",
"None",
")",
":",
"# Special case given a 1 dimensional vector: it represents a single column",
"if",
"vectors",
".",
"ndim",
"==",
"1",
":",
"vectors",
".",
"shape",
"=",
"(",
"-",
"1",
",",... | 5922fafffdccc8812e72b3324965ad2f7d4bbdad |
valid | averageOnTime | Returns the average on-time, averaged over all on-time runs.
Parameters:
-----------------------------------------------
vectors: the vectors for which the onTime is calculated. Row 0
contains the outputs from time step 0, row 1 from time step
1, etc.
numSamples... | src/nupic/algorithms/fdrutilities.py | def averageOnTime(vectors, numSamples=None):
"""
Returns the average on-time, averaged over all on-time runs.
Parameters:
-----------------------------------------------
vectors: the vectors for which the onTime is calculated. Row 0
contains the outputs from time step 0, row 1 fr... | def averageOnTime(vectors, numSamples=None):
"""
Returns the average on-time, averaged over all on-time runs.
Parameters:
-----------------------------------------------
vectors: the vectors for which the onTime is calculated. Row 0
contains the outputs from time step 0, row 1 fr... | [
"Returns",
"the",
"average",
"on",
"-",
"time",
"averaged",
"over",
"all",
"on",
"-",
"time",
"runs",
"."
] | numenta/nupic | python | https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/algorithms/fdrutilities.py#L1006-L1053 | [
"def",
"averageOnTime",
"(",
"vectors",
",",
"numSamples",
"=",
"None",
")",
":",
"# Special case given a 1 dimensional vector: it represents a single column",
"if",
"vectors",
".",
"ndim",
"==",
"1",
":",
"vectors",
".",
"shape",
"=",
"(",
"-",
"1",
",",
"1",
"... | 5922fafffdccc8812e72b3324965ad2f7d4bbdad |
valid | plotOutputsOverTime | Generate a figure that shows each output over time. Time goes left to right,
and each output is plotted on a different line, allowing you to see the overlap
in the outputs, when they turn on/off, etc.
Parameters:
------------------------------------------------------------
vectors: the vectors to ... | src/nupic/algorithms/fdrutilities.py | def plotOutputsOverTime(vectors, buVectors=None, title='On-times'):
"""
Generate a figure that shows each output over time. Time goes left to right,
and each output is plotted on a different line, allowing you to see the overlap
in the outputs, when they turn on/off, etc.
Parameters:
----------------------... | def plotOutputsOverTime(vectors, buVectors=None, title='On-times'):
"""
Generate a figure that shows each output over time. Time goes left to right,
and each output is plotted on a different line, allowing you to see the overlap
in the outputs, when they turn on/off, etc.
Parameters:
----------------------... | [
"Generate",
"a",
"figure",
"that",
"shows",
"each",
"output",
"over",
"time",
".",
"Time",
"goes",
"left",
"to",
"right",
"and",
"each",
"output",
"is",
"plotted",
"on",
"a",
"different",
"line",
"allowing",
"you",
"to",
"see",
"the",
"overlap",
"in",
"t... | numenta/nupic | python | https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/algorithms/fdrutilities.py#L1057-L1091 | [
"def",
"plotOutputsOverTime",
"(",
"vectors",
",",
"buVectors",
"=",
"None",
",",
"title",
"=",
"'On-times'",
")",
":",
"# Produce the plot",
"import",
"pylab",
"pylab",
".",
"ion",
"(",
")",
"pylab",
".",
"figure",
"(",
")",
"imData",
"=",
"vectors",
".",... | 5922fafffdccc8812e72b3324965ad2f7d4bbdad |
valid | plotHistogram | This is usually used to display a histogram of the on-times encountered
in a particular output.
The freqCounts is a vector containg the frequency counts of each on-time
(starting at an on-time of 0 and going to an on-time = len(freqCounts)-1)
The freqCounts are typically generated from the averageOnTimePerTim... | src/nupic/algorithms/fdrutilities.py | def plotHistogram(freqCounts, title='On-Times Histogram', xLabel='On-Time'):
"""
This is usually used to display a histogram of the on-times encountered
in a particular output.
The freqCounts is a vector containg the frequency counts of each on-time
(starting at an on-time of 0 and going to an on-time = len(... | def plotHistogram(freqCounts, title='On-Times Histogram', xLabel='On-Time'):
"""
This is usually used to display a histogram of the on-times encountered
in a particular output.
The freqCounts is a vector containg the frequency counts of each on-time
(starting at an on-time of 0 and going to an on-time = len(... | [
"This",
"is",
"usually",
"used",
"to",
"display",
"a",
"histogram",
"of",
"the",
"on",
"-",
"times",
"encountered",
"in",
"a",
"particular",
"output",
"."
] | numenta/nupic | python | https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/algorithms/fdrutilities.py#L1095-L1119 | [
"def",
"plotHistogram",
"(",
"freqCounts",
",",
"title",
"=",
"'On-Times Histogram'",
",",
"xLabel",
"=",
"'On-Time'",
")",
":",
"import",
"pylab",
"pylab",
".",
"ion",
"(",
")",
"pylab",
".",
"figure",
"(",
")",
"pylab",
".",
"bar",
"(",
"numpy",
".",
... | 5922fafffdccc8812e72b3324965ad2f7d4bbdad |
valid | populationStability | Returns the stability for the population averaged over multiple time steps
Parameters:
-----------------------------------------------
vectors: the vectors for which the stability is calculated
numSamples the number of time steps where stability is counted
At each time step, count the fracti... | src/nupic/algorithms/fdrutilities.py | def populationStability(vectors, numSamples=None):
"""
Returns the stability for the population averaged over multiple time steps
Parameters:
-----------------------------------------------
vectors: the vectors for which the stability is calculated
numSamples the number of time steps where ... | def populationStability(vectors, numSamples=None):
"""
Returns the stability for the population averaged over multiple time steps
Parameters:
-----------------------------------------------
vectors: the vectors for which the stability is calculated
numSamples the number of time steps where ... | [
"Returns",
"the",
"stability",
"for",
"the",
"population",
"averaged",
"over",
"multiple",
"time",
"steps"
] | numenta/nupic | python | https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/algorithms/fdrutilities.py#L1123-L1156 | [
"def",
"populationStability",
"(",
"vectors",
",",
"numSamples",
"=",
"None",
")",
":",
"# ----------------------------------------------------------------------",
"# Calculate the stability",
"numVectors",
"=",
"len",
"(",
"vectors",
")",
"if",
"numSamples",
"is",
"None",
... | 5922fafffdccc8812e72b3324965ad2f7d4bbdad |
valid | percentOutputsStableOverNTimeSteps | Returns the percent of the outputs that remain completely stable over
N time steps.
Parameters:
-----------------------------------------------
vectors: the vectors for which the stability is calculated
numSamples: the number of time steps where stability is counted
For each window of numSample... | src/nupic/algorithms/fdrutilities.py | def percentOutputsStableOverNTimeSteps(vectors, numSamples=None):
"""
Returns the percent of the outputs that remain completely stable over
N time steps.
Parameters:
-----------------------------------------------
vectors: the vectors for which the stability is calculated
numSamples: the numbe... | def percentOutputsStableOverNTimeSteps(vectors, numSamples=None):
"""
Returns the percent of the outputs that remain completely stable over
N time steps.
Parameters:
-----------------------------------------------
vectors: the vectors for which the stability is calculated
numSamples: the numbe... | [
"Returns",
"the",
"percent",
"of",
"the",
"outputs",
"that",
"remain",
"completely",
"stable",
"over",
"N",
"time",
"steps",
"."
] | numenta/nupic | python | https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/algorithms/fdrutilities.py#L1160-L1197 | [
"def",
"percentOutputsStableOverNTimeSteps",
"(",
"vectors",
",",
"numSamples",
"=",
"None",
")",
":",
"# ----------------------------------------------------------------------",
"# Calculate the stability",
"totalSamples",
"=",
"len",
"(",
"vectors",
")",
"windowSize",
"=",
... | 5922fafffdccc8812e72b3324965ad2f7d4bbdad |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.