Suche senden
Hochladen
深層学習前半
•
Als PPTX, PDF herunterladen
•
0 gefällt mir
•
35 views
S
ssusere8ae711
Folgen
深層学習前半
Weniger lesen
Mehr lesen
Technologie
Melden
Teilen
Melden
Teilen
1 von 24
Jetzt herunterladen
Empfohlen
深層学習前半
深層学習前半
ssusere8ae711
PPT - Enhancing the Locality and Breaking the Memory Bottleneck of Transforme...
PPT - Enhancing the Locality and Breaking the Memory Bottleneck of Transforme...
Jisang Yoon
Lec 6-bp
Lec 6-bp
Taymoor Nazmy
Martin Takac - “Solving Large-Scale Machine Learning Problems in a Distribute...
Martin Takac - “Solving Large-Scale Machine Learning Problems in a Distribute...
diannepatricia
Multilayer Perceptron - Elisa Sayrol - UPC Barcelona 2018
Multilayer Perceptron - Elisa Sayrol - UPC Barcelona 2018
Universitat Politècnica de Catalunya
PPT - Adaptive Quantitative Trading : An Imitative Deep Reinforcement Learnin...
PPT - Adaptive Quantitative Trading : An Imitative Deep Reinforcement Learnin...
Jisang Yoon
Caffe framework tutorial2
Caffe framework tutorial2
Park Chunduck
Recurrent Neural Networks for Text Analysis
Recurrent Neural Networks for Text Analysis
odsc
Empfohlen
深層学習前半
深層学習前半
ssusere8ae711
PPT - Enhancing the Locality and Breaking the Memory Bottleneck of Transforme...
PPT - Enhancing the Locality and Breaking the Memory Bottleneck of Transforme...
Jisang Yoon
Lec 6-bp
Lec 6-bp
Taymoor Nazmy
Martin Takac - “Solving Large-Scale Machine Learning Problems in a Distribute...
Martin Takac - “Solving Large-Scale Machine Learning Problems in a Distribute...
diannepatricia
Multilayer Perceptron - Elisa Sayrol - UPC Barcelona 2018
Multilayer Perceptron - Elisa Sayrol - UPC Barcelona 2018
Universitat Politècnica de Catalunya
PPT - Adaptive Quantitative Trading : An Imitative Deep Reinforcement Learnin...
PPT - Adaptive Quantitative Trading : An Imitative Deep Reinforcement Learnin...
Jisang Yoon
Caffe framework tutorial2
Caffe framework tutorial2
Park Chunduck
Recurrent Neural Networks for Text Analysis
Recurrent Neural Networks for Text Analysis
odsc
論文輪読資料「Gated Feedback Recurrent Neural Networks」
論文輪読資料「Gated Feedback Recurrent Neural Networks」
kurotaki_weblab
Neural Turing Machines
Neural Turing Machines
Kato Yuzuru
Transfer Learning and Domain Adaptation - Ramon Morros - UPC Barcelona 2018
Transfer Learning and Domain Adaptation - Ramon Morros - UPC Barcelona 2018
Universitat Politècnica de Catalunya
Introduction to deep learning in python and Matlab
Introduction to deep learning in python and Matlab
Imry Kissos
NIPS読み会2013: One-shot learning by inverting a compositional causal process
NIPS読み会2013: One-shot learning by inverting a compositional causal process
nozyh
Regularization
Regularization
Darren Yow-Bang Wang
Multilayer & Back propagation algorithm
Multilayer & Back propagation algorithm
swapnac12
Accelerating Random Forests in Scikit-Learn
Accelerating Random Forests in Scikit-Learn
Gilles Louppe
Recurrent Neural Networks (DLAI D7L1 2017 UPC Deep Learning for Artificial In...
Recurrent Neural Networks (DLAI D7L1 2017 UPC Deep Learning for Artificial In...
Universitat Politècnica de Catalunya
Exploring Optimization in Vowpal Wabbit
Exploring Optimization in Vowpal Wabbit
Shiladitya Sen
Recurrent Neural Networks I (D2L2 Deep Learning for Speech and Language UPC 2...
Recurrent Neural Networks I (D2L2 Deep Learning for Speech and Language UPC 2...
Universitat Politècnica de Catalunya
Introdution and designing a learning system
Introdution and designing a learning system
swapnac12
ppt
ppt
butest
Kaggle Winning Solution Xgboost algorithm -- Let us learn from its author
Kaggle Winning Solution Xgboost algorithm -- Let us learn from its author
Vivian S. Zhang
RNN & LSTM: Neural Network for Sequential Data
RNN & LSTM: Neural Network for Sequential Data
Yao-Chieh Hu
Classification By Back Propagation
Classification By Back Propagation
BineeshJose99
Auto encoders in Deep Learning
Auto encoders in Deep Learning
Shajun Nisha
Thesis : "IBBET : In Band Bandwidth Estimation for LAN"
Thesis : "IBBET : In Band Bandwidth Estimation for LAN"
Vishalkumarec
Deep Learning: Recurrent Neural Network (Chapter 10)
Deep Learning: Recurrent Neural Network (Chapter 10)
Larry Guo
Deep belief networks for spam filtering
Deep belief networks for spam filtering
SOYEON KIM
Deep Learning Interview Questions And Answers | AI & Deep Learning Interview ...
Deep Learning Interview Questions And Answers | AI & Deep Learning Interview ...
Simplilearn
Backpropagation - Elisa Sayrol - UPC Barcelona 2018
Backpropagation - Elisa Sayrol - UPC Barcelona 2018
Universitat Politècnica de Catalunya
Weitere ähnliche Inhalte
Was ist angesagt?
論文輪読資料「Gated Feedback Recurrent Neural Networks」
論文輪読資料「Gated Feedback Recurrent Neural Networks」
kurotaki_weblab
Neural Turing Machines
Neural Turing Machines
Kato Yuzuru
Transfer Learning and Domain Adaptation - Ramon Morros - UPC Barcelona 2018
Transfer Learning and Domain Adaptation - Ramon Morros - UPC Barcelona 2018
Universitat Politècnica de Catalunya
Introduction to deep learning in python and Matlab
Introduction to deep learning in python and Matlab
Imry Kissos
NIPS読み会2013: One-shot learning by inverting a compositional causal process
NIPS読み会2013: One-shot learning by inverting a compositional causal process
nozyh
Regularization
Regularization
Darren Yow-Bang Wang
Multilayer & Back propagation algorithm
Multilayer & Back propagation algorithm
swapnac12
Accelerating Random Forests in Scikit-Learn
Accelerating Random Forests in Scikit-Learn
Gilles Louppe
Recurrent Neural Networks (DLAI D7L1 2017 UPC Deep Learning for Artificial In...
Recurrent Neural Networks (DLAI D7L1 2017 UPC Deep Learning for Artificial In...
Universitat Politècnica de Catalunya
Exploring Optimization in Vowpal Wabbit
Exploring Optimization in Vowpal Wabbit
Shiladitya Sen
Recurrent Neural Networks I (D2L2 Deep Learning for Speech and Language UPC 2...
Recurrent Neural Networks I (D2L2 Deep Learning for Speech and Language UPC 2...
Universitat Politècnica de Catalunya
Introdution and designing a learning system
Introdution and designing a learning system
swapnac12
ppt
ppt
butest
Kaggle Winning Solution Xgboost algorithm -- Let us learn from its author
Kaggle Winning Solution Xgboost algorithm -- Let us learn from its author
Vivian S. Zhang
RNN & LSTM: Neural Network for Sequential Data
RNN & LSTM: Neural Network for Sequential Data
Yao-Chieh Hu
Classification By Back Propagation
Classification By Back Propagation
BineeshJose99
Auto encoders in Deep Learning
Auto encoders in Deep Learning
Shajun Nisha
Thesis : "IBBET : In Band Bandwidth Estimation for LAN"
Thesis : "IBBET : In Band Bandwidth Estimation for LAN"
Vishalkumarec
Deep Learning: Recurrent Neural Network (Chapter 10)
Deep Learning: Recurrent Neural Network (Chapter 10)
Larry Guo
Deep belief networks for spam filtering
Deep belief networks for spam filtering
SOYEON KIM
Was ist angesagt?
(20)
論文輪読資料「Gated Feedback Recurrent Neural Networks」
論文輪読資料「Gated Feedback Recurrent Neural Networks」
Neural Turing Machines
Neural Turing Machines
Transfer Learning and Domain Adaptation - Ramon Morros - UPC Barcelona 2018
Transfer Learning and Domain Adaptation - Ramon Morros - UPC Barcelona 2018
Introduction to deep learning in python and Matlab
Introduction to deep learning in python and Matlab
NIPS読み会2013: One-shot learning by inverting a compositional causal process
NIPS読み会2013: One-shot learning by inverting a compositional causal process
Regularization
Regularization
Multilayer & Back propagation algorithm
Multilayer & Back propagation algorithm
Accelerating Random Forests in Scikit-Learn
Accelerating Random Forests in Scikit-Learn
Recurrent Neural Networks (DLAI D7L1 2017 UPC Deep Learning for Artificial In...
Recurrent Neural Networks (DLAI D7L1 2017 UPC Deep Learning for Artificial In...
Exploring Optimization in Vowpal Wabbit
Exploring Optimization in Vowpal Wabbit
Recurrent Neural Networks I (D2L2 Deep Learning for Speech and Language UPC 2...
Recurrent Neural Networks I (D2L2 Deep Learning for Speech and Language UPC 2...
Introdution and designing a learning system
Introdution and designing a learning system
ppt
ppt
Kaggle Winning Solution Xgboost algorithm -- Let us learn from its author
Kaggle Winning Solution Xgboost algorithm -- Let us learn from its author
RNN & LSTM: Neural Network for Sequential Data
RNN & LSTM: Neural Network for Sequential Data
Classification By Back Propagation
Classification By Back Propagation
Auto encoders in Deep Learning
Auto encoders in Deep Learning
Thesis : "IBBET : In Band Bandwidth Estimation for LAN"
Thesis : "IBBET : In Band Bandwidth Estimation for LAN"
Deep Learning: Recurrent Neural Network (Chapter 10)
Deep Learning: Recurrent Neural Network (Chapter 10)
Deep belief networks for spam filtering
Deep belief networks for spam filtering
Ähnlich wie 深層学習前半
Deep Learning Interview Questions And Answers | AI & Deep Learning Interview ...
Deep Learning Interview Questions And Answers | AI & Deep Learning Interview ...
Simplilearn
Backpropagation - Elisa Sayrol - UPC Barcelona 2018
Backpropagation - Elisa Sayrol - UPC Barcelona 2018
Universitat Politècnica de Catalunya
backpropagation in neural networks
backpropagation in neural networks
Akash Goel
nural network ER. Abhishek k. upadhyay
nural network ER. Abhishek k. upadhyay
abhishek upadhyay
08 neural networks
08 neural networks
ankit_ppt
Lesson 39
Lesson 39
Avijit Kumar
AI Lesson 39
AI Lesson 39
Assistant Professor
Deep Learning
Deep Learning
Pawan Singh
Problem solving using computers - Chapter 1
Problem solving using computers - Chapter 1
To Sum It Up
Neural nets
Neural nets
bucknertroy
Scalable Deep Learning Using Apache MXNet
Scalable Deep Learning Using Apache MXNet
Amazon Web Services
[系列活動] 手把手的深度學習實務
[系列活動] 手把手的深度學習實務
台灣資料科學年會
Deep learning: Mathematical Perspective
Deep learning: Mathematical Perspective
YounusS2
DeepLearningLecture.pptx
DeepLearningLecture.pptx
ssuserf07225
Optimization (DLAI D4L1 2017 UPC Deep Learning for Artificial Intelligence)
Optimization (DLAI D4L1 2017 UPC Deep Learning for Artificial Intelligence)
Universitat Politècnica de Catalunya
MXNet Workshop
MXNet Workshop
Amazon Web Services
Unit 2 ml.pptx
Unit 2 ml.pptx
PradeeshSAI
Hands on machine learning with scikit-learn and tensor flow by ahmed yousry
Hands on machine learning with scikit-learn and tensor flow by ahmed yousry
Ahmed Yousry
Cheatsheet deep-learning
Cheatsheet deep-learning
Steve Nouri
Nimrita deep learning
Nimrita deep learning
Nimrita Koul
Ähnlich wie 深層学習前半
(20)
Deep Learning Interview Questions And Answers | AI & Deep Learning Interview ...
Deep Learning Interview Questions And Answers | AI & Deep Learning Interview ...
Backpropagation - Elisa Sayrol - UPC Barcelona 2018
Backpropagation - Elisa Sayrol - UPC Barcelona 2018
backpropagation in neural networks
backpropagation in neural networks
nural network ER. Abhishek k. upadhyay
nural network ER. Abhishek k. upadhyay
08 neural networks
08 neural networks
Lesson 39
Lesson 39
AI Lesson 39
AI Lesson 39
Deep Learning
Deep Learning
Problem solving using computers - Chapter 1
Problem solving using computers - Chapter 1
Neural nets
Neural nets
Scalable Deep Learning Using Apache MXNet
Scalable Deep Learning Using Apache MXNet
[系列活動] 手把手的深度學習實務
[系列活動] 手把手的深度學習實務
Deep learning: Mathematical Perspective
Deep learning: Mathematical Perspective
DeepLearningLecture.pptx
DeepLearningLecture.pptx
Optimization (DLAI D4L1 2017 UPC Deep Learning for Artificial Intelligence)
Optimization (DLAI D4L1 2017 UPC Deep Learning for Artificial Intelligence)
MXNet Workshop
MXNet Workshop
Unit 2 ml.pptx
Unit 2 ml.pptx
Hands on machine learning with scikit-learn and tensor flow by ahmed yousry
Hands on machine learning with scikit-learn and tensor flow by ahmed yousry
Cheatsheet deep-learning
Cheatsheet deep-learning
Nimrita deep learning
Nimrita deep learning
Kürzlich hochgeladen
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
comworks
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache Maven
Hervé Boutemy
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An Introduction
Dilum Bandara
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
Kalema Edgar
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024
Enterprise Knowledge
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
LoriGlavin3
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
Sergiu Bodiu
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Mark Simos
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
Rizwan Syed
Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdf
RankYa
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
Alex Barbosa Coqueiro
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
Commit University
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
Fwdays
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
BookNet Canada
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024
Scott Keck-Warren
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
Fwdays
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Precisely
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easy
Alfredo García Lavilla
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
null - The Open Security Community
How to write a Business Continuity Plan
How to write a Business Continuity Plan
Databarracks
Kürzlich hochgeladen
(20)
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache Maven
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An Introduction
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdf
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easy
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
How to write a Business Continuity Plan
How to write a Business Continuity Plan
深層学習前半
1.
深層学習前半 Tatsunori Ueno
2.
深層学習DAY1 2021/7/17
3.
Section1:入力層~中間層 ◦ ニュートラルネットワークは、入力層、中間層(隠れ層)、出力層の3つの分類できる。 ◦ 入力層とは、ニュートラルネットワーク全体の入力を受け取る層である。 ◦
中間層とは、入力層と出力層の間にある複数の層である。 ◦ 入力層から出力層に向けて情報が伝わることを順伝播といい、出力層から入力層に向けて遡って情報が伝わることを逆伝播という。 import numpy as np #x:入力 w:重み b:バイアス u = np.dot(x,w)+b 入力層 中間層 出力層
4.
確認テスト ◦ 1.与えられた図式に動物分類の実例を入れてみよう。 ◦ 2.以下の数式をPythonで書け。 ◦
3.1-1のファイルから中間層を定義しているソースを抜き出せ。 解答: # 2層の総入力 u2 = np.dot(z1, W2) + b2 # 2層の総出力 z2 = functions.relu(u2) 解答: u = np.dot(x, W) + b u z z=f(u) 10 300 300 15 50 1.8 20
5.
Section2:活性化関数 ◦ ステップ関数 ◦ 0か1でシンプルに表現する。 ◦
シグモイド関数 ◦ 0~1で滑らかに変化する。 ◦ tanh関数 ◦ ー1~1で滑らかに変化する。 ◦ ReLU ◦ 負の場合は0,正の場合は入力を返す。 ◦ Leaky ReLU ◦ ReLUを改良した関数。負でもわずかに出力する。 ◦ 恒等関数 ◦ 入力をそのまま返す関数。 ◦ ソフトマックス関数 ◦ 分類問題を扱う関数 #ステップ関数 import numpy as np import matplotlib.pyplot as plt def step_function(x): return np.where(x<=0,0,1) x = np.linspace(-5,5) y = step_function(x) plt.plot(x,y) plt.show() #シグモイド関数 import numpy as np import matplotlib.pyplot as plt def sigmoid_function(x): return 1/(1+np.exp(-x)) x = np.linspace(-10,10) y = sigmoid_function(x) plt.plot(x,y) plt.show()
6.
確認テスト ◦ 1.線形と非線形の違いを図に書いて簡易に説明せよ。 ◦
2.配布されたソースコードより、「順伝播(3層・複数ユニッ ト)」から、活性化関数に該当する箇所を抜き出せ。 線形は入力を出力にそのまま返す。 非線形は入力データを関数によって一定の範囲の値にして返す。 解答: # 1層の総出力 z1 = functions.relu(u1) # 2層の総出力 z2 = functions.relu(u2)
7.
Section3:出力層 ◦ ニュートラルネットワークは、入力層、中間層(隠れ層)、出力層の3つの分類できる。 ◦ 出力層の活性化関数で、回帰モデルにも分類モデルにすることもできる。 ◦
恒等関数を出力層の活性化関数にすると、回帰モデルになり、ソフトマックス関数にすると分類モデルとなる。 恒等関数 ソフトマックス関数 出力層 出力層
8.
確認テスト ◦ 1.誤差関数(2乗和誤差、残差平方和)において、 • なぜ、引き算するのみではなく、二乗するのか述べよ •
1/2はどういう意味を持つか述べよ ◦ 2.以下の数式に該当するソースコードを示し、一行づつ処理の説明をせよ。 解答: •全体でどれ位誤差があったかを知りたいとき、 引き算したものの総和はゼロになる。 各々を二乗 したものを足し合わせる事によって、それを防ぐ 事ができる。 •誤差逆伝播の計算で、誤差関数を微分する必要 があるのだが、その際に1/2があると係数が相殺 される計算式が簡単になるため。 np.exp(x) / np.sum(np.exp(x)) # 出力層の活性化関数 # ソフトマックス関数 def softmax(x): if x.ndim == 2: x = x.T x = x - np.max(x, axis=0) y = np.exp(x) / np.sum(np.exp(x), axis=0) return y.T x = x - np.max(x) # オーバーフロー対策 return np.exp(x) / np.sum(np.exp(x)) ◦ 3.以下の数式に該当するソースコードを示し、一行づつ処理の説明をせよ。 -np.sum(np.log(y[np.arange(batch_size), d] + 1e-7)) # クロスエントロピー def cross_entropy_error(d, y): if y.ndim == 1: d = d.reshape(1, d.size) y = y.reshape(1, y.size) # 教師データがone-hot-vectorの場合、正解ラベルのインデックスに変換 if d.size == y.size: d = d.argmax(axis=1) batch_size = y.shape[0] return -np.sum(np.log(y[np.arange(batch_size), d] + 1e-7)) / batch_size
9.
Section4:勾配降下法 ◦ 勾配降下法とは、勾配を元に重みとバイアスを少しずつ調整し、誤差が最小になるようにネットワークを最適化する方法である。 ◦ 主な手法として下記の方法がある。 ◦
確率的勾配降下法(SGD) ◦ Momentum ◦ AdaGrad ◦ RMSProp ◦ Adam # データのランダム抽出 random_datasets = np.random.choice(data_sets, epoch) # 勾配降下の繰り返し for dataset in random_datasets: x, d = dataset['x'], dataset['d'] z1, y = forward(network, x) grad = backward(x, d, z1, y) # パラメータに勾配適用 for key in ('W1', 'W2', 'b1', 'b2'): network[key] -= learning_rate * grad[key] # 誤差 loss = functions.mean_squared_error(d, y) losses.append(loss)
10.
確認テスト ◦ 1.以下の勾配降下法に該当するソースコードを探してみよう。 ◦ 2.深層学習にとって大切なオンライン学習を定義しなさい。 ◦
3.以下の数式の意味を図に書いて説明せよ。 解答: network[key] -= learning_rate * grad[key] grad = backward(x, d, z1, y) # 勾配降下の繰り返し for dataset in random_datasets: x, d = dataset['x'], dataset['d'] z1, y = forward(network, x) grad = backward(x, d, z1, y) # パラメータに勾配適用 for key in ('W1', 'W2', 'b1', 'b2'): network[key] -= learning_rate * grad[key] # 誤差 loss = functions.mean_squared_error(d, y) losses.append(loss) print("##### 結果表示 #####") lists = range(epoch) 解答: オンライン学習とは学習データが入ってくる度に都度パラ メータ(重み)を更新し、学習を進めていく方法。一方、 バッチ学習では一度にすべての学習データを使用してパラ メータ更新を行う。最近の深層学習ではオンライン学習と いうのがかなり重要な要素になっている。 W(t) W(t+1) W(t+2) -ε∇Et+1 -ε∇Et
11.
Section5:誤差逆伝播法 • 誤差勾配の計算する方法である。 • 数値微分は、計算量が非常に大きくなる。 •
誤差逆伝播法は、算出される誤差を、出力側から順に微分し、前の層へと伝播。 最小限の計算で各パラメータでの微分値を解析的に計算する方法である」。 • 計算結果から微分を逆算することで、不要な再帰的計算を避けて微分を算出でき る手法である。 #-------------------- # 誤差逆伝播 #-------------------- # 「ソフトマックス + クロスエントロピー誤差」が逆伝播する値は「結果- 正解」になる # 学習データ毎の誤差をあとで合算するため、事前に誤差をデータ数で割る gosa = (softmax_result - t_value) / data_count # 重みとバイアスの微分 dw2 = np.dot(v2.T, gosa) db2 = np.sum(gosa, axis = 0) #誤差に重みをかけて、前の層へ誤差を伝播していきます gosa = np.dot(gosa, w2.T) # ReLU で値が 0 になっていた場合は、誤差を0 にします gosa[v2_org <= 0] = 0 # 重みとバイアスの微分 dw1 = np.dot(v1.T, gosa) db1 = np.sum(gosa, axis = 0) #誤差に重みをかけて、前の層へ誤差を伝播していきます # gosa = np.dot(gosa, w1.T) #-------------------- # 重みとバイアスの更新 #-------------------- learning_rate = 0.01 # 学習率 w1 -= dw1 * learning_rate w2 -= dw2 * learning_rate b1 -= db1 * learning_rate b2 -= db2 * learning_rate return (w1, b1, w2, b2) # グラフの描画 def draw_graph(w1, b1, w2, b2): plt.grid() # グリッド表示 plt.xlim([-1.5, 1.5]) # グラフ描画範囲(X軸) plt.ylim([-1.5, 1.5]) # グラフ描画範囲(Y軸) # グラフ描画 x_list = np.arange(-1, 1.6, 0.1) # x軸 y_list = np.arange(-1, 1.6, 0.1) # y軸 for y in y_list: for x in x_list: p = predict(np.array([x, y]), w1, b1, w2, b2) if p == 1: plt.scatter(x, y, c = 'b') plt.show() print("{0} {1} {2} {3}".format( predict(np.array([0, 0]), w1, b1, w2, b2), predict(np.array([0, 1]), w1, b1, w2, b2), predict(np.array([1, 0]), w1, b1, w2, b2), predict(np.array([1, 1]), w1, b1, w2, b2)))
12.
確認テスト ◦ 1.誤差逆伝播法では不要な再帰的処理を避ける事が出来る。既に行った計算結果を保持しているソースコードを抽出せよ。 ◦ 2.以下のそれぞれに該当するソースコードを探せ。 解答: #
出力層でのデルタ delta2 = functions.d_mean_squared_error(d, y) 解答: elta2 = functions.d_mean_squared_error(d, y) delta1 = np.dot(delta2, W2.T) * functions.d_sigmoid(z1) grad['W1'] = np.dot(x.T, delta1)
13.
深層学習DAY2 2021/7/17
14.
Section1:勾配消失問題 ◦ 逆伝播の際に、層を遡るにつれて勾配が0に近づいてしまう問題を勾配消失問題という。 ◦ 勾配消失問題は、層が深くなるほど顕著になる。 ◦
対策としては、下記の方法がある。 ◦ ReLU ◦ バッチサイズの最適化 ◦ ハイパーパラメータの最適化 ◦ 正則化 ◦ 重みの初期値の最適化 ◦ 早期終了 ◦ データの拡張 ◦ ドロップアウト ◦ データの前処理 ReLU
15.
確認テスト ◦ 1.連鎖率の原理を使い、dz/dx を求めよ ◦
2.シグモイド関数を微分した時、入力値が0の時に最大値をとる。そ の値として正しいものを選択肢から選べ。 正解は (2) 0.25 𝜕𝑧 𝜕𝑡 = 2𝑡 𝜕𝑡 𝜕𝑥 = 1 𝜕𝑧 𝜕𝑡 𝜕𝑡 𝜕𝑥 = 2𝑡 𝜕𝑧 𝜕𝑥 = 2(𝑥 + 𝑦) ◦ 3.重みの初期値に0を設定すると、どのような問 題が発生するか。簡潔に説明せよ。 解答: 重みを0で初期化すると正しい学習が行えな い。 全ての重みの値が均一に更新されるため、 多数の重みを持つ意味がなくなる。 ◦ 4.一般的に考えられるバッチ正規化の効果を2点挙げよ。 解答: 1.バッチ正規化を行う事で、ニューラルネットワークの学習中 に、中間層の重みの更新が安定化されます。その結果として 学習がスピードアップします。 2.過学習を押さえる事ができます。バッチ正規化はミニバッチ の単位でデータの分布を正規化します。学習データの極端な ばらつきが抑えられます。この状態でニューラルネットワー クを学習できますので、過学習が起きにくく調整が行われて いきます。
16.
Section2:学習率最適化手法 ◦ モメンタム ◦ SDGのジグザグ運転に対して株価の移動平均のような動きをする。 ◦
AdaGrad ◦ 緩やかな斜面に強い。 ◦ RMSProp(AdaGradを改良) ◦ AdaGradのようにハイパーパラメータの調整が必要な場合が少ない。 ◦ Adam ◦ 優秀な最適化手法(Optimizer)モメンタム及びRMSPropのメリットを学んだアルゴリズムである。 Adam RMSProp AdaGrad
17.
確認テスト ◦ 1.モメンタム・AdaGrad・RMSPropの特徴をそれぞれ簡潔に説明せよ。 解答: モメンタムのメリット 局所的最適解にはならず、大域的最適解となる。 谷間についてから最も低い位置(最適値)にいくまでの時間が早い。 AdaGradのメリット 勾配の緩やかな斜面に対して、最適値に近づける。 RMSPropのメリット 局所的最適解にはならず、大域的最適解となる。 ハイパーパラメータの調整が必要な場合が少ない。
18.
Section3:過学習 ◦ 訓練データに過剰の適合し、未知の入力のデータに対して正しく推定できなくなる現象。 ◦ 過学習になると、汎化誤差が大きくなる。 import
numpy as np import matplotlib.pyplot as plt from sklearn.pipeline import Pipeline from sklearn.preprocessing import PolynomialFeatures from sklearn.linear_model import LinearRegression from sklearn.model_selection import cross_val_score def true_fun(X): return np.cos(1.5 * np.pi * X) np.random.seed(0) n_samples = 30 degrees = [5, 10, 15] X = np.sort(np.random.rand(n_samples)) y = true_fun(X) + np.random.randn(n_samples) * 0.1 plt.figure(figsize=(14, 5)) for i in range(len(degrees)): ax = plt.subplot(1, len(degrees), i + 1) plt.setp(ax, xticks=(), yticks=()) polynomial_features = PolynomialFeatures(degree=degrees[i], include_bias=False) linear_regression = LinearRegression() pipeline = Pipeline([("polynomial_features", polynomial_features), ("linear_regression", linear_regression)]) pipeline.fit(X[:, np.newaxis], y) # Evaluate the models using crossvalidation scores = cross_val_score(pipeline, X[:, np.newaxis], y, scoring="neg_mean_squared_error", cv=10) X_test = np.linspace(0, 1, 100) plt.plot(X_test, pipeline.predict(X_test[:, np.newaxis]), label="Model") plt.plot(X_test, true_fun(X_test), label="True function") plt.scatter(X, y, edgecolor='b', s=20, label="Samples") plt.xlabel("x") plt.ylabel("y") plt.xlim((0, 1)) plt.ylim((-2, 2)) plt.legend(loc="best") plt.title("Degree {}nMSE = {:.2e}(+/- {:.2e})".format( degrees[i], -scores.mean(), scores.std())) plt.show() ◦ 図より、過学習になると、学習データに対する誤差はなくなるが、 未知のデータに対する誤差は大きくなることがわかる。
19.
確認テスト ◦ 1.機械学習で使われる線形モデル(線形回帰、主成分分析・・・etc)の正則化は、モデルの重みを制限することで可能となる。 前述の線形モデルの正則化手法の中にリッジ回帰という手法があり、その特徴として正しいものを選択しなさい。 解答:(a) ◦ 2.下図について、L1正則化を表しているグラフはどちらか答えよ。 正解
: 右のLasso推定量。
20.
Section4:畳み込みニューラルネットワークの 概念 ◦ 畳み込みニュートラルネットワーク(CNN)は、人の視覚のように画像認識を得意とする。 ◦ CNNは、画像を入力とした分類問題でよく扱われる。 ◦
CNNには、畳み込み層、プーリング層、全結合層がある。 ◦ 畳み込み層では、複数のフィルタを用いて特徴の検出が行われる。 ◦ プーリング層では、畳み込み層の直後に配置され、区切られた領域の代表値を抽出する。 ◦ 全結合層は、畳み込み層とプーリング層の後に配置され、抽出された特徴量に基づき、演算を行い、出力する。
21.
Section4:畳み込みニューラルネットワークの 概念 from common import
optimizer # データの読み込み (x_train, d_train), (x_test, d_test) = load_mnist(flatten=False) print("データ読み込み完了") # 処理に時間のかかる場合はデータを削減 x_train, d_train = x_train[:5000], d_train[:5000] x_test, d_test = x_test[:1000], d_test[:1000] network = SimpleConvNet(input_dim=(1,28,28), conv_param = {'filter_num': 30, 'filter_size': 5, 'pad': 0, 'stride': 1}, hidden_size=100, output_size=10, weight_init_std=0.01) optimizer = optimizer.Adam() iters_num = 1000 train_size = x_train.shape[0] batch_size = 100 train_loss_list = [] accuracies_train = [] accuracies_test = [] plot_interval=10 for i in range(iters_num): batch_mask = np.random.choice(train_size, batch_size) x_batch = x_train[batch_mask] d_batch = d_train[batch_mask] grad = network.gradient(x_batch, d_batch) optimizer.update(network.params, grad) loss = network.loss(x_batch, d_batch) train_loss_list.append(loss) if (i+1) % plot_interval == 0: accr_train = network.accuracy(x_train, d_train) accr_test = network.accuracy(x_test, d_test) accuracies_train.append(accr_train) accuracies_test.append(accr_test) print('Generation: ' + str(i+1) + '. 正答率(トレーニング) = ' + str(accr_train)) print(' : ' + str(i+1) + '. 正答率(テスト) = ' + str(accr_test)) lists = range(0, iters_num, plot_interval) plt.plot(lists, accuracies_train, label="training set") plt.plot(lists, accuracies_test, label="test set") plt.legend(loc="lower right") plt.title("accuracy") plt.xlabel("count") plt.ylabel("accuracy") plt.ylim(0, 1.0) # グラフの表示 plt.show() mnistデータに対して、精度 の良い結果を求めることが できた
22.
確認テスト ◦ 1.サイズ6×6の入力画像を、サイズ2×2のフィルタで畳み込んだ時の出力画像のサイズを答えよ。なおストライドとパディングは1とする。 解答: 6+1*2-2+1=7 よって7x7である。
23.
Section5:最新のCNN • AlexNet:比較的初期の小さなニューラルネット • モデルの構造:5層の畳み込み層、及びプーリング層等、それに続く3層の全結合層から構成される。 •
畳み込み演算の部分から全結合層に至る部分について: • [13, 13, 256]の画像 • Flatten:横1列にずらっと並べるだけ[43264]。初期のニューラルネットワークでの1列の並べ替えでは非常に良く行わ れている。 • Global Max Pooling:[13*13]をあたかも1つのフィルターのように見立て、Maxを使用する。[256]にまで圧縮される。 • Global Avg Pooling:上と同様、Avg。 • 後2つは何故か非常に上手くいく。一気に数値を減らせる割に非常に効率的に特徴量を抽出して認識精度の向上 をはかる事ができる。
24.
Section5:最新のCNN deep convolution network (x_train,
d_train), (x_test, d_test) = load_mnist(flatten=False) # 処理に時間のかかる場合はデータを削減 x_train, d_train = x_train[:5000], d_train[:5000] x_test, d_test = x_test[:1000], d_test[:1000] print("データ読み込み完了") network = DeepConvNet() optimizer = optimizer.Adam() iters_num = 1000 train_size = x_train.shape[0] batch_size = 100 train_loss_list = [] accuracies_train = [] accuracies_test = [] plot_interval=10 for i in range(iters_num): batch_mask = np.random.choice(train_size, batch_size) x_batch = x_train[batch_mask] d_batch = d_train[batch_mask] grad = network.gradient(x_batch, d_batch) optimizer.update(network.params, grad) loss = network.loss(x_batch, d_batch) train_loss_list.append(loss) if (i+1) % plot_interval == 0: accr_train = network.accuracy(x_train, d_train) accr_test = network.accuracy(x_test, d_test) accuracies_train.append(accr_train) accuracies_test.append(accr_test) print('Generation: ' + str(i+1) + '. 正答率(トレーニング) = ' + str(accr_train)) print(' : ' + str(i+1) + '. 正答率(テスト) = ' + str(accr_test)) lists = range(0, iters_num, plot_interval) plt.plot(lists, accuracies_train, label="training set") plt.plot(lists, accuracies_test, label="test set") plt.legend(loc="lower right") plt.title("accuracy") plt.xlabel("count") plt.ylabel("accuracy") plt.ylim(0, 1.0) # グラフの表示 plt.show() 97%以上の精度が達成されている。 高精度での識別が可能となっている
Jetzt herunterladen