Nupic API for multi field Input

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.



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 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.


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

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.