Nupic API for multi field Input

Hi,
I have gone through the examples available in nupic-master but all are based on single variable as an INPUT FIELD . Is there any example using NUPIC which accepts more than on input field and predicts the output and detects the anomaly.


Thanks
Vikash

2 Likes

Hereā€™s an example project I created that uses multiple input fields, but Iā€™m afraid it might not work because it depend on River View (and River View is not healthy). But the code might be useful to give you an example of how to put together a model with many inputs.

1 Like

Thanks @rhyolight :slight_smile:

Hi Matt,
I was trying to run the Menorah locally.i tried exmple1.py but i got the error that ā€œNo JSON object could be decodedā€. I went through the code but i couldnā€™t understand that how you are getting the streaming data for the input. Please help me out to resolve the issue.
Thanks in anticipation.


Regards
Vikash0837

Honestly, we donā€™t have a good example of swarming and running models on multiple fields (if someone knows one, please share). Menorah was more of a proof of concept (experiment) than a tutorial.

Are you connected to the internet when you run? Menorah pulls data from http://data.numenta.org.

You can try adding debug=True to the Menorah constructor call here in the example code here:

That should print out the URLs that Menorah is fetching data from. You should be able to hit those URLs in your web browser and see JSON data.

When Menorah runs, it should create a working directory with the swarm definition in it. If you see that, please share it.

1 Like

I extracted this code from a predictive application I put together. It predicts 5 time steps ahead and needs a CSV file placed in /tmp/input.csv before it runs. I needed it to be flexible enough to handle any number of input data columns. Iā€™ve tested it and it seems to work well enough. Although, Iā€™d love to get feedback on it from other forum members to learn if there are ways to improve its predictive capabilities.

After swarming over your data to build a model, it loops over the ā€˜input.csvā€™ data and feeds them to the modelā€™s run() method. This code doesnā€™t use the predictions form time-steps 2-5, I omitted the code that calculates statistics on the other time-step predictions, for sake of brevity.

There might be a few errors in the code below, I copied and pasted it in from a larger program. But, I hope itā€™ll be enough to get your started.

2 Likes