nikhilk / node-tensorflow

Node.js + TensorFlow
Apache License 2.0
587 stars 59 forks source link

Clarification capabilities/future plan #24

Closed glennfu closed 6 years ago

glennfu commented 6 years ago

Sorry if this format is inappropriate, but I couldn't think of a better place to ask my question. I'm contributing to a node.js app, and data comes through that I'm feeding to a ConvNetJS network. I have 7 floats for inputs, and I request 1 output. In the simplest form, I'm asking for it to predict > 0 or < 0. It works fairly well, but I'm looking for alternatives seeing as how ConvNetJS hasn't been updated in many years. TensorFlow sounds like a perfect alternative, but I am definitely locked into a solution that works in node.js. I noticed in #13 you mentioned you weren't going to focus on the training aspect of TF. However, for my needs, all the data needed for training comes through the node.js app.

So my question is, will this project be appropriate for me? I'm not already familiar with how exactly to use TensorFlow, so maybe there's still a way this project can be used that I'm just not understanding. Thanks!

nikhilk commented 6 years ago

As long as you can build a TensorFlow graph, you can certainly feed data into it, and run the train operation each time you call session.run(), thereby ending up training a model (and then later saving out learnt weights etc). In a sense, training in TensorFlow is also accomplished by executing ops.

While possible to build a graph in node.js (not yet implemented here), and then train it in script, you're side-stepping all the Python framework functionality. This might be something to look into to see if its better/feasible to use Python: https://www.tensorflow.org/tutorials/deep_cnn

For example, you might do this to do batch training, and then if I understand your use-case right, have the node.js app load the graph, and trained weights and incrementally update the model as new data arrives.

The current samples demonstrate how you can build a graph in Python, and then bring it into node.js. I haven't yet built the sample that shows how to feed in tensors in a call to session.run, but that is forthcoming.

Hope that provides some more thoughts to help take your search further.