PHP Machine Learning library
Go to file
Jonathan Baldie e318921076 Fix string representation of integer labels issue in NaiveBayes (#206)
* Update NaiveBayes.php

This fixes an issue using string labels that are string representations of integers, e.g. "1998" getting cast to (int)1998.

* Update NaiveBayes.php

fixes superfluous whitespace error

* added tests for naive bayes with numeric labels

* added array_unique

* nested array_flips for speed

* nested the array flips inside the array map

* to appear style CI test
2018-01-31 21:44:44 +01:00
bin Add support for coveralls.io (#153) 2017-11-15 11:08:51 +01:00
data add glass identification dataset 2016-04-09 15:46:54 +02:00
docs Fix documentation of ClassificationReport (#209) 2018-01-31 19:20:50 +01:00
src/Phpml Fix string representation of integer labels issue in NaiveBayes (#206) 2018-01-31 21:44:44 +01:00
tests/Phpml Fix string representation of integer labels issue in NaiveBayes (#206) 2018-01-31 21:44:44 +01:00
var start to implement SVM with libsvm 2016-05-05 23:29:11 +02:00
.gitignore Update dev dependencies (#187) 2018-01-06 21:25:47 +01:00
.travis.yml Fix: Option --dev has been deprecated (#213) 2018-01-31 19:33:57 +01:00
CHANGELOG.md Update changelog (#152) 2017-11-14 21:40:46 +01:00
composer.json Normalize composer.json with localheinz/json-normalizer (#214) 2018-01-31 20:06:51 +01:00
composer.lock Enhancement: Keep packages sorted in composer.json (#210) 2018-01-31 19:25:22 +01:00
CONTRIBUTING.md Add PHPStan and level to max (#168) 2018-01-06 13:09:33 +01:00
easy-coding-standard.neon Update dev dependencies (#187) 2018-01-06 21:25:47 +01:00
LICENSE Update license year (#183) 2018-01-07 10:57:14 +01:00
mkdocs.yml Neural networks improvements (#89) 2017-05-18 00:07:14 +02:00
phpstan.neon Update dev dependencies (#187) 2018-01-06 21:25:47 +01:00
phpunit.xml Fix: Use enforceTimeLimit instead of beStrictAboutTestSize (#212) 2018-01-31 19:32:18 +01:00
README.md Update README.md (#181) 2018-01-06 11:12:42 +01:00

PHP-ML - Machine Learning library for PHP

Minimum PHP Version Latest Stable Version Build Status Documentation Status Total Downloads License Coverage Status 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.

PHP-ML requires PHP >= 7.1.

Simple example of classification:

require_once __DIR__ . '/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.

Installation

Currently this library is in the process of being developed, but You can install it with Composer:

composer require php-ai/php-ml

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)