The multiencoder can encode different fields of the same data record into the same SDR, but what is the output of SP?

Hi,
I am running HTM.java-examples, I found that, the multiencoder can encode different fields of the same data record into the same SDR as the input of SP, but the output of the prediction value is for which field?

In the HTM.java-NetworkAPIDemo example, I changed the csv data set into the following(random values) :slight_smile:

I changed the field timestamp frome datetime into integer, and I modified some configs of the file NetworkDemoHarness.java respectively to run the demo with no errors. I changed the encoder of the field timestamp to the scalarencoder.

The ScalarEncoder for each field is configured the same as n=50 , w=21 and no periodic.
For the SP, 2048 columns with 32 cells per column. I have specified the classifiers for each field like:

        Map<String, Class> fieldMap = new HashMap<String, Class>();
        fieldMap.put("consumption", SDRClassifier.class);
        fieldMap.put("timestamp", SDRClassifier.class);
        p.set(KEY.INFERRED_FIELDS, fieldMap);

From the output of this demo, we can see that the two fields:timestamp and consumpution are encoded into the same SDR with 42 bits on of 100bits total.

   1, 27.00, prediction= 43.00, 16.00, anomaly score=1.0

0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 [100]

2, 48.00, prediction= 27.00, 21.00, anomaly score=1.0

0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 [100]

3, 11.00, prediction= 27.00, 16.00, anomaly score=1.0

0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0 [100]

the question is ,of which field the predicted value is? From the output, I guess the prediction is for the consumpution field ,and why not the timestamp field? How does it decide which field value should be predicted ?
Thanks alot!

Hey =)
I am not familiar with the java implementation, but in python (and I think you should have the same) there is a file named model_params. I don’t know if you are using this, but in there you have the encoders.
For example:

'sensorParams': { 'encoders': { '_classifierInput': { 'classifierOnly': True,
                                                                         'clipInput': True,
                                                                         'fieldname': 'consumption',
                                                                         'maxval': 328.546435745,
                                                                         'minval': 37.0,
                                                                         'n': 521,
                                                                         'name': '_classifierInput',
                                                                         'type': 'ScalarEncoder',
                                                                         'w': 21},
                                                   u'consumption': { 'clipInput': True,
                                                                     'fieldname': 'consumption',
                                                                     'maxval': 328.546435745,
                                                                     'minval': 37.0,
                                                                     'n': 398,
                                                                     'name': 'consumption',
                                                                     'type': 'ScalarEncoder',
                                                                     'w': 21}}

as you can see there is an encoder for the '_classifierInput' and the fieldname of this encoder defines the predicted field.
But as I said… I am not sure how you are building your model… :sweat_smile:

1 Like

thank you very much!
I am trying to do some tests using HTM to see if it is suitable for my project.
I want to find out the differences between HTM and other unsupervised learning algorithms? Could you give me some advices?

I want to discover specified linking patterns within the streaming data and to predict the future patterns

Yes, I have found the “classifierField” of the HTM.java will set the prediction field.

but now, I am confused that the two fields will be encoded into a same SDR, which means the HTM will process them with no differences (the same learning process in the SP), but, the system can output the results of each field separately. I want to know what happened underground?

sorry I am not familiar with other models… I just used supervised NN and HTM so far :grin:

The HTM uses a NN for the classification/prediction. This is what we call the SIR-classifier.
As far as I know, there is no paper about all the details. But you can check these links to find out more about this classifier:

http://nupic.docs.numenta.org/0.7.0.dev0/api/algorithms/classifiers.html?highlight=sdr#module-nupic.algorithms.sdr_classifier

And there is also a paper about the prediction that you can check… but the part about the classifier itself is quite short… but the paper is really interesting anyway.
and finally I also asked about the classifiers in this forum.
Maybe you get an better idea about the different classifiers when reading this. It is quite short, but IMO helpful :blush:

1 Like