Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
R

rumale

> DevOps
Open source

Rumale is a machine learning library in Ruby

914 stars0 likes2 views
WebsiteGitHub

About

Rumale is a machine learning library in Ruby

Rumale

Rumale (Ruby machine learning) is a machine learning library in Ruby. Rumale provides machine learning algorithms with interfaces similar to Scikit-Learn in Python. Rumale supports Support Vector Machine, Logistic Regression, Ridge, Lasso, Multi-layer Perceptron, Naive Bayes, Decision Tree, Gradient Tree Boosting, Random Forest, K-Means, Gaussian Mixture Model, DBSCAN, Spectral Clustering, Mutidimensional Scaling, t-SNE, Fisher Discriminant Analysis, Neighbourhood Component Analysis, Principal Component Analysis, Non-negative Matrix Factorization, and many other algorithms.

Note: Since v2.0.0, Rumale uses Numo::NArray Alternative instead of Numo::NArray as a dependency.

Installation

Add this line to your application's Gemfile:

ruby
gem 'rumale'

And then execute:

$ bundle

Or install it yourself as:

$ gem install rumale

Documentation

  • Rumale API Documentation

Usage

Example 1. Pendigits dataset classification

Rumale provides function loading libsvm format dataset file. We start by downloading the pendigits dataset from LIBSVM Data web site.

bash
$ wget https://www.csie.ntu.edu.tw/~cjlin/libsvmtools/datasets/multiclass/pendigits
$ wget https://www.csie.ntu.edu.tw/~cjlin/libsvmtools/datasets/multiclass/pendigits.t

Training of the classifier with Linear SVM and RBF kernel feature map is the following code.

…

Classifying testing data with the trained classifier is the following code.

…

Execution of the above scripts result in the following.

bash
$ ruby train.rb
$ ruby test.rb
Accuracy: 98.5%

Example 2. Cross-validation

…

Execution of the above scripts result in the following.

bash
$ ruby cross_validation.rb
5-CV mean accuracy: 95.5%

Speedup

Numo::Linalg Alternative

Rumale uses Numo::NArray Alternative for typed arrays. Loading the Numo::Linalg Alterntaive allows to perform matrix and vector product of Numo::NArray Alternative using OpenBLAS libraries. Some machine learning algorithms frequently compute matrix and vector products, the execution speed of such algorithms can be expected to be accelerated.

Install Numo::Linalg Alternative gem.

bash
$ gem install numo-linalg-alt

In ruby script, just load Numo::Linalg along with Rumale.

ruby
require 'numo/linalg'
require 'rumale'

Parallel

Several estimators in Rumale support parallel processing. Parallel processing in Rumale is realized by Parallel gem, so install and load it.

bash
$ gem install parallel
ruby
require 'parallel'
require 'rumale'

Estimators that support parallel processing have n_jobs parameter. When -1 is given to n_jobs parameter, all processors are used.

ruby
estimator = Rumale::Ensemble::RandomForestClassifier.new(n_jobs: -1, random_seed: 1)

Related Projects

  • Rumale::SVM provides support vector machine algorithms in LIBSVM and LIBLINEAR with Rumale interface.
  • Rumale::Torch provides the learning and inference by the neural network defined in torch.rb with Rumale interface.

License

The gem is available as open source under the terms of the BSD-3-Clause License.

Issues· 0 open

View all issuesOpen on GitHub

No open issues yet, or sync has not completed.

> Tags

Rubyartificial-intelligencedata-analysisdata-sciencemachine-learning

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 17, 2026
CategoryDevOps
PricingOpen source

> Related tools

D
Docker
容器化平台,标准化应用交付
G
GitHub Actions
GitHub 原生 CI/CD 工作流
N
Nginx
高性能 Web 服务器与反向代理