Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Machine learning algorithms in ruby

I'm following the Stanford Machine Learning class with prof. Andrew Ng and I would like to start implementing the examples in ruby.

Are there any frameworks/gems/libs/existing code out there that approaches machine learning in ruby? I have found some questions related to this and some projects but seem to be quite old.

like image 626
fuzzyalej Avatar asked Nov 03 '11 20:11

fuzzyalej


2 Answers

The algorithms themselves are not language specific. You can implement them using any language you want. For maximum efficiency you will want to use matrix/vector based computing.

Ruby has a built in Matrix class that you can use to implement these algorithms. The implementation will be very similar to the one using Octave. Everything you need to implement the algorithms yourself is included in the base Standard Library for 1.9+.

Octave is used because it provides a thorough and easy Matrix library.

like image 197
Kassym Dorsel Avatar answered Oct 03 '22 22:10

Kassym Dorsel


Be sure to check this gist, it has plenty of information:

  • Resources for Machine Learning in Ruby

Moreover, following are some noteworthy algorithms libraries (which might or might not be already listed in the gist above):

  • AI4R

    http://www.ai4r.org/ - https://github.com/SergioFierens/ai4r

    AI4R is a collection of ruby algorithm implementations, covering several Artificial intelligence fields, and simple practical examples using them. A Ruby playground for AI researchers. It implements:

    • Genetic algorithms

    • Self-organized maps (SOM)

    • Neural Networks: Multilayer perceptron with Backpropagation learning, Hopfield net.

    • Automatic classifiers (Machine Learning): ID3 (Decision Trees), PRISM (J. Cendrowska, 1987), Multilayer Perceptron, OneR (AKA One Attribute Rule, 1R), ZeroR, Hyperpipes, Naive Bayes, IB1 (D. Aha, D. Kibler - 1991).

    • Data clustering: K-means, Bisecting k-means, Single linkage, Complete linkage, Average linkage, Weighted Average linkage, Centroid linkage, Median linkage, Ward's method linkage, Diana (Divisive Analysis)

  • kmeans-clusterer - k-means clustering in Ruby:

    https://github.com/gbuesing/kmeans-clusterer

  • kmeans-clustering - A simple Ruby gem for parallelized k-means clustering:

    https://github.com/vaneyckt/kmeans-clustering

  • tlearn-rb - Recurrent Neural Network library for Ruby:

    https://github.com/josephwilk/tlearn-rb

  • TensorFlow Ruby wrapper - As of this writing it seems that work is about to begin in building a TensorFlow Ruby API:

    https://github.com/tensorflow/tensorflow/issues/50#issuecomment-216200945

If JRuby is a viable alternative to Ruby for you:

  • weka-jruby - Machine Learning & Data Mining with JRuby based on the Weka Java library:

    https://github.com/paulgoetze/weka-jruby

  • jruby_mahout - JRuby Mahout is a gem that unleashes the power of Apache Mahout in the world of JRuby:

    https://github.com/vasinov/jruby_mahout


UPDATE: the Resources for Machine Learning in Ruby gist above is now starting to be mantained as a repository: https://github.com/arbox/machine-learning-with-ruby

like image 27
JfredoJ Avatar answered Oct 03 '22 23:10

JfredoJ