brucetruth/ml-idea

A Machine Learning library for PHP

dev-master 2021-05-16 09:45 UTC

This package is auto-updated.

Last update: 2024-05-16 16:17:00 UTC


README

Minimum PHP Version GitHub issues GitHub license

The World is filled with Data, a lot of data [pictures, videos, text, music,... ] Machine learning provides means of deriving meaning from all of that data. Today not only is the data generated by people but also by phones, computers and other devices, the data is and will rapidly continue to grow. Machine learning will enable us to use this data to answer questions

Using data which will is traning, as we will inform the creation of the predictive model, and then this predictive model can then be used on unseen data to answer questions.

Machine learning uses algorithms to parse data, learn from that data, and make informed decisions based on what it has learned. Deep learning structures algorithms in layers to create an “artificial neural network” that can learn and make intelligent decisions on its own.

Installation

Install ML IDEA into your project using Composer:

$ composer require brucetruth/ml-idea

Requirements

  • PHP 7.4 or above

Classification algorithms examples

KNearestNegbours

include_once "vendor/autoload.php";

use ML\IDEA\Classifiers\KNearestNeighbors;

$samples = [[1, 3], [1, 4], [3, 4], [3, 1], [5, 1], [5, 2]];
$labels = ['a', 'a', 'b', 'b', 'c', 'c'];
$classifier = new KNearestNeighbors(6, true);
$classifier->train($samples, $labels);
$data = $classifier->predict([5, 3]);
echo "<pre>";
print_r($data);
echo "</pre>";