SlideShare a Scribd company logo
1 of 31
ニューラルネットワークによ
る英文の肯定・否定の判別
NANDEDKAR PARTH SHIRISH
つし
Slide 1
つし16 輪講に使った本の説明のスライド作成
つ し, 12-07-2019
• 機械学習・・・多数のデータを用いて,機械に「学習」
という処理をさせることにより,新たなデータを分別,
識別,予測させる
人間の脳内の情報処理は,多数の単純な「ニューロン
(neuron)」のつながりによって実現
つし
つし
つし
Slide 2
つし3 複数ある学習手法の中で,今回取り上げたのは…
つ し, 12-07-2019
つし4 数式的なモデルで表現できないか?
つ し, 12-07-2019
つし15 文字細いやつは Ctrl-B で太くする
つ し, 12-07-2019
• 人間の脳における電気信号伝達メカニズムを数理モデルとして実現したもの
x1 x2 x3 x4
X1~x4:データ
(ベクトル) ニューロン
入力
y
w1
w2
w3
w4
出力
重み
画像
データ
ベクトル化
01
10
10
11
01
ニューラル
ネットワーク
入力
0
1
0
1
1
“5”の
正解データ
照合
ロス関数
つし
つし
つし
つし
つし
つし
Slide 3
つし1 入力・重み・出力の説明はスライドから省いてしゃべる
つ し, 12-07-2019
つし5 ・入力:用意されたデータ群
・重み:データに対してかかる数値群.「学習」とはこの重みを最適化すること.
・出力:入力と重みを関数に適用した結果.
つ し, 12-07-2019
つし2 図を残して文字はしゃべる
つ し, 12-07-2019
つし6 (図1)この構造をニューラルネットワークと呼ぶ.
つ し, 12-07-2019
つし7 深層学習(ディープラーニング)は出力と入力の間に隠れ層と呼ばれる層を増やし,より最適な出力を目指す
こと.
【EX】ある数字の画像データを数値化(ベクトル化)したものを入力とし,出力がその数字(のベクトルデ
ータ)に近づくよう調整する.
つ し, 12-07-2019
つし8 (図2)拡大
つ し, 12-07-2019
問題の紹介ー自然言語処理
• Yelpのレビューの一部データを学習、残りのデータ
のレビュー文に対し、
肯定的(3,4,5 Stars)か否定的(1,2 Stars)かを
推測!!
指標 スター数 レビュー(50単語以内)
4
問題の紹介ー自然言語処理
• Yelpのデータを以下のように分け、
学習用 | テスト用(Validation)
学習時 テスト時
自主研究の目的
学習部分を学習し、ロス関数の最小化、正確度の最大
化!=>過学習の回避でできる
5
自然言語処理に特化したRNN(回帰型NN)
• レビューの各単語を逐次的に入力(=Xt)
• 肯定性の推測値(hi)が出力
繰り広げ
• 左側の単語のニューロンの出力(hi)を
右側の全ての計算に考慮=>再帰的Feedback 6
つし
Slide 6
つし21 RNNの理屈:人間のように 「前の単語の意味を残りの文の評価に考慮」  かつ 「直前の単語を比較的重
視」
つ し, 12-07-2019
今回使用した RNN の紹介
7
Long Short-Term Memory 型
(標準的,デフォルトのRNN)
Gated Recurrent Unit型 GRU
(LSTMの一類)
網羅的構造。ありうる全てのパラ
メータ(重み)・ゲート(関数)が学習
LSTM内の細かな重みを省く。
(学習の効率化)
前のニューロンの出力値
及び現在の1単語(入力Xi)からなる
Cell Stateもフィードバック
ニューロンの出力値のみをフィー
ドバック
(構造の簡素化)
Cell Stateにより本単語(入力Xi)の
実質が重視。文脈の理解は遅い。
現在の単語の意味も文脈に任せる
のが可能。文脈の理解は迅速。
つし
Slide 7
つし17 余白を作る
つ し, 12-07-2019
・ニューロンの数を多くする
・隠れ層の数を多くする
機械学習を行う上での課題・問題点
より複雑で,
精度の高いモデルの
構築が可能に
つし
つし
Slide 8
つし9 数字を書く
つ し, 12-07-2019
つし10 一枚を拡大(一部分?)
真ん中を削る
つ し, 12-07-2019
機械学習を行う上での課題・問題点
問題点:学習に用いたデータに,過剰に適合する恐れがある
次数12の多項式
>> 線形近似
つし
Slide 9
つし11 図を拡大する
つ し, 12-07-2019
機械学習を行う上での課題・問題点
訓練データに対して学習されているが,
テストデータに対しては学習されていない状態
Overfitting
(過学習)
〈実際の結果〉
青:訓練データに対する正確性
赤:テストデータに対する正確性
つし
Slide 10
つし12 レイアウト(2つのコンテンツを使ってみる)
つ し, 12-07-2019
GRU型RNNによって過学習を防ぐ
11
Long Short Term Memory
型 ーLSTM
Gated Recurrent Unit型
GRU
0.6
学習した標本の数×1800
テスト時ロス
学習時ロス
0.6
まとめ
輪講の目的
• 機械学習の理解
• Neural Network の理解
自主研究の目的
ロス関数の最小化、精度の最大化 =>過学習の抑制
つし
つし
Slide 12
つし22 参考文献のスライド
つ し, 12-07-2019
つし23 リスト形式で書く
・プログラムのチュートリアルのサイト
・github
・API
・本の url
つ し, 12-07-2019
L2正則化で行われる操作
• 元のloss関数を とすると
+ が最小となるようなwを求める。
この時、lossが小さくなりつつ、重みが小さくなる。
重みが結果に与える影響
• 重みが大きくなると
⇒結果への影響が大きくなる
• 他とかけ離れているデータに対する重みが大きい場合
⇒結果が大きく歪められる恐れがある。
具体例
2層目の一番下のニューロ
ンの重みを大きくしたこと
で、結果に大きな影響を与
えてしまっている。
つし
Slide 15
つし18 文字消して図の拡大
つ し, 12-07-2019
改善した結果
改良前 改良後
改良後ではval_loss(オレンジ色の折れ線グラフ)の過度な上昇、つまり過学習が抑えられている。
つし
つし
Slide 16
つし19 左の図の拡大
つ し, 12-07-2019
つし20 最初は学習が遅い→最初はすべてのパラメータの値が大きい
つ し, 12-07-2019
(補足)GRU型、LSTM型の当てはまり度は同
じ
17
Long Short Term Memory
型 ーLSTM
Gated Recurrent Unit型
GRU
学習した標本の数×1800
学習時当てはまり%
テスト時
当てはまり%
100%
65%
(補足)GRU型、LSTM型の内部構造
Long Short Term Memory
型 ーLSTM
Gated Recurrent Unit型
GRU
機械学習を行う上での課題・問題点
・Overfitting が発生
・データ全体でなく,訓練データのみに適合
・期待のモデルが構築されない
・Overfitting を防ぐ必要がある
後で消す
つし
Slide 19
つし13 なくていい、しゃべる
つ し, 12-07-2019

