## php-ml-用于php的机器学习库 - QQ交流群:231201376
[](https://php.net/)[](https://packagist.org/packages/php-ai/php-ml)[](https://travis-ci.org/php-ai/php-ml)[](http://php-ml.readthedocs.org/)[](https://packagist.org/packages/php-ai/php-ml)[](https://packagist.org/packages/php-ai/php-ml)[](https://coveralls.io/github/php-ai/php-ml?branch=master)[](https://scrutinizer-ci.com/g/php-ai/php-ml/?branch=master)

用PHP机器学习的新方法。算法、交叉验证、神经网络、预处理、特征提取等。
`PHP-ML requires PHP >= 7.1`
*****
分类的简单示例:
```
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);
$classifier->predict([3, 2]);
// return 'b'
```
*****
### 安装
当前正在开发此库,但您可以使用`composer`安装它:
```
composer require php-ai/php-ml
```
*****
### 示例
示例脚本在单独的存储库[php ai/php ml示例](https://github.com/php-ai/php-ml-examples)中。
*****
### 开源许可
PHP-ML 发布于 MIT Licence. 详情请见许可文件