Codementor Events

Introduction to Rubix ML: A PHP Machine Learning Library

Published Jul 09, 2021
Introduction to Rubix ML: A PHP Machine Learning Library

Introduction

If your are a PHP developer or you are looking for a friendly and delightful library you can use to build applications that learn from your data you should seriously consider Rubix ML.

In this post you will get an overview of the Rubix ML library and useful references of where you can learn more.

What is Rubix ML?

Rubix ML is a high-level machine learning and deep learning library for the PHP language that includes implementations of several machine learning algorithms, so you can define a model object in a single line or a few lines of code, then use it to fit a set of points or predict a value. It is Open source and free to use commercially.

What are the features?

The library provides tools for the entire machine learning life cycle from ETL (extracting, transforming, loading, manipulating and summarising data) to training, cross-validation, and production with over 40 supervised and unsupervised learning algorithms.
A number of algorithms in the library support Deep Learning including the Multilayer Perceptron classifier and MLP Regressor.

Where did it come from?

Rubix ML was created by Andrew DalPino a ML Engineer and software Architect. The project now has more than 20 active contributors.

Example: Iris Flower Classifier

Let me give you an example to show you how easy it is to use the library.

In this example, we train a K Nearest Neighbors (KNN) classifier to determine the species of Iris flower from a set of unknown test samples using the Iris dataset.
iris-species.png

use Rubix\ML\Datasets\Labeled;
use Rubix\ML\Extractors\NDJSON;
use Rubix\ML\Classifiers\KNearestNeighbors;
use Rubix\ML\CrossValidation\Metrics\Accuracy;

echo 'Loading data into memory ...' . PHP_EOL;

$training = Labeled::fromIterator(new NDJSON('dataset.ndjson'));

$testing = $training->randomize()->take(10);

$estimator = new KNearestNeighbors(5);

echo 'Training ...' . PHP_EOL;

$estimator->train($training);

echo 'Making predictions ...' . PHP_EOL;

$predictions = $estimator->predict($testing);

echo 'Example predictions:' . PHP_EOL;

print_r(array_slice($predictions, 0, 3));

$metric = new Accuracy();

$score = $metric->score($predictions, $testing->labels());

echo 'Accuracy is ' . (string) ($score * 100.0) . '%' . PHP_EOL;

Check out this full code,comes with instructions and a pre-cleaned dataset.

Ecosystem

Rubix ML provides a library extension Tensor to accelerate the performance and Server for the deployment of your trained model in production.

Resources

If you are interested in learning more, checkout the Rubix ML homepage that includes documentation and related resources. You can get the code from the github repository

Documentation

I recommend starting out with the basic introduction for a brief look at a typical Rubix ML project if you are already familiar with basic ML concepts or if not I recommend taking a look at the What is Machine Learning?

Example Gallery. Most come with instructions and a pre-cleaned dataset:

Conclusion

Rubix ML makes it very easy for you to do machine learning using the PHP programming language. It provides tools for the entire machine learning life cycle from ETL to training, cross-validation, and production.

Discover and read more posts from Manasse Ngudia
get started
post comments3Replies
azure trainings
4 months ago

I appreciate you sharing. This is a fantastic website with a tone of insightful and helpful entire…

<a href=“https://azuretrainings.in/azure-data-factory-training-in-hyderabad/”>azuretrainings.in/azure-data-factory-training-in-hyderabad/</a>

jaya priya
8 months ago

nice blog
<a href=“https://innovatetechnologies.co.in/our-courses/full-stack-development/”>full stack course in chennai</a>

<a href=“https://innovatetechnologies.co.in/our-courses/full-stack-development/”>full stack developer course in chennai</a>

<a href=“https://innovatetechnologies.co.in/our-courses/full-stack-development/”>full stack training course in chennai</a

manu kutti
3 years ago

Thanks for sharing such informative news.
Become Data science expert with Innomatics where you get a great experience and better knowledge.
<a href=“https://www.innomatics.in/advanced-data-science-training-in-hyderabad/”>Data Science course training in hyderabad</a>