1. Go to this page and download the library: Download devtronic/legendary-mind library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
devtronic / legendary-mind example snippets
use Devtronic\Layerless\Activator\TanHActivator;
use Devtronic\LegendaryMind\Mind;
r = new TanHActivator();
// Instantiate the Mind
$mind = new Mind($topology, $activator);
// Setup XOR Lessons
$lessons = [
[
[0, 0], # Inputs
[0] # Outputs
],
[
[0, 1], # Inputs
[1] # Outputs
],
[
[1, 0], # Inputs
[1] # Outputs
],
[
[1, 1], # Inputs
[0] # Outputs
],
];
// Train the lessons
$mind->train($lessons);
// Setup the check lesson
$test = [1, 0];
$expected = [1];
// Propagate the check lesson
$mind->predict($test);
// Print the Output
print_r($mind->getOutput());
// Backpropagate
$mind->backPropagate($expected);