Tensorflow Ruby API
medium.com
medium.com
Using tensorflow through its high level API, tf.contrib.learn [1] has been easy enough. Most of the actual work is about shaping data and tweaking hyper parameters (how many layers, how many neurons per layer, how many iterations, etc) which is just changing the value of variables, really.
In order to build my dataset, I use ruby or golang and dump csv files. Tutorial code already shows how to load them in python. The most python I wrote was to figure out how to take a json string from command line argument and decode it, in order to make prediction after the training. This took me like fifteen minutes googling and trying, python is really accessible, especially if you're already used to ruby.
Clearly, I do not recommend to do that for production code, but if you want to play with tensorflow and try to get skilled at vectorizing data and curating dataset (the most important tasks in all of this), you don't need to learn much about python.
I do recommend though to take time and read lessons about neural networks, because you'll need proper knowledge about it to use tensorflow.
[1] https://www.tensorflow.org/versions/r0.9/tutorials/tflearn/i...
But, as encouraging as it is, if your’e thinking about developing a real, production-ready, data science project in ruby - don’t. At least not yet. The libraries around machine learning, neural networks etc are old, unmaintained and usually don’t even work.
Why is this? Are there inherent limitations in the language that has Ruby taking a backseat to Python in ML and maths/statistical applications? Or is it just due to neglect by the community?
(I started leaning ruby about ten months ago and have only just started to gain some proficiency, so I do not know much about the workings of the ecosystem - or the innards of ruby for that matter)
So perhaps less about neglect from the Ruby community, and more proactive-ness from the Python one.
We probably can expect to see implementations in all languages at some point. Floating point errors are not even that a big deal since we're dealing with statistics anyway.
That being said, neural networks are very resource/computation heavy. I wrote one in golang and cut my execution time in half just by encoding my matrices as flat arrays instead of two dimensional arrays. If ruby is to be used to build neural networks, it will need to perform the big work in a binary binding, like tensorflow does with its C++ layer.
My approach thus far has been to write a simple wrapper script around the library (in it's native language) and then do a standard output of the result set in JSON.
Then within Ruby, I just do a `shell`, capture the result and do a JSON parse on the response. It's crude, but works reliably well, I don't have to worry about any bridge libraries supporting the latest language version.