Rumale is a machine learning library in Ruby
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.
Add this line to your application's Gemfile:
gem 'rumale'And then execute:
$ bundleOr install it yourself as:
$ gem install rumaleRumale provides function loading libsvm format dataset file. We start by downloading the pendigits dataset from LIBSVM Data web site.
$ wget https://www.csie.ntu.edu.tw/~cjlin/libsvmtools/datasets/multiclass/pendigits
$ wget https://www.csie.ntu.edu.tw/~cjlin/libsvmtools/datasets/multiclass/pendigits.tTraining 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.
$ ruby train.rb
$ ruby test.rb
Accuracy: 98.5%…Execution of the above scripts result in the following.
$ ruby cross_validation.rb
5-CV mean accuracy: 95.5%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.
$ gem install numo-linalg-altIn ruby script, just load Numo::Linalg along with Rumale.
require 'numo/linalg'
require 'rumale'Several estimators in Rumale support parallel processing. Parallel processing in Rumale is realized by Parallel gem, so install and load it.
$ gem install parallelrequire 'parallel'
require 'rumale'Estimators that support parallel processing have n_jobs parameter. When -1 is given to n_jobs parameter, all processors are used.
estimator = Rumale::Ensemble::RandomForestClassifier.new(n_jobs: -1, random_seed: 1)The gem is available as open source under the terms of the BSD-3-Clause License.
No open issues yet, or sync has not completed.