a1essandro/neural-network 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

a1essandro/neural-network

Composer 安装命令:

composer require a1essandro/neural-network

包简介

Artificial neural network

README 文档

README

Build Status Coverage Status Code Climate Latest Stable Version Latest Unstable Version Total Downloads License

Language choice:

English Russian

Requirements

This package is only supported on PHP 5.5 and above.

Installation

Method #1(recommended): Composer package

See more getcomposer.org.

Execute command

composer require a1essandro/neural-network ^0.1.0

Or add line to composer.json

"require": {
    ...
    "require a1essandro/neural-network": "^0.1.0"
},

Method #2: Clone repository

Execute command

git clone https://github.com/A1essandro/neural-network

Usage

Common

XOR example:

use Neural\BackpropagationTeacher;
use Neural\MultilayerPerceptron;

require_once '../vendor/autoload.php';

//Creation neural network, with 2 input-neurons, one hidden layer with 2 neurons and one output neuron:
$p = new MultilayerPerceptron([2, 2, 1]); //You may add more hidden layers or neurons to layers: [2, 3, 2, 1]
$p->generateSynapses(); //automatically add synapses

$t = new BackpropagationTeacher($p); //Teacher with backpropagation algorithm

//Teach until it learns
$learningResult = $t->teachKit(
    [[1, 0], [0, 1], [1, 1], [0, 0]], //kit for learning
    [[1], [1], [0], [0]], //appropriate expectations 
    0.3, //error
    10000 //max iterations
);

if ($learningResult != -1) {
    echo '1,0: ' . round($p->input([1, 0])->output()[0]) . PHP_EOL;
    echo '0,1: ' . round($p->input([0, 1])->output()[0]) . PHP_EOL;
    echo '0,0: ' . round($p->input([0, 0])->output()[0]) . PHP_EOL;
    echo '1,1: ' . round($p->input([1, 1])->output()[0]) . PHP_EOL;
}

/* Result:
1,0: 1
0,1: 1
0,0: 0
1,1: 0
*/

Manually configuration of network

$p = new MultilayerPerceptron([2, 2, 1]);

//Equivalent to:

$p = new MultilayerPerceptron();
$p->addLayer(new Layer())->toLastLayer()
    ->addNode(new Input())
    ->addNode(new Input())
    ->addNode(new Bias());
$p->addLayer(new Layer())->toLastLayer()
    ->addNode(new Neuron())
    ->addNode(new Neuron())
    ->addNode(new Bias());
$p->addLayer(new Layer())->toLastLayer()
    ->addNode(new Neuron());

//Do not forget to add synapses:

$p->generateSynapses();

//Or you may direct the process:

$neuronFilter = function($node) {
    return $node instanceof Neuron;
};

$secondLayerNeuron = iterator_to_array($p->getLayers()[1]->getNodes($neuronFilter))[0];
$input = iterator_to_array($p->getLayers()[0]->getNodes())[0];
$secondLayerNeuron->addSynapse(new Synapse($input));

//and so on...

Specification

Network

Interface implementation of INetwork is a container comprising nodes (INode) interconnected by synapses (Synapse).

Layers

Interface implementations of ILayer are formal groups of INode in a LayeredNetwork.

Nodes

INode - neurons, input-neurons etc.

Synapses

Synapse - is a connection between two nodes (INode). Synapse gets output (call output()) of neuron-transmitter and convert the value via its weight. Result value gets neuron-reciever (it call output() of ISynapse).

Contribute

Contributions to the package are always welcome!

License

The code base is licensed under the MIT license.

a1essandro/neural-network 适用场景与选型建议

a1essandro/neural-network 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 84 次下载、GitHub Stars 达 10, 最近一次更新时间为 2016 年 04 月 09 日, 在 PHP 生态内属于活跃度较高的组件。

我们在过去多个企业项目中使用过 a1essandro/neural-network 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 a1essandro/neural-network 我们能提供哪些服务?
定制开发 / 二次开发

基于 a1essandro/neural-network 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 84
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 10
  • 点击次数: 16
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 10
  • Watchers: 2
  • Forks: 4
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2016-04-09