Converting NuPIC params to HTM.Java params


Dear all,

I’m trying to implement an anomaly detection that takes a timed series file as input as in HotGym project but its values are coordinates[latitude, longitude, radius] just like the mine-hack project. For the time series I’m using a sine function to generate coordinates. The radius is the distance between current and previous coordinates. I used the GeospatialCoordinateEncoder and now it’s kind of detecting anomalies.

My problem is that the network is detecting anomalies where it shouldn’t. I think that’s because the hotgym model doesn’t fit this problem requirements.

I’m running on a windows machine under a corporate proxy that doesn’t allow me to build the DockerFile as I should in order to run a swarming on my series. So I googled around and found the python mine-hack project that I am now trying to mimetyze in but I can’t find some of the python parameters in the KEY enum.

Could you please give me some advice on accomplishing that task?

this the model I want to port to java:


You can ignore temporalImp.


Problem is that’s not the only parameter I couldn’t find.

I couldn’t find the following ones:

'predictAheadTime': None,
 'inferenceType': 'TemporalAnomaly',
'sensorAutoReset' : None,
'boostStrength': 1.0,
'globalDecay': 0.0,
'pamLength': 3,
'anomalyCacheRecords': None,
'autoDetectThreshold': None,
'autoDetectWaitRecords': 2184},
'trainSPNetOnlyIfRequested': False,

That’s how I have my python to java API mapping now:

‘predictAheadTime’: None, -> NOT FOUND EXCEPTION :stuck_out_tongue:

‘spParams’: {

        'globalInhibition': 1, -> parameters.set(KEY.GLOBAL_INHIBITION, true);

        'columnCount': 2048, -> parameters.set(KEY.COLUMN_DIMENSIONS, new int[] { 2048 });

        'inputWidth': 0, -> parameters.set(KEY.INPUT_DIMENSIONS, new int[] { 0 });

        'numActiveColumnsPerInhArea': 40, -> parameters.set(KEY.NUM_ACTIVE_COLUMNS_PER_INH_AREA, 40.0);

        'seed': 1956, -> parameters.set(KEY.SEED, 1956);

        'potentialPct': 0.8, -> parameters.set(KEY.POTENTIAL_PCT, 0.8);

        'synPermConnected': 0.1, -> parameters.set(KEY.SYN_PERM_CONNECTED, 0.1);

        'synPermActiveInc': 0.0001, -> parameters.set(KEY.SYN_PERM_ACTIVE_INC, 0.0001);

        'synPermInactiveDec': 0.0005, -> parameters.set(KEY.SYN_PERM_INACTIVE_DEC, 0.0005);

        'boostStrength': 1.0, -> NOT FOUND EXCEPTION :p
  'tmEnable' : True, -> NOT FOUND EXCEPTION :p
   'tmParams': {
        'columnCount': 2048,  -> couldn't find this setting to temporal memory only
        'cellsPerColumn': 32, -> couldn't find this setting to temporal memory only
        'inputWidth': 2048, -> couldn't find this setting to temporal memory only

        'seed': 1960,	-> couldn't find this setting to temporal memory only

        'newSynapseCount': 20, -> couldn't find this setting to temporal memory only

        'maxSynapsesPerSegment': 32, -> parameters.set(KEY.MAX_SYNAPSES_PER_SEGMENT, 32);

        'maxSegmentsPerCell': 128, -> parameters.set(KEY.MAX_SEGMENTS_PER_CELL, 128);

        'initialPerm': 0.21, -> parameters.set(KEY.INITIAL_PERMANENCE, 0.21);

        'connectedPerm': 0.5, -> parameters.set(KEY.CONNECTED_PERMANENCE, 0.5);

        'permanenceInc': 0.1, -> parameters.set(KEY.PERMANENCE_INCREMENT, 0.1);

        'permanenceDec' : 0.1, -> parameters.set(KEY.PERMANENCE_DECREMENT, 0.1);

        'globalDecay': 0.0, -> NOT FOUND EXCEPTION :p

        'maxAge': 0, -> NOT FOUND EXCEPTION :p

        'minThreshold': 3, -> parameters.set(KEY.MIN_THRESHOLD, 3);

        'activationThreshold': 6, -> parameters.set(KEY.ACTIVATION_THRESHOLD, 6);

        'outputType': 'normal',


  'clEnable': False, -> NOT FOUND EXCEPTION :p
    'clParams': None, -> NOT FOUND EXCEPTION :p

    'anomalyParams': {  
  u'anomalyCacheRecords': None, -> NOT FOUND EXCEPTION :p
u'autoDetectThreshold': None, -> NOT FOUND EXCEPTION :p
u'autoDetectWaitRecords': 2184}, -> NOT FOUND EXCEPTION :p

    'trainSPNetOnlyIfRequested': False, -> NOT FOUND EXCEPTION :p


Hi @Matheus_Araujo,

I wish I could promote this answer in such a way as to have it globally accessible because a lot of people have asked this question (or ones like it), with regard to HTM.Java and anomaly detection.

These fields:

'predictAheadTime': None,
 'inferenceType': 'TemporalAnomaly',
'sensorAutoReset' : None,
'boostStrength': 1.0,
'globalDecay': 0.0,
'pamLength': 3,
'anomalyCacheRecords': None,
'autoDetectThreshold': None,
'autoDetectWaitRecords': 2184},
'trainSPNetOnlyIfRequested': False,

…are not parameters that control the performance of the underlying algorithms (SpatialPooler, TemporalMemory, AnomalyDetection etc.), rather these are parameters that control the Infrastructure containing those algorithms.

These parameters refer to the Python/C++ wrapper around the core algorithms and therefore are not available (nor are appropriate), for HTM.Java or it’s (Java Specific) wrapper, the NetworkAPI.

Hope that clears a few things up?

P.S. You guys are like monsters with this AI stuff! You must really be trying to create this thing or something, huh? :stuck_out_tongue: