Sorry to paste the plain text here. It is not allowed to upload python file in this website.
The swarm file is as follows:
SWARM_DESCRIPTION = {
"includedFields": [
{
"fieldName": "timestamp",
"fieldType": "datetime"
},
{
"fieldName": "duration",
"fieldType": "float",
"maxValue": 300.0,
"minValue": 1.0
}
],
"streamDef": {
"info": "duration",
"version": 1,
"streams": [
{
"info": "duration",
"source": "file://../data/aaa.csv",
"columns": [
"*"
]
}
]
},
"inferenceType": "TemporalAnomaly",
"inferenceArgs": {
"predictionSteps": [
1
],
"predictedField": "duration"
},
"swarmSize": "medium"
}
The model Params file, which is generated from swarm file above, is like this:
MODEL_PARAM = \
{ 'aggregationInfo': { 'days': 0,
'fields': [],
'hours': 0,
'microseconds': 0,
'milliseconds': 0,
'minutes': 0,
'months': 0,
'seconds': 0,
'weeks': 0,
'years': 0},
'model': 'HTMPrediction',
'modelParams': { 'anomalyParams': { u'anomalyCacheRecords': None,
u'autoDetectThreshold': None,
u'autoDetectWaitRecords': None},
'clParams': { 'alpha': 0.0001,
'regionName': 'SDRClassifierRegion',
'steps': '1',
'verbosity': 0},
'inferenceType': 'TemporalAnomaly',
'sensorParams': { 'encoders': {
u'duration': { 'clipInput': True,
'fieldname': 'duration',
'maxval': 300.0,
'minval': 1.0,
'n': 22,
'name': 'duration',
'type': 'ScalarEncoder',
'w': 21},
u'timestamp_dayOfWeek': None,
u'timestamp_timeOfDay': None,
u'timestamp_weekend': None},
'sensorAutoReset': None,
'verbosity': 0},
'spEnable': True,
'spParams': { 'boostStrength': 0.0,
'columnCount': 2048,
'globalInhibition': 1,
'inputWidth': 0,
'numActiveColumnsPerInhArea': 40,
'potentialPct': 0.8,
'seed': 1956,
'spVerbosity': 0,
'spatialImp': 'cpp',
'synPermActiveInc': 0.05,
'synPermConnected': 0.1,
'synPermInactiveDec': 0.1},
'tmEnable': True,
'tmParams': { 'activationThreshold': 12,
'cellsPerColumn': 32,
'columnCount': 2048,
'globalDecay': 0.0,
'initialPerm': 0.21,
'inputWidth': 2048,
'maxAge': 0,
'maxSegmentsPerCell': 128,
'maxSynapsesPerSegment': 32,
'minThreshold': 9,
'newSynapseCount': 20,
'outputType': 'normal',
'pamLength': 1,
'permanenceDec': 0.1,
'permanenceInc': 0.1,
'seed': 1960,
'temporalImp': 'cpp',
'verbosity': 0},
'trainSPNetOnlyIfRequested': False},
'predictAheadTime': None,
'version': 1}
Regarding the code, I encapsulate the example from nupic.