Skip to content

atompulse/php-ml-56

 
 

Repository files navigation

PHP-ML - Machine Learning library for PHP

Minimum PHP Version Latest Stable Version Build Status Documentation Status Total Downloads License Scrutinizer Code Quality

PHP-ML - Machine Learning library for PHP

Fresh approach to Machine Learning in PHP. Algorithms, Cross Validation, Neural Network, Preprocessing, Feature Extraction and much more in one library.

This version of PHP-ML requires PHP 5.6

The code is transpiled using (https://github.com/spatie/7to5)

  • Why do this? This package is amazing and I believe there is no reason why should not be available also for php 5.6
  • How to install
  • Add to composer as:
"php-ai/php-ml": "dev-master"
  • Add Repository of type VCS in your composer:
  "repositories": [
    {
      "type": "vcs",
      "url": "https://github.com/atompulse/php-ml-56",
      "no-api": true
    }
  ],

Simple example of classification:

require_once 'vendor/autoload.php';

use Phpml\Classification\KNearestNeighbors;

$samples = [[1, 3], [1, 4], [2, 4], [3, 1], [4, 1], [4, 2]];
$labels = ['a', 'a', 'a', 'b', 'b', 'b'];

$classifier = new KNearestNeighbors();
$classifier->train($samples, $labels);

echo $classifier->predict([3, 2]);
// return 'b'

Documentation

To find out how to use PHP-ML follow Documentation.

Examples

Example scripts are available in a separate repository php-ai/php-ml-examples.

Features

Contribute

You can find more about contributing in CONTRIBUTING.md.

License

PHP-ML is released under the MIT Licence. See the bundled LICENSE file for details.

Author

Arkadiusz Kondas (@ArkadiuszKondas)

About

PHP-ML - Machine Learning library for PHP

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • PHP 100.0%