Top Banner
NodeDeep Learning Feb 26, 2014 佐々木 (Kai Sasaki)
34

Deeplearning with node

Jun 14, 2015

Download

Technology

Kai Sasaki

Slide used on Tokyo Node academy no.11
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Deeplearning with node

NodeでDeep LearningFeb 26, 2014

佐々木 海(Kai Sasaki)

Page 2: Deeplearning with node

自己紹介佐々木 海(@Lewuathe)

Node歴 2年

社内PaaS

mailとかPush通知とか

Tessel買った

Page 3: Deeplearning with node

Deep Learning?

Page 4: Deeplearning with node

Deep Learning?機械学習アルゴリズムの一つ

Page 5: Deeplearning with node

Deep Learning?機械学習アルゴリズムの一つニューラルネットワーク

Page 6: Deeplearning with node

Deep Learning?機械学習アルゴリズムの一つニューラルネットワークここ数年コンテストなどで良い成績

Page 7: Deeplearning with node

は!?

Page 8: Deeplearning with node

Newron

Page 9: Deeplearning with node

入力

Page 10: Deeplearning with node

入力

計算

Page 11: Deeplearning with node

入力

計算

出力

Page 12: Deeplearning with node

これをモデル化

Page 13: Deeplearning with node

入力

計算

出力

Page 14: Deeplearning with node

計算

Page 15: Deeplearning with node

計算

犬だ!

Page 16: Deeplearning with node

万能近似器

Page 17: Deeplearning with node

実装しました

Page 18: Deeplearning with node

n42

Page 19: Deeplearning with node

まず入力データを用意

var input = $M([! [1.0, 1.0, 0.0, 0.0],! [1.0, 1.0, 0.2, 0.0],! [1.0, 0.9, 0.1, 0.0],! [0.0, 0.0, 0.0, 1.0],! [0.0, 0.0, 0.8, 1.0],! [0.0, 0.0, 1.0, 1.0]!]);

Page 20: Deeplearning with node

次に教師データを用意

var label = $M([! [1.0, 0.0],! [1.0, 0.0],! [1.0, 0.0],! [0.0, 1.0],! [0.0, 1.0],! [0.0, 1.0]!]);

Page 21: Deeplearning with node

モデルを作成する// n42をrequireする!var n42 = require(‘n42');!!

// Stacked Denoised Autoencoder!// を作成する!// 入力4次元,第2,3層3次元,出力2次元!var sda = new n42.SdA(input, !label, 4, [3, 3], 2);

Page 22: Deeplearning with node

訓練させる// 第2,3層を訓練!// 学習率,ノイズレベル, 最適化回数!sda.pretrain(0.3, 0.01, 1000);!!

// 出力層を訓練!// 学習率, 最適化回数!sda.finetune(0.3, 50);

Page 23: Deeplearning with node

予測させる// 予測用のテストデータ!var data = $M([! [1.0, 1.0, 0.0, 0.0],! [0.0, 0.0, 1.0, 1.0]!]);!!

var answer = sda.predict(data)

Page 24: Deeplearning with node

答え

[0.999999, 1.026438e-7]! ~ [1.0, 0.0]!!

[4.672230e-28, 1] ! ~ [0.0, 1.0]

Page 25: Deeplearning with node

つまりvar input = $M([! [1.0, 1.0, 0.0, 0.0],! [1.0, 1.0, 0.2, 0.0],! [1.0, 0.9, 0.1, 0.0],! [0.0, 0.0, 0.0, 1.0],! [0.0, 0.0, 0.8, 1.0],! [0.0, 0.0, 1.0, 1.0]!]);

var label = $M([! [1.0, 0.0],! [1.0, 0.0],! [1.0, 0.0],! [0.0, 1.0],! [0.0, 1.0],! [0.0, 1.0]!]);

学習

Page 26: Deeplearning with node

つまりvar input = $M([! [1.0, 1.0, 0.0, 0.0],! [1.0, 1.0, 0.2, 0.0],! [1.0, 0.9, 0.1, 0.0],! [0.0, 0.0, 0.0, 1.0],! [0.0, 0.0, 0.8, 1.0],! [0.0, 0.0, 1.0, 1.0]!]);

var label = $M([! [1.0, 0.0],! [1.0, 0.0],! [1.0, 0.0],! [0.0, 1.0],! [0.0, 1.0],! [0.0, 1.0]!]);

学習

var data = $M([! [1.0, 1.0, 0.0, 0.0],! [0.0, 0.0, 1.0, 1.0]!]);

var answer = $M([! [0.99, 1.03e-7]! [4.67e-28, 1] !]);予測

Page 27: Deeplearning with node

考察

Page 28: Deeplearning with node

おそい

Page 29: Deeplearning with node

おそい

Pythonでの同じ実装と 10倍の差

Page 30: Deeplearning with node

精度が不十分

Page 31: Deeplearning with node

精度が不十分

桁溢れを簡単に起こして NaNが発生

Page 32: Deeplearning with node

まとめ

✕ NodeでDeep Learningは厳しい

○ 実装がつかみやすい

Page 33: Deeplearning with node

是非読んでみてください

Page 34: Deeplearning with node

Thank you