stringworld / neuron-fiber

The algorithm of neural net base in javascript

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

neuron based in javascript

neuron-fiber on NPM Build Status

By stone

Getting Started

Follow these steps:

  1. Install
  2. Usage
  3. Algorithm
  4. Review Example Code

Install

$ npm install neuron-fiber --save

Usage

const Perceptron = require('neuron-fiber')
/**
 * input
 */
const x = [
  [0, 0, 1, 0],
  [0, 1, 1, 0],
  [1, 0, 1, 0],
  [1, 1, 1, 0]
]

/**
 * output
 */
const y = [
  [0],
  [0],
  [1],
  [1]
]

/**
 * training times
 */
const times = 1000


/**
 * data ready to predict result
 */
const data=[[1, 1, 1, 1]]


/**
 * begin to train 1000 times
 */
const neuron = new Perceptron(x, y, times)


/**
 * result is predicted
 */
const result = neuron.predict(data)

Algorithm

  • 权重更新算法 W(j)=W(j)+delta W(j)
  • delata W(j)= 学习率 n _ (Y-Y')_ .X(j)
  • 学习率 由 derivSigmoid() 来构建 , 为 sigmoid 的倒数,即斜率

About

The algorithm of neural net base in javascript


Languages

Language:JavaScript 100.0%