Machine Learning Frameworks for PHP Developers

Written by atulhjindall | Published 2021/05/15
Tech Story Tags: machine-learning | math | rubixml | php | phpml | brainy-php | algorithms | beginners

TLDR PHP has been into market for more than 2 decades and there has been no machine learning with PHP. Now with release of PHP7.2 few options are available to do ML and AI related work. PHP is unusual option for ML, and since its always leaned towards the web application development. PHP could be used to work on small datasets, and PHP could work on data cleanups and feature extractions. RubixML is a high level Machine learning library that offers around 40+ supervised and un-supervised algorithms to solve computer problems.via the TL;DR App

Today Machine learning is Buzz and many of social media groups on software design and engineering are filled with ML, AI, Python, Tensor Flow, NumPy related posts. We all wonder, PHP has been into market for more than 2 decades and there has been no machine learning with PHP. In this article I will cover, some available frameworks for building Machine Learning applications using PHP, lets start with basic understanding of AI.

What is AI?

Artificial Intelligence is a branch of computer science that consists of set of computer programs, making computer think smartly. In simple words, artificial intelligence helps computer to solve the complex problems, in similar fashion human brains perform by learning and understanding problems. Main goal of AI is to help computer systems get advanced and improve with time, through knowledge gained in same way humans encounter problems and build their reasoning, problem solving and self learning capabilities.
In contrast to the traditional programming, where conditional rules are defined explicitly. Machine Learning uses datasets to train the mathematical algorithms, and build their own rules/conditions based on the data sets. Using these rules computer systems perform complex tasks that require some sort of human intelligence. In simple words, machine learning is a branch of computer science combined with mathematics, statistics and probability theory.

PHP libraries for Machine Learning

Most of us are good at developing PHP applications, and been using PHP for majority of web app development. Now with release of PHP7.2 few options are available to do ML and AI related work.

RubixML

RubixML is a high level Machine learning library that offers around 40+ supervised and un-supervised algorithms to solve computer problems.
Rubix ML has wide range of examples available for the developers to learn and understand AI concepts, my favorite example is from housing and real-estate industry. Most of the code examples are available in GitHub repository and can be downloaded free.
To run RubixML examples shared in Git repository, we require latest PHP version no less than 7.2 and also requires sophisticated hardware with 1GB at least dedicated RAM. Machine Performance is the most important factor in executing Machine Learning programs, and PHP being interpreter scripting language, PHP could used to work on small datasets. There is a great talk on performance benchmarks and optmization from the developer of RubixML, you can watch here.
PHP ML
PHP-ML is a library developed to handle Machine learning tasks using PHP, and this library includes ML algorithms as well as data processing APIs that can handle data cleanups and feature extractions.
I agree, for many developers PHP is unusual option for ML, and since its always leaned towards the web application development.
Common examples can be build using php-ml that are AI driven applications that can do simple tasks such as predict spam emails or even predict negative sentiments in reviews and messages through sentiment analysis.
php-ml library does not have wide range of algorithms but includes majority of basic algorithms such as classification, sentiment analysis, neural networks. Applications that are not able to afford cost associated with complex hardware and software development platforms, and only require simple predictions and data analytics php-ml solves the purpose.

Brainy PHP

According to author of Brainy is very basic PHP class to create neural network. This library has been written by developer for web developers, who are beginners of AI and just wish to learn AI concepts, without overhead of learning new languages such as R, Python or other.

Takeaways

Some algorithms and libraries look like very powerful, but their complex system configuration requirements or programming languages can drag projects down. Companies with small teams, some teams don't have machine learning engineers or their engineers with no ML experience. With Php-ml or RubixML learning curve is simple and cost affective as compared to learning complex libraries and algorithms.
As said above, data extraction and processing is the most important aspect of ML and AI applications. Some applications require not Gigabytes yes you heard right its not Gigabytes but instead process petabytes of data and perform intense calculations on these data sets. In the applications that require big data sets, and are require massive computations, PHP is not the right choice. However, for small applications that are using small data sets sized between few Megabytes, then PHP could be used to solve the ML problems.

Written by atulhjindall | Design Awesome Websites and Apps using PHP
Published by HackerNoon on 2021/05/15