Import data

Is there any mode to import data for the network not in csv file? For example query on db?

1 Like

Just letting anyone who may be interested in the answer to this, that the question was answered in the Gitter channel earlier.

Here is the conversation for your convenience:


[quote]Hi @dinvi Welcome! In HTM.Java, you can “manually” insert data into an HTM network, so you would have to do a query and then read from that query in your own code - inserting the data as seen here:
But at the moment, there is no way to “directly” point to a DB and have it load the data. If you have a “different” format, you will need to convert the data to a “CSV” format yourself - on-the-fly (line by line as you enter the data), or by pre-processing it before hand.[/quote]


dinvi @dinvi 10:27
Thank’s @cogmission for your help. I have solved insert data as in the example that you linked me!![/quote]


David Ray @cogmission 10:30
You’re very welcome @dinvi! Please let us know if you have any more questions.[/quote]

If you check out Matt’s example sine predictor project (, there’s code in there that could be re-tooled to import directly from a web-service, DB or any other source. Basically, the code just iterates over rows found in the CSV file, and parses them into variables, before calling NuPIC functions to bring them into the model.