More Related Content

More from Parth Nandedkar

Large scale cell tracking using an approximated Sinkhorn algorithm
Large scale cell tracking using an approximated Sinkhorn algorithmLarge scale cell tracking using an approximated Sinkhorn algorithm
Large scale cell tracking using an approximated Sinkhorn algorithmParth Nandedkar
 
Large scale cell tracking using an approximated Sinkhorn algorithm
Large scale cell tracking using an approximated Sinkhorn algorithmLarge scale cell tracking using an approximated Sinkhorn algorithm
Large scale cell tracking using an approximated Sinkhorn algorithmParth Nandedkar
 
Discount tracker - Fujitsu Hackathon
Discount tracker - Fujitsu HackathonDiscount tracker - Fujitsu Hackathon
Discount tracker - Fujitsu HackathonParth Nandedkar
 
Motion and Position Map in Cell Tracking for Bioimaging
Motion and Position Map in Cell Tracking for BioimagingMotion and Position Map in Cell Tracking for Bioimaging
Motion and Position Map in Cell Tracking for BioimagingParth Nandedkar
 
Line Detection in Computer Vision - Recent Developments and Applications
Line Detection in Computer Vision - Recent Developments and ApplicationsLine Detection in Computer Vision - Recent Developments and Applications
Line Detection in Computer Vision - Recent Developments and ApplicationsParth Nandedkar
 
Line Detection in Computer Vision
Line Detection in Computer VisionLine Detection in Computer Vision
Line Detection in Computer VisionParth Nandedkar
 
Speech at english_seminar
Speech at english_seminarSpeech at english_seminar
Speech at english_seminarParth Nandedkar
 
