멋진 커뮤니티 모듈

시냅스빌드 상태 https://synapticjs.slack.com에서 채팅에 참여하세요.

중요: Synaptic 2.x는 현재 논의 단계에 있습니다! 자유롭게 참여해 주세요.

Synaptic은 node.js브라우저 용 자바스크립트 신경망 라이브러리입니다 . 일반화된 알고리즘은 아키텍처가 없으므로 기본적으로 모든 유형의 1차 또는 2차 신경망 아키텍처를 구축하고 훈련할 수 있습니다.

이 라이브러리에는 다층 퍼셉트론 , 다층 장단기 기억 네트워크(LSTM), 액체 상태 기계 또는 Hopfield 네트워크와 같은 몇 가지 내장 아키텍처와 기본 제공 훈련 작업/테스트를 포함하여 특정 네트워크를 훈련할 수 있는 트레이너가 포함되어 있습니다. XOR 해결, Distracted Sequence Recall 작업 완료 또는 Embedded Reber Grammar 테스트 등을 통해 다양한 아키텍처의 성능을 쉽게 테스트하고 비교할 수 있습니다.

이 라이브러리에 의해 구현된 알고리즘은 Derek D. Monner의 논문에서 가져왔습니다.

2차 순환 신경망을 위한 일반화된 LSTM 유사 훈련 알고리즘

소스 코드를 통해 주석이 달린 해당 논문의 방정식에 대한 참조가 있습니다.

소개

신경망에 대한 사전 지식이 없다면 이 가이드를 읽어보는 것부터 시작해야 합니다 .

신경망에 데이터를 공급하는 방법에 대한 실제적인 예를 원한다면 이 기사를 살펴보십시오 .

당신은 또한 이 기사를 살펴보고 싶을 수도 있습니다 .

시민

이러한 데모의 소스 코드는 이 분기 에서 찾을 수 있습니다 .

시작하기

예제를 시험해 보려면 gh-pages 분기를 확인하세요.

git checkout gh-pages

다른 언어

이 README는 다른 언어로도 제공됩니다.

개요

Installation

노드 내

npm을 사용하여 시냅틱을 설치할 수 있습니다 .

1
npm install synaptic --save
브라우저에서

Bower를 사용하여 시냅틱을 설치할 수 있습니다 .

1
bower install synaptic

또는 CDNjs 에서 친절하게 제공하는 CDN 링크를 사용할 수도 있습니다.

1
<script src="https://cdnjs.cloudflare.com/ajax/libs/synaptic/1.1.4/synaptic.js"></script>

Usage

1 2 3 4 5 6
var synaptic = require('synaptic'); // this line is not needed in the browser var Neuron = synaptic.Neuron, Layer = synaptic.Layer, Network = synaptic.Network, Trainer = synaptic.Trainer, Architect = synaptic.Architect;

이제 네트워크 생성, 훈련 또는 Architect 의 내장 네트워크 사용을 시작할 수 있습니다 .

Examples

퍼셉트론

간단한 퍼셉트론을 만드는 방법은 다음과 같습니다 .

퍼셉트론.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
function Perceptron(input, hidden, output) { // create the layers var inputLayer = new Layer(input); var hiddenLayer = new Layer(hidden); var outputLayer = new Layer(output); // connect the layers inputLayer.project(hiddenLayer); hiddenLayer.project(outputLayer); // set the layers this.set({ input: inputLayer, hidden: [hiddenLayer], output: outputLayer }); } // extend the prototype chain Perceptron.prototype = new Network(); Perceptron.prototype.constructor = Perceptron;

이제 트레이너를 만들고 퍼셉트론에 XOR 학습을 가르쳐서 새 네트워크를 테스트할 수 있습니다.

1 2 3 4 5 6 7 8 9
var myPerceptron = new Perceptron(2,3,1); var myTrainer = new Trainer(myPerceptron); myTrainer.XOR(); // { error: 0.004998819355993572, iterations: 21871, time: 356 } myPerceptron.activate([0,0]); // 0.0268581547421616 myPerceptron.activate([1,0]); // 0.9829673642853368 myPerceptron.activate([0,1]); // 0.9831714267395621 myPerceptron.activate([1,1]); // 0.02128894618097928
장단기 기억

입력 게이트, 망각 게이트, 출력 게이트 및 핍홀 연결을 사용하여 간단한 장단기 기억 네트워크를 만드는 방법은 다음과 같습니다 .

장단기 기억

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46
function LSTM(input, blocks, output) { // create the layers var inputLayer = new Layer(input); var inputGate = new Layer(blocks); var forgetGate = new Layer(blocks); var memoryCell = new Layer(blocks); var outputGate = new Layer(blocks); var outputLayer = new Layer(output); // connections from input layer var input = inputLayer.project(memoryCell); inputLayer.project(inputGate); inputLayer.project(forgetGate); inputLayer.project(outputGate); // connections from memory cell var output = memoryCell.project(outputLayer); // self-connection var self = memoryCell.project(memoryCell); // peepholes memoryCell.project(inputGate); memoryCell.project(forgetGate); memoryCell.project(outputGate); // gates inputGate.gate(input, Layer.gateType.INPUT); forgetGate.gate(self, Layer.gateType.ONE_TO_ONE); outputGate.gate(output, Layer.gateType.OUTPUT); // input to output direct connection inputLayer.project(outputLayer); // set the layers of the neural network this.set({ input: inputLayer, hidden: [inputGate, forgetGate, memoryCell, outputGate], output: outputLayer }); } // extend the prototype chain LSTM.prototype = new Network(); LSTM.prototype.constructor = LSTM;

이는 설명을 위한 예이며, Architect에는 이미 Multilayer Perceptron 및 Multilayer LSTM 네트워크 아키텍처가 포함되어 있습니다.

기여하다

Synaptic 은 아르헨티나 부에노스아이레스에서 시작된 오픈소스 프로젝트로, 전 세계 누구나 ​​프로젝트 개발에 기여할 수 있습니다.

기여하고 싶다면 자유롭게 PR을 보내세요. 제출하기 전에 npm run testnpm run build를 실행하세요 . 이렇게 하면 모든 테스트 사양을 실행하고 웹 배포 파일을 빌드할 수 있습니다.

지원하다

이 프로젝트가 마음에 들고 지지를 표하고 싶다면 마법의 인터넷 머니 로 맥주 한 잔 사주세요 .

1 2 3 4
BTC: 16ePagGBbHfm2d6esjMXcUBTNgqpnLWNeK ETH: 0xa423bfe9db2dc125dd3b56f215e09658491cc556 LTC: LeeemeZj6YL6pkTTtEGHFD6idDxHBF2HXa XMR: 46WNbmwXpYxiBpkbHjAgjC65cyzAxtaaBQjcGpAZquhBKw2r8NtPQniEgMJcwFMCZzSBrEJtmPsTR54MoGBDbjTi2W1XmgM

<3