• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

infers: Machine learning and Matrix operation library by TypeScript.

原作者: [db:作者] 来自: 网络 收藏 邀请

开源软件名称:

infers

开源软件地址:

https://gitee.com/hans_s/infers

开源软件介绍:

infers

Machine learning and Matrix operation library by TypeScript.

Installed

Make sure NPM is installed, Switch to the project directory then execute the following command.

$ npm install infers@latest

Reference in project:

import { Matrix, BPNet } from 'infers'

Examples

Matrix transpose:

let m = new Matrix([  [1, 5, 0],  [2, 4 , -1],  [0, -2, 0]])m.T.print()// Matrix 3x3 [//  1, 2, 0, //  5, 4, -2, //  0, -1, 0, // ]

BP neural network example of XOR, three-layer network:

let xs = new Matrix([[1, 0], [0, 1], [0, 0], [1, 1]])let ys = new Matrix([[1], [1], [0], [0]])let model = new BPNet([2, [6, 'Tanh'], [1, 'Sigmoid']], { rate: 0.1 })model.fit(xs, ys, {  epochs: 5000, onEpoch: (epoch, loss) => {    if (epoch % 100 === 0) console.log('epoch:' + epoch, 'loss:', loss)  }})model.predict(xs).print()// Matrix 4x1 [//  0.9862025352830867, //  0.986128496195502, //  0.01443800549676924, //  0.014425871504885788, // ]

BP neural network example of addition, four-layer network:

let xs = new Matrix([[1, 4], [3, 2], [6, 5], [4, 7]])let ys = new Matrix([[5], [5], [11], [11]])let model = new BPNet([2, 6, 6, 1], { mode: 'bgd', rate: 0.01 })model.fit(xs, ys, {  epochs: 500, onEpoch: (epoch, loss) => {    console.log('epoch:' + epoch, 'loss:', loss)  }})let xs2 = new Matrix([[5, 8], [22, 6], [-5, 9], [-5, -4]])model.predict(xs2).print()// Matrix 4x1 [//  12.994745740521667, //  27.99134620596921, //  3.9987224114576856, //  -9.000000644547901,// ]

RNN: Recurrent neural network example:

let trainData = ['hello rnn', 'good morning', 'I love  

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
webvr-demo: A simple demo use WebVR API with pure webGL.发布时间:2022-03-24
下一篇:
parser: Ascend CANN Parser发布时间:2022-03-24
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap