Node.js和JS的灵活神经网络库:mind

jopen 9年前

68747470733a2f2f636c6475702e636f6d2f4431795566427a3749752e706e67.png
一个适用于Node.js和浏览器的灵活神经网络库。利用Mind构建的一个电影推荐引擎在线 demo

特性

  • Vectorized - uses a matrix implementation to efficiently process training data
  • Transformable - apply transforms so you can pass in diverse datasets
  • Configurable - allows you to customize the network topology
  • Pluggable - download/upload minds that have already learned

安装

$ npm install node-mind

用法

var Mind = require('node-mind');    /**   * Letters.   *   * - Imagine these # and . represent black and white pixels.   */    var a = character(    '.####.' +    '#....#' +    '#....#' +    '######' +    '#....#' +    '#....#' +    '#....#'  );    var b = character(    '#####.' +    '#....#' +    '#....#' +    '#####.' +    '#....#' +    '#....#' +    '#####.'  );    var c = character(    '######' +    '#.....' +    '#.....' +    '#.....' +    '#.....' +    '#.....' +    '######'  );    /**   * Learn the letters A through C.   */    var mind = Mind()    .learn([      { input: a, output: [ 0.1 ] },      { input: b, output: [ 0.2 ] },      { input: c, output: [ 0.3 ] }    ]);    /**   * Predict the letter C, even with a pixel off.   */    var result = mind.predict(character(    '######' +    '#.....' +    '#.....' +    '#.....' +    '#.....' +    '##....' +    '######'  ));    console.log(result); // ~ 0.3    /**   * Turn the # into 1s and . into 0s.   */    function character(string) {    return string      .trim()      .split('')      .map(integer);      function integer(symbol) {      if ('#' === symbol) return 1;      if ('.' === symbol) return 0;    }  };

项目主页:http://www.open-open.com/lib/view/home/1438160917472