Are there any machine learning libraries for Ruby that are relatively complete (including a wide variety of algorithms for supervised and unsupervised learning), robustly tested, and well-documented? I love Python's scikit-learn for its incredible documentation, but a client would prefer to write the code in Ruby since that's what they're familiar with.

Ideally I am looking for a library or set of libraries which, like scikit and numpy, can implement a wide variety of data structures like sparse matrices, as well as learners.

Some examples of things we'll need to do are binary classification using SVMs, and implementing bag of words models which we hope to concatenate with arbitrary numeric data, as described in this StackOverflow post.

  • $\begingroup$ I would be interested to know where this sits, too, as currently I feel obliged to learn Python, R and Octave, just so I have access for tools for a hobby (whilst I know Ruby for professional reasons). I don't know enough about it to suggest an answer, but have known about sciruby.com for a while. My gut feel is that it is not ready yet $\endgroup$ Sep 9, 2014 at 9:29
  • $\begingroup$ Yeah, we took a look at sciruby, and while it looks nice, it seems limited to providing some data structures and linear algebra operations. If someone were to build a unified ML library for Ruby it would probably be a great basis for that. $\endgroup$
    – the911s
    Sep 9, 2014 at 16:59

1 Answer 1


I'll go ahead and post an answer for now; if someone has something better I'll accept theirs.

At this point the most powerful option appears to be accessing WEKA using jRuby. We spent yesterday scouring the 'net, and this combination was even used by a talk at RailsConf 2012, so I would guess if there were a comparable pure ruby package, they would have used it.

Note that if you know exactly what you need, there are plenty of individual libraries that either wrap standalone packages like libsvm or re-implement some individual algorithms like Naive Bayes in pure Ruby and will spare you from using jRuby.

But for a general-purpose library, WEKA and jRuby seem to be the best bet at this time.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.