Predicting Multiple Output Values

swarming
question
prediction
opf

#1

Long time listener, first time caller :slight_smile: I’ve been really excited about the NUPIC/Numenta project for some time, and I’m just recently getting to really sit down and start playing with the code. Really liking the HTM school videos by the way.

I’m wanting to run a prediction to output multiple values. Is that possible?

Looking through the documentation, I haven’t found how to do that. If I understand the theory correctly once it’s encoded there shouldn’t be any difference in predicting the SDR bits of one value vs. multiple.

In the context of this tutorial (https://github.com/numenta/nupic/tree/master/examples/opf/clients/hotgym/prediction/one_gym), I’m thinking something like this:

swarm_description.py

  "includedFields": [
    {
      "fieldName": "timestamp",
      "fieldType": "datetime"
    },
    {
      "fieldName": "kw_energy_consumption",
      "fieldType": "float",
      "maxValue": 53.0,
      "minValue": 0.0
    },
    {
      "fieldName": "gal_water_usage",
      "fieldType": "float"
    }
  ],

. . . 

  "inferenceArgs": {
    "predictionSteps": [
      1
    ],
    "predictedField": "kw_energy_consumption", "gal_water_usage"
  },

Is there a way for a single model to predict multiple outputs?
Predict anomalies on more than a single input field
#2

Welcome to our community, Jon!

That is because the code do extract multiple predictions has not been written yet. It is certainly possible. See:

Sorry to disappoint you!


#3

Thanks for the quick reply. I’m certainly not disappointed.

I was thinking through a hack to make it work for now, and I’m interested in your/the community’s thoughts.

I have three thoughts:

  1. Basically I’d add a third input variable “combined_value” that would be the predicted value and represent the two values combined (maybe in a bit concatenation).

  2. Create a custom encoder

  3. Try to access the CLA outputs directly and see if I can tease out more than one variable

Do y’all have a thought on which would be most effective?


#4

Definitely take the advice in the ticket from @subutai. We already have a place in the OPF API where you can customize how a model is created. I suggest you start by learning about the Network API, which will inform you on how you might extend the CLAModel, which is a part of the OPF.

I also recommend you familiarize yourself with object-oriented python, as you will be extending an existing class.

But who knows, you might find it easier to use the Network API directly if you know what you are doing. If you have a grasp of the theory, you could put a network together using our examples as a starting point. You’ll be able to re-use a lot of code.


#5

Sounds good. Thanks again.

I’ll look at an extension, and if it’s not too ugly maybe share it in git.


#6

Hi Guys,

I may be misinterpreting things, but I believe you can get “multiple predictions” from the classifier. It has probabilities for each possible bucket (perceived distinct input), it has seen thus far - and you can extract all of them in a single call and iterate over them to see the probabilities of each.

(unless you meant something else by “output multiple values”?)

Cheers,
David


#7

David, I think he wants to predict multiple fields, not just get a probability distribution.


#8

I see. I thought I might not totally understand what he was trying to do. Well on that note, I’ve been dealing with a personal family loss and haven’t gotten around to doing the new release; but @hopding has added this feature formally to HTM.Java. You can now (as soon as I do the new release), specify more than one field to “infer” on and also pick which classifier you want to use for each. I know people have technology stacks and ecosystems that are rigid depending on how NuPIC is being used - but if you want to just play around with the feature or even use java - Just Stay tuned…


#9

David, sorry for the loss.

I’m looking forward to the update when y’all deploy. I’ve been playing with both the Python and Java code bases.


#10

@jon

Thank you…

Here’s the update’s announcement!

David