Skip to content
Logan Gorence edited this page Oct 24, 2015 · 12 revisions

Models are used by the Online Prediction Framework (OPF). However, "The OPF does not create models. It is up to the client code to figure out how many models to run, and to instantiate the correct types of models"

Important modules

nupic.frameworks.opf.modelfactory

Types of Model

CLAModel

nupic.frameworks.opf.clamodel.CLAModel

Standard model to apply the CLA to the OPF.

TwoGramModel

nupic.frameworks.opf.two_gram_model.TwoGramModel

...

PreviousValueModel

nupic.frameworks.opf.previousvaluemodel.PreviousValueModel

Takes the current sensor input and predicts that the next input will be that value, with the probability of 1.

...

Custom

You can subclass nupic.frameworks.opf.model.Model to create your own OPF model.

ModelFactory

The OPF provides a ModelFactory class that can simplify the process of creating new models. nupic.frameworks.opf.modelfactory.ModelFactory takes a configuration, modelParams, which is a declaration of parameters as a nested dict.

If you create your own Model subclass, you will need to create this yourself as ModelFactory will not know what to do here.

modelParams schema

For demonstrated usage, see the hotgym and cpu examples.

Version 1:

model
String field. Controls the type of model which will be created by ModelFactory. Values are case sensitive.
Legal values include:
version
Integer field. Describes the format of the modelParams dict.
predictAheadTime
...
modelParams
dict field. Defines the parameters for the model.
anomalyParams
anomalyCacheRecords
... can be None
autoDetectThreshold
... can be None
autoDetectWaitRecords
... can be None
inferenceType
String field. The type of inference that this model will perform.
Legal values include
  • TemporalAnomaly
  • TemporalNextStep
  • TemporalMultiStep
sensorParams
dict field.
verbosity
Integer field. Sensor diagnostic output verbosity control. When greater than 0, the sensor region prints out on screen what it's sensing at each step.
aggregationInfo
dict field. Controls which field in the modelInput are aggregated and by how much.
This example will tells the model to aggregate the consumption and sum fields into hour bins.
{
        'days': 0,
        'fields': [('consumption', 'sum')],
        'hours': 1,
        'microseconds': 0,
        'milliseconds': 0,
        'minutes': 0,
        'months': 0,
        'seconds': 0,
        'weeks': 0,
        'years': 0
}
<dt>encoders</dt><dd><code>dict</code> field.</dd>
</dl>
sensorAutoReset
dict field that accepts None. Controls the period for automatically-generated resets from a RecordSensor. Legal values include:
  • None => disable automatically-generated resets. (They are also disabled if all of the specified values evaluate to 0).
  • dict(kwargs) where kwargs is combination of the following: days, hours, minutes, seconds, milliseconds, microseconds, and weeks, e.g. `dict(days=1,hours=12)`
spEnable
Boolean field. Controls whether spatial pooling (SP) is enabled.
spParams
spVerbosity
Integer field. Controls the verbosity of the spatial pooling. Legal values are 0-6.
globalInhibition
Integer field.
columnCount
Integer field. Controls the number of cell columns in the cortical region. Should be the same number as the temporal pooling.
inputWidth
Integer field.
maxBoost
Float field.
numActivePerInhArea
Integer field. Controls the maximum number of active colums in the spatial pooling region's output. When there are more columns than the maximum, weaker columns are suppressed.
seed
Integer field.
coincInputPoolPct
Float field. Controls what percent of columns' receptive fields are available for potential synapses. At initialization time, we will choose coincInputPoolPct * (2*coincInputRadius+1)^2
synPermConnected
Float field. Controls the default threshold of when synapses are deemed to be connected. Any synapse whose permanence value is above the connected threshold is a "connected synapse", meaning it can contribute to the cell's firing. Typical value is 0.10. Cells whose activity level before inhibition falls below minDutyCycleBeforeInh will have their own internal synPermConnectedCell threshold set below this default value.
synPermActiveInc
Float field.
synPermInactiveDec
Float field.
tpEnable
Whether temporal pooling (TP) is enabled. Legal values include True and False. TP is necessary for making temporal predictions, such as predicting subsequent inputs. Without TP, the model is only capable of reconstructing missing sensor inputs (via spatial pooling).
tpParams
verbosity
Integer field. Controls the output of the temporal pooling. Legal values are 0-6/
columnCount
Integer field. Controls the number of cell columns in the cortical region. Should be the same number as spatial pooling.
cellsPerCount
Integer field. Controls the number of cells, i.e. states, that are allocated per column.
inputWidth
Integer field.
seed
Integer field.
temporalImp
String field. Selects which implementation of Temporal Pooling to use. Legal values include cpp.
newSynapseCount
Integer field that accepts None. Controls the count of new synapse formation. When set to None, use the value of spNumActivePerInhArea.
maxSynapsesPerSegment
Integer field. Controls the maximum number of synapses per segment. > 0 for fixed-size CLA. -1 for non-fixed-size CLA.
maxSegmentsPerCell
Integer field. Controls the maximum number of segments per cell. > 0 for fixed-size CLA. -1 for non-fixed-size CLA.
initialPerm
Float field.
permanenceInc
Float field.
permanenceDec
Float field that accepts None. Controls the permanence decrement. If set to None, defaults to the value of tpPermanenceInc.
globalDecay
Float field.
maxAge
Integer field.
minThreshold
Integer field that accepts None. Controls the minimum number of active synapses for a segment to be considered during search for the best-matching segments. If None is given, then use the default value.
activationThreshold
Integer field that accepts None. Controls the segment activation threshold. A segment is active if it has <= tpSegmentActivationThreshold connected synapses that are active due to infActiveState. If None is given, then use the default value.
outputType
String field. Legal values include "normal".
pamLenth
Integer field. "Pay Attention Mode" length. This tells the Temporal Pooler how many new elements to append to the end of a learned sequence at a time. Smaller values are better for datasets with short sequences, higher values are better for datasets with long sequences.
clParams
regionName
...
clVerbosity
Integer field. Controls the classifier diagnostic output verbosity. Legal values are the integers 0-6 inclusive.
alpha
Float field. Controls how fast the classifier learns and forgets. Higher values make it adapt faster, meaning it forgets older patterns more quickly.
steps
Integer field. This is set after the call to updateConfigFromSubConfig and is computed from the aggregationInfo and predictAheadTime.
trainSPNetOnlyIfRequested
...

Clone this wiki locally