Skip to content

Instantly share code, notes, and snippets.

Last active February 28, 2024 15:13
Show Gist options
  • Save gbuesing/865b814d312f46775cda to your computer and use it in GitHub Desktop.
Save gbuesing/865b814d312f46775cda to your computer and use it in GitHub Desktop.
Resources for Machine Learning in Ruby

UPDATE a fork of this gist has been used as a starting point for a community-maintained "awesome" list: machine-learning-with-ruby Please look here for the most up-to-date info!

Resources for Machine Learning in Ruby


  • liblinear-ruby: Ruby interface to LIBLINEAR using SWIG

  • classifier-reborn: Bayesian and LSI classification
    dependencies: GSL

  • categorize: Categorize is a text categorization library written in Ruby. It prioritizes performance over accuracy and is built to run online in dynamic web services

  • decisiontree: ID3-based implementation of the ML Decision Tree algorithm
    dependencies: Graphviz

  • similarity: Calculate similarity between documents using TF-IDF weights
    dependencies: GSL

  • rb-libsvm: Ruby language bindings for LIBSVM
    dependencies: None (LIBSVM is bundled with the project)

  • ruby-fann: Ruby library for interfacing with FANN (Fast Artificial Neural Network)
    dependencies: None (FANN is bundled with the project)

  • tlearn-rb: Recurrent Neural Network library for Ruby

  • kmeans-clusterer: k-means clustering in Ruby

  • k_means: Attempting to build a fast, memory efficient K-Means program

  • knn: Simple K Nearest Neighbour Algorithm

  • distance_measures: A bunch of distance measures that extend Array

  • fast-stemmer: Fast Porter stemmer based on a C version of the algorithm

  • statsample: A suite for basic and advanced statistics on Ruby
    dependencies: GSL

  • statistics2: Provides normal, Chi-square, t- and F- probability distributions for Ruby

  • ruby-graphviz
    dependencies: Graphviz

  • gnuplot
    dependencies: Gnuplot

  • rb-gsl: Ruby interface to the GNU Scientific Library
    dependencies: GSL

  • ruby-opencv: OpenCV wrapper for Ruby
    dependencies: OpenCV

  • ai4r: Artificial Intelligence for Ruby - A Ruby playground for AI researchers

  • algorithms: Ruby algorithms and data structures. C extensions

  • phashion: Ruby wrapper around pHash, the perceptual hash library for detecting duplicate multimedia files
    dependencies: ImageMagick, libjpeg

  • narray: Ruby/NArray : N-dimensional Numerical Array for Ruby

  • kdtree a blazingly fast, native, 2d kdtree

  • rinruby: integrates the R interpreter in Ruby, making R's statistical routines and graphics available within Ruby
    dependencies: R

  • octave-ruby A Ruby interface to the Octave interpreted language
    dependencies: Octave

  • flann: Fast Library for Approximate Nearest Neighbors dependencies: flann

  • NMatrix: Dense and sparse linear algebra library for Ruby via SciRuby

  • Cerebrum: Artificial Neural Networks in Ruby

  • PCA: Principal component analysis (PCA) in Ruby

  • neural-net-ruby: A neural network, written in Ruby

Base dependencies

Heroku buildpacks

Other resources

Copy link

stympy commented May 5, 2016

You might like my presentation from MountainWest RubyConf on this topic:

Slides are here:

Copy link

translunar commented May 5, 2016

What about NMatrix? (I also note that you have several SciRuby projects listed but not SciRuby itself.)

Copy link

worked on this before, might be of interest. very similar to some of the other projects listed.

Copy link

gbuesing commented May 6, 2016

Thanks for the links -- updated the gist.

Copy link

illtellyoulater commented May 6, 2016

Hi, do you think it could be good to add (density-based spatial clustering)?
I am not a ML guru, but I saw DBSCAN often recommended among clustering algorithms (nice comparison of some clustering algos at however I do not have the expertise to judge the goodness of the Ruby implementation and it has not been updated for some time. I have only just started using it in a tiny experiment, so I really can't really tell more than that.

On a side note GSoC rejected a project for implementing a Ruby API for the popular TensorFlow library, but initial steps are being made for privately founding it. You can see discussion here: tensorflow/tensorflow#50 (comment). Maybe it could be helpful to have this listed here too, in order to drag even more people and attention to that, given the importance of that library. That's all :)

Copy link

illtellyoulater commented May 8, 2016

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

Copy link

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

Copy link

v0dro commented May 12, 2016

SciRuby's working on writing a Ruby wrapper over TensorFlow. We've put out a call for proposals here:

Copy link

giuse commented May 28, 2016

Hello, new-kid-on-the-block here. I recently started publishing a gem (neuroevo, porting my research in neuroevolution (evolving neural networks with evolutionary algorithms) to Ruby.
It'll take a while to complete (I've been at it for over 7 years), but it's already usable. I am looking for feedback and directions, anybody interested feel free to drop me a line.

Specs fitting XOR ([2,2,1] network, 15 generations):

Oh BTW, thanks for the gist! :) I used it first to search if what I am doing was already out there (unfortunately doesn't seem so), then to find the tools I needed (both for the gem and for the larger projects I am currently using it on). 🍺 owed

Copy link

@gbuesing could you update this with Tensor Flow, libraries mentioned in other comments and new libs that might have been released since last edit (if there's any you are aware of) ? Thanks!

Copy link

arbox commented Apr 20, 2017

As discussed via email with @gbuesing I forked this Gist and I'm trying to convert it to an Awesome List "Machine Learning with Ruby".
Everybody is welcome to collaborate!
ML with Ruby:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment