Last Updated | | Ratings | | Unique User Downloads | | Download Rankings |
2017-06-25 (1 month ago) | | Not enough user ratings | | Total: 41 This week: 3 | | All time: 8,925 This week: 249 |
|
Description | | Author |
This package can assemble and process layerless neural networks.
It can assemble different types of neurons with initial values and connect them using synapses.
It can also use the back propagate algorithm to adjust neuron weights by setting target values on the output neurons and recheck the values again. | |
|
Details
Layerless
Layerless is the new foundation of the legendary mind neural network project
Installation
composer require devtronic/layerless
Usage
<?php
// Import the SinusActivator as Activator
use Devtronic\Layerless\Activator\SinusActivator as Activator;
use Devtronic\Layerless\BiasNeuron;
use Devtronic\Layerless\InputNeuron;
use Devtronic\Layerless\Neuron;
use Devtronic\Layerless\Synapse;
// Load Composer autoload
require_once __DIR__ . '/vendor/autoload.php';
// Create the activator
$activator = new Activator();
// Create 2 Input Neurons and 1 Bias Neuron
$inputA = new InputNeuron(1);
$inputB = new InputNeuron(0);
$bias = new BiasNeuron(1);
// Create 1 Output Neuron
$output = new Neuron($activator);
// Connect the neurons
new Synapse(0.90, $inputA, $output);
new Synapse(0.23, $inputB, $output);
new Synapse(0.50, $bias, $output);
// Activate the neurons
$inputA->activate();
$inputB->activate();
$output->activate();
echo $output->getOutput() . PHP_EOL; // 0.98545
// Back propagate
$target = 0;
$output->calculateDelta($target);
$inputA->calculateDelta();
$inputB->calculateDelta();
$learningRate = 0.2;
$output->updateWeights($learningRate);
$inputA->updateWeights($learningRate);
$inputB->updateWeights($learningRate);
// Re-Check
$inputA->activate();
$inputB->activate();
$output->activate();
echo $output->getOutput() . PHP_EOL; // 0.92545
|
Applications that use this package |
|
No pages of applications that use this class were specified.
If you know an application of this package, send a message to the author to add a link here.