Ruby ML for Python Coders

Python and Ruby

Curious to try machine learning in Ruby? Here’s a short cheatsheet for Python coders.

Data structure basics

Libraries

Category Python Ruby
Multi-dimensional arrays NumPy Numo
Data frames Pandas Daru
Visualization Matplotlib Nyaplot
Predictive modeling Scikit-learn Rumale
Gradient boosting XGBoost, LightGBM XGBoost, LightGBM
Deep learning PyTorch, TensorFlow Torch-rb, TensorFlow (TensorFlow construction)
Recommendations Surprise, Implicit Disco
Approximate nearest neighbors NGT, Faiss, Annoy NGT, Faiss, Hanny
Factorization machines xLearn xLearn
Natural language processing spaCy, NTLK Many gems (nothing comprehensive cry)
Text tokenization Bling Fire, YouTokenToMe Bling Fire, YouTokenToMe
Text classification fastText fastText
Forecasting Prophet cry
Optimization OR-Tools, CVXPY, PuLP, SCS, OSQP OR-Tools, CBC, SCS, OSQP
Reinforcement learning Vowpal Wabbit Vowpal Wabbit
t-SNE Multicore t-SNE t-SNE
Scoring engine ONNX Runtime ONNX Runtime, Menoh

This list is by no means comprehensive. Some Ruby libraries are ones I created, as mentioned here.

If you’re planning to add Ruby support to your ML library:

Category Python Ruby
FFI (native) ctypes Fiddle
FFI (library) cffi FFI
C++ extensions pybind11 Rice
Compile to C Cython Rubex

Give Ruby a shot for your next maching learning project!

Updates

Published January 23, 2020 · Tweet

Ruby logo is licensed under CC BY-SA 2.5.


You might also enjoy

16 New ML Gems for Ruby

Gem Patterns

Numo: NumPy for Ruby


All code examples are public domain.
Use them however you’d like (licensed under CC0).