Permutations and Combinations IIT JEE+Olympiad Lecture 1
Permutations and Combinations IIT JEE+Olympiad Lecture 1 Permutations and Combinations IIT JEE+Olympiad Lecture 1
Permutations and Combinations IIT JEE+Olympiad Lecture 1 Parth Nandedkar
 
Permutations and Combinations IIT JEE+Olympiad Lecture 4
Permutations and Combinations IIT JEE+Olympiad Lecture 4Permutations and Combinations IIT JEE+Olympiad Lecture 4
Permutations and Combinations IIT JEE+Olympiad Lecture 4Parth Nandedkar
 
Permutations and Combinations IIT JEE+Olympiad Lecture 3
Permutations and Combinations IIT JEE+Olympiad Lecture 3 Permutations and Combinations IIT JEE+Olympiad Lecture 3
Permutations and Combinations IIT JEE+Olympiad Lecture 3 Parth Nandedkar
 
Deep Learning Demonstration using Tensorflow (7th lecture)
Deep Learning Demonstration using Tensorflow (7th lecture)Deep Learning Demonstration using Tensorflow (7th lecture)
Deep Learning Demonstration using Tensorflow (7th lecture)Parth Nandedkar
 
Basics of Deep Learning (2nd lecture)
Basics of Deep Learning (2nd lecture)Basics of Deep Learning (2nd lecture)
Basics of Deep Learning (2nd lecture)Parth Nandedkar
 

More from Parth Nandedkar (12)

Large scale cell tracking using an approximated Sinkhorn algorithm
Large scale cell tracking using an approximated Sinkhorn algorithmLarge scale cell tracking using an approximated Sinkhorn algorithm
Large scale cell tracking using an approximated Sinkhorn algorithm
 
Large scale cell tracking using an approximated Sinkhorn algorithm
Large scale cell tracking using an approximated Sinkhorn algorithmLarge scale cell tracking using an approximated Sinkhorn algorithm
Large scale cell tracking using an approximated Sinkhorn algorithm
 
Discount tracker - Fujitsu Hackathon
Discount tracker - Fujitsu HackathonDiscount tracker - Fujitsu Hackathon
Discount tracker - Fujitsu Hackathon
 
Motion and Position Map in Cell Tracking for Bioimaging
Motion and Position Map in Cell Tracking for BioimagingMotion and Position Map in Cell Tracking for Bioimaging
Motion and Position Map in Cell Tracking for Bioimaging
 
Line Detection in Computer Vision - Recent Developments and Applications
Line Detection in Computer Vision - Recent Developments and ApplicationsLine Detection in Computer Vision - Recent Developments and Applications
Line Detection in Computer Vision - Recent Developments and Applications
 
Line Detection in Computer Vision
Line Detection in Computer VisionLine Detection in Computer Vision
Line Detection in Computer Vision
 
Speech at english_seminar
Speech at english_seminarSpeech at english_seminar
Speech at english_seminar
 
Permutations and Combinations IIT JEE+Olympiad Lecture 1
Permutations and Combinations IIT JEE+Olympiad Lecture 1 Permutations and Combinations IIT JEE+Olympiad Lecture 1
Permutations and Combinations IIT JEE+Olympiad Lecture 1
 
Permutations and Combinations IIT JEE+Olympiad Lecture 4
Permutations and Combinations IIT JEE+Olympiad Lecture 4Permutations and Combinations IIT JEE+Olympiad Lecture 4
Permutations and Combinations IIT JEE+Olympiad Lecture 4
 
Permutations and Combinations IIT JEE+Olympiad Lecture 3
Permutations and Combinations IIT JEE+Olympiad Lecture 3 Permutations and Combinations IIT JEE+Olympiad Lecture 3
Permutations and Combinations IIT JEE+Olympiad Lecture 3
 
Deep Learning Demonstration using Tensorflow (7th lecture)
Deep Learning Demonstration using Tensorflow (7th lecture)Deep Learning Demonstration using Tensorflow (7th lecture)
Deep Learning Demonstration using Tensorflow (7th lecture)
 
Basics of Deep Learning (2nd lecture)
Basics of Deep Learning (2nd lecture)Basics of Deep Learning (2nd lecture)
Basics of Deep Learning (2nd lecture)
 

LSTM and GRU RNNs in Sentiment Analysis (Japanese)