PHP-ML is a fresh approach to Machine Learning in PHP. Algorithms, Cross Validation, Preprocessing, Feature Extraction and much more in one library. The library support : Association rule learning, Classification, Regression, Clustering, Metric, Workflow, Neural Network, Cross validation, Preprocessing, Feature extraction, Models management and some Math functions. Datasets supported as Array, CSV and Files. Three predefined datasets are available to be used in the library which are Iris, Wine and Glass.
A simple example of classification:
$samples = [[1, 3], [1, 4], [2, 4], [3, 1], [4, 1], [4, 2]];
$labels = ['a', 'a', 'a', 'b', 'b', 'b'];
$classifier = new KNearestNeighbors();
// return 'b'
Currently the library is still under development, but You can install it with Composer:
composer require php-ai/php-ml