gheb/nn

There is no license information available for the latest version (dev-master) of this package.

NeuralNetwork

Installs: 5

Dependents: 0

Suggesters: 0

Security: 0

Stars: 10

Watchers: 3

Forks: 3

Open Issues: 0

Type:project

dev-master 2019-11-18 13:30 UTC

This package is auto-updated.

Last update: 2024-04-18 23:04:56 UTC


README

This repository purpose is to provide a toy for Machine Learning around the SymfonyLive Paris 2018 and SymfonyCon Amsterdam 2019

prerequisite

Installation

composer install

Usage

php example.php
<?php
// example.php

require_once 'vendor/autoload.php';

use nn\NeuralNetwork;

$nn = new NeuralNetwork(1, 3, 1);

$training_data = [
    [[0], [0]],
    [[1], [0]],
    [[2], [0]],
    [[3], [0]],
    [[4], [0]],
    [[5], [0]],
    [[6], [1]],
    [[7], [1]],
    [[8], [1]],
    [[9], [1]],
    [[10], [1]],
];

for ($i = 0; $i < 200; ++$i) {
    foreach ($training_data as $data) {
        $nn->train(...$data);
    }
}

var_dump($nn->feedForward([2]));
var_dump($nn->feedForward([8]));

Have fun :)