SlideShare a Scribd company logo
1 of 53
從統計到人工智慧
Terence Huang
自我介紹
學經歷
緯創資通 高級工程師 (2015/3 ~2019/4)
長庚醫院 研究助理 (2013/9 ~2014/11)
中山大學 應數系統計碩士 (2011/9 ~ 2013/7)
高雄師大 數學系學士 (2005/9 ~ 2009/7)
獲獎
2017 台南智慧黑客松智慧醫療組第二名
2012 中山高大統計新秀
特殊經歷
訪問 MIT 的工程師 (2017/10 ~ 2018/10)
2
Terence Huang
Terence0408 (Slideshare)
Outline
• Impressed Structure In Deep Learning
- Transfer learning
- GAN
- Reinforcement learning
- Capsule, Spiking NN
• Black-box
• Advantage of Statistics
3
Outline
• Impressed Structure In Deep Learning
- Transfer learning
- GAN
- Reinforcement learning
- Capsule, Spiking NN
• Black-box
• Advantage of Statistics
4
Impressed structure in Deep Learning
• Transfer learning family
5
Same Task on Source and
Target Domains
Same Source and Target
Marginal Distribution on X
Same Task on Source and
Target Domains
“Usual”
Learning Setting
Inductive Transfer
Learning
Transductive
Transfer Learning
Unsupervised
Transfer Learning
Multi-task Learning (Source known)
Self-taught Learning (Source unknown)
Domain adaptation Transfer Learning
YesYes
Yes No
No No
Impressed structure in Deep Learning
• Usual Learning (Same source, Same task)
6
Impressed structure in Deep Learning
• Usual Learning (Same source, Same task)
- 先回憶 neural network
• 就比較多條迴歸式一起算的模型
• 一個 unit = 一條迴歸式
7
線性迴歸
𝑊1 𝑋1 + 𝑊2 𝑋2 + 𝑊3 𝑋3 = 𝑓 𝑖=1
𝑛
𝑊𝑖 𝑋𝑖 = Y
Impressed structure in Deep Learning
• Multi-Task Learning (Same source, Different task)
- 一個模型,同時預測多個目標
8
Soft SharingHard Sharing
每個任務都有自己的模型和參數
正規化模型參數距離來保證參數相似性
降低過擬合的風險
Impressed structure in Deep Learning
• Domain adoption (Different source, Same task)
- 適用於初期標註資料不足、資料庫不夠完整、測試集與訓練集有差異
9
現在收集的 database 未來預測目標
Opendata (沒標註)
?
Impressed structure in Deep Learning
• Domain adoption (Different source, Same task)
- Train: Forward
10
features𝑓
class label 𝑦
domain label 𝑑
⋮
feature extractor 𝐺𝑓 ; 𝜃𝑓
domain classifier 𝐺 𝑑 ; 𝜃 𝑑
label predictor 𝐺 𝑦 ; 𝜃 𝑦
Impressed structure in Deep Learning
• Domain adoption (Different source, Same task)
- Train: Backward
11
class label 𝑦
domain label 𝑑
⋮
𝜕𝐿 𝑓
𝜕𝜃 𝑓
Loss 𝐿 𝑓=
𝜕𝐿 𝑦
𝜕𝜃 𝑓
− 𝜆
𝜕𝐿 𝑑
𝜕𝜃 𝑓
𝜕𝐿 𝑦
𝜕𝜃 𝑦
Loss 𝐿 𝑦
𝜕𝐿 𝑑
𝜕𝜃 𝑑
Loss 𝐿 𝑑
features𝑓
Impressed structure in Deep Learning
• Domain adoption (Different source, Same task)
- Backward / Backpropagation
• Adversarial
- Domain classifier 跟 label predictor feature extractor 互相對抗
- Domain classifier 會幫助 label predictor 預測效能
12
Goal 2: 各別任務 loss 越小越好Goal 1: 整體 loss 越小越好
!
!
min
𝜃 𝑦
𝜕𝐿 𝑦
𝜕𝜃 𝑦
& min
𝜃 𝑑
𝜕𝐿 𝑑
𝜕𝜃 𝑑
min
𝜃 𝑓,𝜃 𝑦,𝜃 𝑑
𝜕𝐿 𝑦
𝜕𝜃𝑓
− 𝜆
𝜕𝐿 𝑑
𝜕𝜃𝑓
Impressed structure in Deep Learning
• Transfer learning (Different source, Different task)
- 自己運算資源、訓練模型的資料不足
- 別人已經訓練好任務更大的模型
• 例如 Google 用 ImageNet 訓練好的模型
13
我只是想分類 Dog 和 Cat
Impressed structure in Deep Learning
• Transfer learning (Different source, Different task)
- 把別人的 model (Pre-trained Model) 最後一層拔掉,加入新的層,然後用新資料訓練新層的參數
14
Impressed structure in Deep Learning
• Transfer learning (Different source, Different task)
- 把別人的 model (Pre-trained Model) 最後一層拔掉,加入新的層,然後用新資料訓練新層的參數
15
Outline
• Impressed Structure In Deep Learning
- Transfer learning
- GAN
- Reinforcement learning
- Capsule, Spiking NN
• Black-box
• Advantage of Statistics
16
Impressed structure in Deep Learning
• GAN, Generative Adversarial Network
- Loss 計算相似 Domain adoption
- 以 Image 為例
17
G𝒛𝑰 𝐑𝐞𝐚𝐥 𝑰’ 𝐑𝐞𝐚𝐥
G
生成器
𝒛 + 𝝈
D
分類器
𝑰 𝐅𝐚𝐜𝐤
𝑰 𝐑𝐞𝐚𝐥
Real probability
Encode - Decode
Impressed structure in Deep Learning
• GAN, Generative Adversarial Network
18
G
生成器
𝒛 + 𝝈
D
分類器
𝑰 𝐅𝐚𝐜𝐤
𝑰 𝐑𝐞𝐚𝐥
0.9
0.1
Real probability
0.9
0.9
Ideally In fact
0.7 0.9
Impressed structure in Deep Learning
• GAN, Generative Adversarial Network
- 評估生成器的能力
• 兩個(資料庫 vs 生成)分布是否相同
• Inception Score (IS)
• Fréchet Inception Distance (FID)
- 可以用 GAN 生成新資料嗎?
• Betwend Yes & No. 無法生成超過資料庫的特徵
• ex. 想生成頭朝左的黑馬
只有頭朝右的黑馬→ No
頭朝右的黑馬 & 頭朝左的斑馬→ Yes
19
Impressed structure in Deep Learning
• AnoGAN, Anomaly GAN
- 可在無異常樣本下訓練分類器區分異常、並偵測未知異常圖形
20
real
difference
generated Anomaly detection
異常
正常
正常時的樣貌
Impressed structure in Deep Learning
• AnoGAN, Anomaly GAN
- Train 的過程
• 只用正常影像即可, 𝐺 只生成正常的影像
21
𝑧
取特徵 生成影像 是否為生成
改善 𝐺 生成正常影像的能力
訓練完畢
Encode Decode
正常 正常’
Discriminate
騙成功
騙失敗
Impressed structure in Deep Learning
• AnoGAN, Anomaly GAN
- 用來判斷是否異常
1. 生成正常時該有的樣貌
2. 計算異常分數
22
𝑧
取特徵 生成影像 是否為生成
加噪音改變 𝑧 → 調整生成樣貌
訓練完畢
Encode Decode
異常 生成正常
Discriminate
騙成功
騙失敗
Impressed structure in Deep Learning
• AnoGAN, Anomaly GAN
- 用來判斷是否異常
1. 生成正常時該有的樣貌
2. 計算異常分數
23
Anomaly detection真實異常
正常時的樣貌
生成正常
difference
Outline
• Impressed Structure In Deep Learning
- Transfer learning
- GAN
- Reinforcement learning
- Capsule, Spiking NN
• Black-box
• Advantage of Statistics
24
Impressed structure in Deep Learning
• Reinforcement learning
- 從現在的環境來決定行為,介於監督式和非監督式間
- 應用機器人行為:聊天、物流裝箱、競賽(ex. 打電動)
25
Impressed structure in Deep Learning
• Reinforcement learning
- Plays catch
26
• S, situation
• A, action
■ left, stay, right
• R, reward
■ 1: 接到, 0: 等待掉落, -1: 死掉
• Policy
■ Largest reward: 接到次數最多
http://edersantana.gith
ub.io/articles/keras_rl/
Impressed structure in Deep Learning
• Reinforcement learning
- Plays catch
27
End
𝑺 𝒕
left
stay
right
判定
𝑅𝑡
死掉
接到
等待掉落
Existed NN
𝑺𝒕+𝟏
𝐴 𝑡
Impressed structure in Deep Learning
• Reinforcement learning
- Plays catch
28
𝑺 𝒕
left
stay
right
判定
𝑅𝑡
死掉
接到
等待掉落
Existed NN
𝑺𝒕+𝟏
𝐴 𝑡
Impressed structure in Deep Learning
• Reinforcement learning
- Plays catch, RL part
29
𝑺 𝒕
left
stay
right
判定
𝑅𝑡
死掉
接到
等待掉落
Correct pair(s)
𝑺 𝟏, 𝑨 𝟏
′
, … , (𝑺 𝒕, 𝑨 𝒕
′
)
Modify weight
𝑨 𝒕
′
𝑺𝒕+𝟏
𝐴 𝑡
Existed NN
Impressed structure in Deep Learning
• Reinforcement learning
- Plays catch, RL part
30
Modify 𝐴 𝑡 to 𝐴 𝑡
′
Outline
• Impressed Structure In Deep Learning
- Transfer learning
- GAN
- Reinforcement learning
- Capsule, Spiking NN
• Black-box
• Advantage of Statistics
31
Impressed structure in Deep Learning
• Capsule and Dynamic Routing
- Drawbacks of CNN
• Pooling weak
- Ambivalent the spatial relationships of the previous layer
32
15 9 4 2
11 5 8 6
8 7 3 17
2 3 7 3
15 8
8 17
10 5
5 8
Max pooling
Average pooling
Only keep partial feature
Max is define by input layer, not Bi-layer
旋轉縮放和平移不變性,適應程度較小,需要大量 augmentation 協助
Weight are equal
Who
Impressed structure in Deep Learning
• Capsule and Dynamic Routing
- 用向量代替元素輸出,可捕捉空間結構信息的膠囊概念
33
Tradition NN Capsule Net
Unit: List of objects
objects can be different attributes
Unit: One object
Ex. value, one-hot vector, pixel
Impressed structure in Deep Learning
• Capsule and Dynamic Routing
- 用 routing-by-agreement 取代 max-pooling
34
R
G
B
2
1
⋯ ⋯
Layer I Layer JLayer A Layer B Layer C Layer ZLayer Y
Impressed structure in Deep Learning
• Capsule and Dynamic Routing
- 用 routing-by-agreement 取代 max-pooling
36
R
G
B
2
1
幾乎傳一樣
所以不能迭代太多次
R
G
B
2
1
1st 迭代後
R
G
B
2
1
2nd 迭代後
R
G
B
2
1
nth 迭代後
𝑊𝑖𝑗, 𝐶𝑖𝑗
𝑊𝑖𝑗: 傳統 CNN 的權重,不變
𝐶𝑖𝑗: 𝑖 對 𝑗 的影響力,迭代改變
Layer I Layer J
1 = 𝑖=𝑅,𝐺,𝐵 𝐶𝑖1 ⋅ 𝑊𝑖1 ⋅ capsule 𝑖
𝑊𝑖𝑗, 𝐶𝑖𝑗𝑊𝑖𝑗, 𝐶𝑖𝑗 𝑊𝑖𝑗, 𝐶𝑖𝑗
更新 𝐶𝑖𝑗 ⇒ 𝐶 𝑅1 ↑, 𝐶G1 ↓, 𝐶 𝐵1 ↓,
𝐶 𝑅2 ↓, 𝐶G2 ↓, 𝐶 𝐵2 ↑
再更新 𝐶𝑖𝑗 ⇒ 𝐶 𝑅1 ↑, 𝐶G1 ↓, 𝐶 𝐵1 ↓,
𝐶 𝑅2 ↓, 𝐶G2 ↓, 𝐶 𝐵2 ↑
新的
初始均等
定義
Impressed structure in Deep Learning
• Capsule and Dynamic Routing
- 用 routing-by-agreement 取代 max-pooling
37
壓縮到 [0,1) 保留向量特徵
Impressed structure in Deep Learning
• Spiking NN
- 從其它神經元得到的訊號,該神經元反應強度隨著輸入訊號變化
- 直到強度超過閾值後
• 才傳遞訊號給下個神經元
• 該神經元重置反應強度
38
神經元的突觸樹、軸突和細胞體
Outline
• Impressed Structure In Deep Learning
- Transfer learning
- GAN
- Reinforcement learning
- Capsule, Spiking NN
• Black-box
• Advantage of Statistics
39
Black-box in Deep Learning
40
Predict: wolf
True: wolf
Predict: husky
True: husky
Predict: wolf
True: wolf
Predict: wolf
True: wolf
Predict: husky
True: husky
Predict: wolf
True: husky
Black-box in Deep Learning
• LIME, Local interpretable model-agnostic explanations
- 透過擾動輸入樣本 (perturb the input)
- 來判斷哪些特徵對辨識結果有最大的影響
41
Black-box in Deep Learning
42
Predict: wolf
True: wolf
Predict: husky
True: husky
Predict: wolf
True: wolf
Predict: wolf
True: wolf
Predict: husky
True: husky
Predict: wolf
True: husky
Black-box in Deep Learning
• LRP, Layer-wise relevance propagation
- 將 loss 透過反向傳播 (backpropagation)
- 來判斷每個 pixel 和 unit 與辨識結果的關聯性
43
使用已訓練好的模型權重和預測誤差
不對模型做任何改變
𝑅𝑗 =
𝑘
𝑎 𝑘 𝑤𝑗𝑘
+
𝑗 𝑎 𝑘 𝑤𝑗𝑘
+ 𝑅 𝑘
Black-box in Deep Learning
• LRP, Layer-wise relevance propagation
- Demo website: http://heatmapping.org/mnist.html
44
已存在 model: Long ReLu
1 的判斷9 的判斷 7 的判斷
Black-box in Deep Learning
• LRP, Layer-wise relevance propagation
- Demo website: http://heatmapping.org/mnist.html
45
Black-box in Deep Learning
• Compare
• Ref: Explainable AI 是什麼?為什麼 AI 下判斷要可以解釋?
46
改 model unit 改 image pixel 透過 loss 反傳
任意 model X V V
特定 layer V X V
特定 class X Δ V
小區域敏感度 X V X
計算速度 Δ X V
Soft attention change LIME / IntGrad LRP / GradCAM
Outline
• Impressed Structure In Deep Learning
- Transfer learning
- GAN
- Reinforcement learning
- Capsule, Spiking NN
• Black-box
• Advantage of Statistics
47
Advantage of Statistics in Deep Learning
• [2019/02] 深度學習的發展遇到了 3 個瓶頸!
- Alan Yuille 電腦視覺領域奠基者表示,深度學習正面臨三大瓶頸
• 三大瓶頸:需要大量標註數據、過度擬合基準數據、對圖像變化過度敏感
• 組合爆炸:真實世界的圖像,從組合學觀點來看太大量了
任何一個數據集,不管多大,都很難表達出現實的複雜程度
- Pedro Domingos 分析 1.6 萬篇論文後表示,深度學習的發展終點將近
• [2017/12] AI 熱潮,會不會只是一場泡沫?
- 就像 100 年前的電力、20 年前的網際網路一樣,AI 也會改變每一個產業。
48
Advantage of Statistics in Deep Learning
• CS vs. DS 處理問題方式
49
初階 Computer Science
1. 直接套模型
2. 參考別人調參數和改架構
3. 用更熱門的模型架構
4. 上社群、論壇求解
5. 沒轍了
初階 Data Science / Statistics
1. 分析資料型態
2. 選擇合適模型
3. 猜測可能的問題
4. 找工具 or 方法驗證猜想
5. 調整輸入資料 or 模型參數
6. 沒轍了 初階 CS 可能永久卡關
1. 數學不好
2. 不擅長資料視覺化
統計分析
初階 Statistics 較弱
• 參考 “從統計到資料科學”
Advantage of Statistics in Deep Learning
• CS vs. DS 處理問題方式:用套件找邊界 (pixel 值變化)
50
找肝臟區域 改善腫瘤預測區域
同一個套件為什麼效果差這麼多?
覺得這個套件很爛 腫瘤預測區域 改善預測區域
Advantage of Statistics in Deep Learning
• CS vs. DS 處理問題方式:
51
看了幾個例子後猜測
1. FNH 在 ART vs. PV 差異較 HCC & HEM 大
2. HEM 的質地比 HCC 的不均勻
肝癌 CT 影像
你會怎麼驗證猜測?
Advantage of Statistics in Deep Learning
• 我一開始做論文的處理問題方式:
52
我用折線圖,除了測站間值有高低其他都看不出來
老師:換 Box Plot 畫看看
哇!!真的有東西
為什麼同一個類型 box range 不一樣
我現在會用 group box plot 畫在一起
Outline
• Impressed Structure In Deep Learning
- Transfer learning
- GAN
- Reinforcement learning
- Capsule, Spiking NN
• Black-box
• Advantage of Statistics
53
Q&A
Thanks for your attention!
54

More Related Content

Similar to # From statistics to ai

從 NN 到 嗯嗯
從 NN 到 嗯嗯從 NN 到 嗯嗯
從 NN 到 嗯嗯Heng-Xiu Xu
 
1017_3_ChatGPT挑戰解方及商機_陳縕儂.pdf 1017_3_ChatGPT挑戰解方及商機_陳縕儂.pdf
1017_3_ChatGPT挑戰解方及商機_陳縕儂.pdf 1017_3_ChatGPT挑戰解方及商機_陳縕儂.pdf1017_3_ChatGPT挑戰解方及商機_陳縕儂.pdf 1017_3_ChatGPT挑戰解方及商機_陳縕儂.pdf
1017_3_ChatGPT挑戰解方及商機_陳縕儂.pdf 1017_3_ChatGPT挑戰解方及商機_陳縕儂.pdfKuanTsaeHuang
 
Legacy code 讀書會 1st (Ch1 - Ch5)
Legacy code 讀書會 1st (Ch1 - Ch5)Legacy code 讀書會 1st (Ch1 - Ch5)
Legacy code 讀書會 1st (Ch1 - Ch5)Fong Liou
 
Behavior+tree+ai lite
Behavior+tree+ai liteBehavior+tree+ai lite
Behavior+tree+ai lite勇浩 赖
 
3 clustering 1
3 clustering 13 clustering 1
3 clustering 1FEG
 
用十分鐘開始理解深度學習技術 (從 dnn.js 專案出發)
用十分鐘開始理解深度學習技術  (從 dnn.js 專案出發)用十分鐘開始理解深度學習技術  (從 dnn.js 專案出發)
用十分鐘開始理解深度學習技術 (從 dnn.js 專案出發)鍾誠 陳鍾誠
 
七天基于风险测试—Chinatest
七天基于风险测试—Chinatest七天基于风险测试—Chinatest
七天基于风险测试—Chinatestdrewz lin
 
深度學習(Deep learning)概論- 使用 SAS EM 實做
深度學習(Deep learning)概論- 使用 SAS EM 實做深度學習(Deep learning)概論- 使用 SAS EM 實做
深度學習(Deep learning)概論- 使用 SAS EM 實做SAS TW
 
Java SE 7 技術手冊投影片第 06 章 - 繼承與多型
Java SE 7 技術手冊投影片第 06 章 - 繼承與多型Java SE 7 技術手冊投影片第 06 章 - 繼承與多型
Java SE 7 技術手冊投影片第 06 章 - 繼承與多型Justin Lin
 
簡報規劃與技巧
簡報規劃與技巧簡報規劃與技巧
簡報規劃與技巧基欽 劉
 
NTC_Tensor flow 深度學習快速上手班_Part2 -深度學習
NTC_Tensor flow 深度學習快速上手班_Part2 -深度學習NTC_Tensor flow 深度學習快速上手班_Part2 -深度學習
NTC_Tensor flow 深度學習快速上手班_Part2 -深度學習NTC.im(Notch Training Center)
 
Machine Learning ABC
Machine Learning ABCMachine Learning ABC
Machine Learning ABCtonyblack42
 
Zhongxing practice-suchunshan-qcon
Zhongxing practice-suchunshan-qconZhongxing practice-suchunshan-qcon
Zhongxing practice-suchunshan-qconYiwei Ma
 
TensorFlow 深度學習快速上手班--深度學習
 TensorFlow 深度學習快速上手班--深度學習 TensorFlow 深度學習快速上手班--深度學習
TensorFlow 深度學習快速上手班--深度學習Mark Chang
 
Reinforcement-Learning
Reinforcement-Learning Reinforcement-Learning
Reinforcement-Learning FEG
 
數位多媒體腳本設計(2)
數位多媒體腳本設計(2)數位多媒體腳本設計(2)
數位多媒體腳本設計(2)locky333
 
Master Thesis 2010 - Pattern Discovery Algorithms for Classification
Master Thesis 2010 - Pattern Discovery Algorithms for ClassificationMaster Thesis 2010 - Pattern Discovery Algorithms for Classification
Master Thesis 2010 - Pattern Discovery Algorithms for ClassificationChuancong Gao
 
Sklearn basic - v01
Sklearn   basic - v01Sklearn   basic - v01
Sklearn basic - v01ssuser5e7722
 
Hello DNN
Hello DNNHello DNN
Hello DNNevan li
 

Similar to # From statistics to ai (20)

從 NN 到 嗯嗯
從 NN 到 嗯嗯從 NN 到 嗯嗯
從 NN 到 嗯嗯
 
1017_3_ChatGPT挑戰解方及商機_陳縕儂.pdf 1017_3_ChatGPT挑戰解方及商機_陳縕儂.pdf
1017_3_ChatGPT挑戰解方及商機_陳縕儂.pdf 1017_3_ChatGPT挑戰解方及商機_陳縕儂.pdf1017_3_ChatGPT挑戰解方及商機_陳縕儂.pdf 1017_3_ChatGPT挑戰解方及商機_陳縕儂.pdf
1017_3_ChatGPT挑戰解方及商機_陳縕儂.pdf 1017_3_ChatGPT挑戰解方及商機_陳縕儂.pdf
 
Legacy code 讀書會 1st (Ch1 - Ch5)
Legacy code 讀書會 1st (Ch1 - Ch5)Legacy code 讀書會 1st (Ch1 - Ch5)
Legacy code 讀書會 1st (Ch1 - Ch5)
 
Behavior+tree+ai lite
Behavior+tree+ai liteBehavior+tree+ai lite
Behavior+tree+ai lite
 
3 clustering 1
3 clustering 13 clustering 1
3 clustering 1
 
用十分鐘開始理解深度學習技術 (從 dnn.js 專案出發)
用十分鐘開始理解深度學習技術  (從 dnn.js 專案出發)用十分鐘開始理解深度學習技術  (從 dnn.js 專案出發)
用十分鐘開始理解深度學習技術 (從 dnn.js 專案出發)
 
七天基于风险测试—Chinatest
七天基于风险测试—Chinatest七天基于风险测试—Chinatest
七天基于风险测试—Chinatest
 
深度學習(Deep learning)概論- 使用 SAS EM 實做
深度學習(Deep learning)概論- 使用 SAS EM 實做深度學習(Deep learning)概論- 使用 SAS EM 實做
深度學習(Deep learning)概論- 使用 SAS EM 實做
 
Java SE 7 技術手冊投影片第 06 章 - 繼承與多型
Java SE 7 技術手冊投影片第 06 章 - 繼承與多型Java SE 7 技術手冊投影片第 06 章 - 繼承與多型
Java SE 7 技術手冊投影片第 06 章 - 繼承與多型
 
Culture and cognition
Culture and cognitionCulture and cognition
Culture and cognition
 
簡報規劃與技巧
簡報規劃與技巧簡報規劃與技巧
簡報規劃與技巧
 
NTC_Tensor flow 深度學習快速上手班_Part2 -深度學習
NTC_Tensor flow 深度學習快速上手班_Part2 -深度學習NTC_Tensor flow 深度學習快速上手班_Part2 -深度學習
NTC_Tensor flow 深度學習快速上手班_Part2 -深度學習
 
Machine Learning ABC
Machine Learning ABCMachine Learning ABC
Machine Learning ABC
 
Zhongxing practice-suchunshan-qcon
Zhongxing practice-suchunshan-qconZhongxing practice-suchunshan-qcon
Zhongxing practice-suchunshan-qcon
 
TensorFlow 深度學習快速上手班--深度學習
 TensorFlow 深度學習快速上手班--深度學習 TensorFlow 深度學習快速上手班--深度學習
TensorFlow 深度學習快速上手班--深度學習
 
Reinforcement-Learning
Reinforcement-Learning Reinforcement-Learning
Reinforcement-Learning
 
數位多媒體腳本設計(2)
數位多媒體腳本設計(2)數位多媒體腳本設計(2)
數位多媒體腳本設計(2)
 
Master Thesis 2010 - Pattern Discovery Algorithms for Classification
Master Thesis 2010 - Pattern Discovery Algorithms for ClassificationMaster Thesis 2010 - Pattern Discovery Algorithms for Classification
Master Thesis 2010 - Pattern Discovery Algorithms for Classification
 
Sklearn basic - v01
Sklearn   basic - v01Sklearn   basic - v01
Sklearn basic - v01
 
Hello DNN
Hello DNNHello DNN
Hello DNN
 

More from Terence Huang

# Can we trust ai. the dilemma of model adjustment
# Can we trust ai. the dilemma of model adjustment# Can we trust ai. the dilemma of model adjustment
# Can we trust ai. the dilemma of model adjustmentTerence Huang
 
# 手把手 Python 資料分析 I
# 手把手 Python 資料分析 I# 手把手 Python 資料分析 I
# 手把手 Python 資料分析 ITerence Huang
 
Deep Learning Advance: # Capsule net
Deep Learning Advance: # Capsule netDeep Learning Advance: # Capsule net
Deep Learning Advance: # Capsule netTerence Huang
 
Deep Learning Advance: #01 Domain Adaptation
Deep Learning Advance: #01 Domain AdaptationDeep Learning Advance: #01 Domain Adaptation
Deep Learning Advance: #01 Domain AdaptationTerence Huang
 
文字分析 Python 入門
文字分析 Python 入門文字分析 Python 入門
文字分析 Python 入門Terence Huang
 
從統計到資料科學
從統計到資料科學從統計到資料科學
從統計到資料科學Terence Huang
 

More from Terence Huang (8)

# Can we trust ai. the dilemma of model adjustment
# Can we trust ai. the dilemma of model adjustment# Can we trust ai. the dilemma of model adjustment
# Can we trust ai. the dilemma of model adjustment
 
# 手把手 Python 資料分析 I
# 手把手 Python 資料分析 I# 手把手 Python 資料分析 I
# 手把手 Python 資料分析 I
 
#02 Next RNN
#02 Next RNN#02 Next RNN
#02 Next RNN
 
Deep Learning Advance: # Capsule net
Deep Learning Advance: # Capsule netDeep Learning Advance: # Capsule net
Deep Learning Advance: # Capsule net
 
Deep Learning Advance: #01 Domain Adaptation
Deep Learning Advance: #01 Domain AdaptationDeep Learning Advance: #01 Domain Adaptation
Deep Learning Advance: #01 Domain Adaptation
 
文字分析 Python 入門
文字分析 Python 入門文字分析 Python 入門
文字分析 Python 入門
 
從統計到資料科學
從統計到資料科學從統計到資料科學
從統計到資料科學
 
SQL 語言簡介
SQL 語言簡介 SQL 語言簡介
SQL 語言簡介
 

# From statistics to ai

  • 2. 自我介紹 學經歷 緯創資通 高級工程師 (2015/3 ~2019/4) 長庚醫院 研究助理 (2013/9 ~2014/11) 中山大學 應數系統計碩士 (2011/9 ~ 2013/7) 高雄師大 數學系學士 (2005/9 ~ 2009/7) 獲獎 2017 台南智慧黑客松智慧醫療組第二名 2012 中山高大統計新秀 特殊經歷 訪問 MIT 的工程師 (2017/10 ~ 2018/10) 2 Terence Huang Terence0408 (Slideshare)
  • 3. Outline • Impressed Structure In Deep Learning - Transfer learning - GAN - Reinforcement learning - Capsule, Spiking NN • Black-box • Advantage of Statistics 3
  • 4. Outline • Impressed Structure In Deep Learning - Transfer learning - GAN - Reinforcement learning - Capsule, Spiking NN • Black-box • Advantage of Statistics 4
  • 5. Impressed structure in Deep Learning • Transfer learning family 5 Same Task on Source and Target Domains Same Source and Target Marginal Distribution on X Same Task on Source and Target Domains “Usual” Learning Setting Inductive Transfer Learning Transductive Transfer Learning Unsupervised Transfer Learning Multi-task Learning (Source known) Self-taught Learning (Source unknown) Domain adaptation Transfer Learning YesYes Yes No No No
  • 6. Impressed structure in Deep Learning • Usual Learning (Same source, Same task) 6
  • 7. Impressed structure in Deep Learning • Usual Learning (Same source, Same task) - 先回憶 neural network • 就比較多條迴歸式一起算的模型 • 一個 unit = 一條迴歸式 7 線性迴歸 𝑊1 𝑋1 + 𝑊2 𝑋2 + 𝑊3 𝑋3 = 𝑓 𝑖=1 𝑛 𝑊𝑖 𝑋𝑖 = Y
  • 8. Impressed structure in Deep Learning • Multi-Task Learning (Same source, Different task) - 一個模型,同時預測多個目標 8 Soft SharingHard Sharing 每個任務都有自己的模型和參數 正規化模型參數距離來保證參數相似性 降低過擬合的風險
  • 9. Impressed structure in Deep Learning • Domain adoption (Different source, Same task) - 適用於初期標註資料不足、資料庫不夠完整、測試集與訓練集有差異 9 現在收集的 database 未來預測目標 Opendata (沒標註) ?
  • 10. Impressed structure in Deep Learning • Domain adoption (Different source, Same task) - Train: Forward 10 features𝑓 class label 𝑦 domain label 𝑑 ⋮ feature extractor 𝐺𝑓 ; 𝜃𝑓 domain classifier 𝐺 𝑑 ; 𝜃 𝑑 label predictor 𝐺 𝑦 ; 𝜃 𝑦
  • 11. Impressed structure in Deep Learning • Domain adoption (Different source, Same task) - Train: Backward 11 class label 𝑦 domain label 𝑑 ⋮ 𝜕𝐿 𝑓 𝜕𝜃 𝑓 Loss 𝐿 𝑓= 𝜕𝐿 𝑦 𝜕𝜃 𝑓 − 𝜆 𝜕𝐿 𝑑 𝜕𝜃 𝑓 𝜕𝐿 𝑦 𝜕𝜃 𝑦 Loss 𝐿 𝑦 𝜕𝐿 𝑑 𝜕𝜃 𝑑 Loss 𝐿 𝑑 features𝑓
  • 12. Impressed structure in Deep Learning • Domain adoption (Different source, Same task) - Backward / Backpropagation • Adversarial - Domain classifier 跟 label predictor feature extractor 互相對抗 - Domain classifier 會幫助 label predictor 預測效能 12 Goal 2: 各別任務 loss 越小越好Goal 1: 整體 loss 越小越好 ! ! min 𝜃 𝑦 𝜕𝐿 𝑦 𝜕𝜃 𝑦 & min 𝜃 𝑑 𝜕𝐿 𝑑 𝜕𝜃 𝑑 min 𝜃 𝑓,𝜃 𝑦,𝜃 𝑑 𝜕𝐿 𝑦 𝜕𝜃𝑓 − 𝜆 𝜕𝐿 𝑑 𝜕𝜃𝑓
  • 13. Impressed structure in Deep Learning • Transfer learning (Different source, Different task) - 自己運算資源、訓練模型的資料不足 - 別人已經訓練好任務更大的模型 • 例如 Google 用 ImageNet 訓練好的模型 13 我只是想分類 Dog 和 Cat
  • 14. Impressed structure in Deep Learning • Transfer learning (Different source, Different task) - 把別人的 model (Pre-trained Model) 最後一層拔掉,加入新的層,然後用新資料訓練新層的參數 14
  • 15. Impressed structure in Deep Learning • Transfer learning (Different source, Different task) - 把別人的 model (Pre-trained Model) 最後一層拔掉,加入新的層,然後用新資料訓練新層的參數 15
  • 16. Outline • Impressed Structure In Deep Learning - Transfer learning - GAN - Reinforcement learning - Capsule, Spiking NN • Black-box • Advantage of Statistics 16
  • 17. Impressed structure in Deep Learning • GAN, Generative Adversarial Network - Loss 計算相似 Domain adoption - 以 Image 為例 17 G𝒛𝑰 𝐑𝐞𝐚𝐥 𝑰’ 𝐑𝐞𝐚𝐥 G 生成器 𝒛 + 𝝈 D 分類器 𝑰 𝐅𝐚𝐜𝐤 𝑰 𝐑𝐞𝐚𝐥 Real probability Encode - Decode
  • 18. Impressed structure in Deep Learning • GAN, Generative Adversarial Network 18 G 生成器 𝒛 + 𝝈 D 分類器 𝑰 𝐅𝐚𝐜𝐤 𝑰 𝐑𝐞𝐚𝐥 0.9 0.1 Real probability 0.9 0.9 Ideally In fact 0.7 0.9
  • 19. Impressed structure in Deep Learning • GAN, Generative Adversarial Network - 評估生成器的能力 • 兩個(資料庫 vs 生成)分布是否相同 • Inception Score (IS) • Fréchet Inception Distance (FID) - 可以用 GAN 生成新資料嗎? • Betwend Yes & No. 無法生成超過資料庫的特徵 • ex. 想生成頭朝左的黑馬 只有頭朝右的黑馬→ No 頭朝右的黑馬 & 頭朝左的斑馬→ Yes 19
  • 20. Impressed structure in Deep Learning • AnoGAN, Anomaly GAN - 可在無異常樣本下訓練分類器區分異常、並偵測未知異常圖形 20 real difference generated Anomaly detection 異常 正常 正常時的樣貌
  • 21. Impressed structure in Deep Learning • AnoGAN, Anomaly GAN - Train 的過程 • 只用正常影像即可, 𝐺 只生成正常的影像 21 𝑧 取特徵 生成影像 是否為生成 改善 𝐺 生成正常影像的能力 訓練完畢 Encode Decode 正常 正常’ Discriminate 騙成功 騙失敗
  • 22. Impressed structure in Deep Learning • AnoGAN, Anomaly GAN - 用來判斷是否異常 1. 生成正常時該有的樣貌 2. 計算異常分數 22 𝑧 取特徵 生成影像 是否為生成 加噪音改變 𝑧 → 調整生成樣貌 訓練完畢 Encode Decode 異常 生成正常 Discriminate 騙成功 騙失敗
  • 23. Impressed structure in Deep Learning • AnoGAN, Anomaly GAN - 用來判斷是否異常 1. 生成正常時該有的樣貌 2. 計算異常分數 23 Anomaly detection真實異常 正常時的樣貌 生成正常 difference
  • 24. Outline • Impressed Structure In Deep Learning - Transfer learning - GAN - Reinforcement learning - Capsule, Spiking NN • Black-box • Advantage of Statistics 24
  • 25. Impressed structure in Deep Learning • Reinforcement learning - 從現在的環境來決定行為,介於監督式和非監督式間 - 應用機器人行為:聊天、物流裝箱、競賽(ex. 打電動) 25
  • 26. Impressed structure in Deep Learning • Reinforcement learning - Plays catch 26 • S, situation • A, action ■ left, stay, right • R, reward ■ 1: 接到, 0: 等待掉落, -1: 死掉 • Policy ■ Largest reward: 接到次數最多 http://edersantana.gith ub.io/articles/keras_rl/
  • 27. Impressed structure in Deep Learning • Reinforcement learning - Plays catch 27 End 𝑺 𝒕 left stay right 判定 𝑅𝑡 死掉 接到 等待掉落 Existed NN 𝑺𝒕+𝟏 𝐴 𝑡
  • 28. Impressed structure in Deep Learning • Reinforcement learning - Plays catch 28 𝑺 𝒕 left stay right 判定 𝑅𝑡 死掉 接到 等待掉落 Existed NN 𝑺𝒕+𝟏 𝐴 𝑡
  • 29. Impressed structure in Deep Learning • Reinforcement learning - Plays catch, RL part 29 𝑺 𝒕 left stay right 判定 𝑅𝑡 死掉 接到 等待掉落 Correct pair(s) 𝑺 𝟏, 𝑨 𝟏 ′ , … , (𝑺 𝒕, 𝑨 𝒕 ′ ) Modify weight 𝑨 𝒕 ′ 𝑺𝒕+𝟏 𝐴 𝑡 Existed NN
  • 30. Impressed structure in Deep Learning • Reinforcement learning - Plays catch, RL part 30 Modify 𝐴 𝑡 to 𝐴 𝑡 ′
  • 31. Outline • Impressed Structure In Deep Learning - Transfer learning - GAN - Reinforcement learning - Capsule, Spiking NN • Black-box • Advantage of Statistics 31
  • 32. Impressed structure in Deep Learning • Capsule and Dynamic Routing - Drawbacks of CNN • Pooling weak - Ambivalent the spatial relationships of the previous layer 32 15 9 4 2 11 5 8 6 8 7 3 17 2 3 7 3 15 8 8 17 10 5 5 8 Max pooling Average pooling Only keep partial feature Max is define by input layer, not Bi-layer 旋轉縮放和平移不變性,適應程度較小,需要大量 augmentation 協助 Weight are equal Who
  • 33. Impressed structure in Deep Learning • Capsule and Dynamic Routing - 用向量代替元素輸出,可捕捉空間結構信息的膠囊概念 33 Tradition NN Capsule Net Unit: List of objects objects can be different attributes Unit: One object Ex. value, one-hot vector, pixel
  • 34. Impressed structure in Deep Learning • Capsule and Dynamic Routing - 用 routing-by-agreement 取代 max-pooling 34 R G B 2 1 ⋯ ⋯ Layer I Layer JLayer A Layer B Layer C Layer ZLayer Y
  • 35. Impressed structure in Deep Learning • Capsule and Dynamic Routing - 用 routing-by-agreement 取代 max-pooling 36 R G B 2 1 幾乎傳一樣 所以不能迭代太多次 R G B 2 1 1st 迭代後 R G B 2 1 2nd 迭代後 R G B 2 1 nth 迭代後 𝑊𝑖𝑗, 𝐶𝑖𝑗 𝑊𝑖𝑗: 傳統 CNN 的權重,不變 𝐶𝑖𝑗: 𝑖 對 𝑗 的影響力,迭代改變 Layer I Layer J 1 = 𝑖=𝑅,𝐺,𝐵 𝐶𝑖1 ⋅ 𝑊𝑖1 ⋅ capsule 𝑖 𝑊𝑖𝑗, 𝐶𝑖𝑗𝑊𝑖𝑗, 𝐶𝑖𝑗 𝑊𝑖𝑗, 𝐶𝑖𝑗 更新 𝐶𝑖𝑗 ⇒ 𝐶 𝑅1 ↑, 𝐶G1 ↓, 𝐶 𝐵1 ↓, 𝐶 𝑅2 ↓, 𝐶G2 ↓, 𝐶 𝐵2 ↑ 再更新 𝐶𝑖𝑗 ⇒ 𝐶 𝑅1 ↑, 𝐶G1 ↓, 𝐶 𝐵1 ↓, 𝐶 𝑅2 ↓, 𝐶G2 ↓, 𝐶 𝐵2 ↑ 新的 初始均等 定義
  • 36. Impressed structure in Deep Learning • Capsule and Dynamic Routing - 用 routing-by-agreement 取代 max-pooling 37 壓縮到 [0,1) 保留向量特徵
  • 37. Impressed structure in Deep Learning • Spiking NN - 從其它神經元得到的訊號,該神經元反應強度隨著輸入訊號變化 - 直到強度超過閾值後 • 才傳遞訊號給下個神經元 • 該神經元重置反應強度 38 神經元的突觸樹、軸突和細胞體
  • 38. Outline • Impressed Structure In Deep Learning - Transfer learning - GAN - Reinforcement learning - Capsule, Spiking NN • Black-box • Advantage of Statistics 39
  • 39. Black-box in Deep Learning 40 Predict: wolf True: wolf Predict: husky True: husky Predict: wolf True: wolf Predict: wolf True: wolf Predict: husky True: husky Predict: wolf True: husky
  • 40. Black-box in Deep Learning • LIME, Local interpretable model-agnostic explanations - 透過擾動輸入樣本 (perturb the input) - 來判斷哪些特徵對辨識結果有最大的影響 41
  • 41. Black-box in Deep Learning 42 Predict: wolf True: wolf Predict: husky True: husky Predict: wolf True: wolf Predict: wolf True: wolf Predict: husky True: husky Predict: wolf True: husky
  • 42. Black-box in Deep Learning • LRP, Layer-wise relevance propagation - 將 loss 透過反向傳播 (backpropagation) - 來判斷每個 pixel 和 unit 與辨識結果的關聯性 43 使用已訓練好的模型權重和預測誤差 不對模型做任何改變 𝑅𝑗 = 𝑘 𝑎 𝑘 𝑤𝑗𝑘 + 𝑗 𝑎 𝑘 𝑤𝑗𝑘 + 𝑅 𝑘
  • 43. Black-box in Deep Learning • LRP, Layer-wise relevance propagation - Demo website: http://heatmapping.org/mnist.html 44 已存在 model: Long ReLu 1 的判斷9 的判斷 7 的判斷
  • 44. Black-box in Deep Learning • LRP, Layer-wise relevance propagation - Demo website: http://heatmapping.org/mnist.html 45
  • 45. Black-box in Deep Learning • Compare • Ref: Explainable AI 是什麼?為什麼 AI 下判斷要可以解釋? 46 改 model unit 改 image pixel 透過 loss 反傳 任意 model X V V 特定 layer V X V 特定 class X Δ V 小區域敏感度 X V X 計算速度 Δ X V Soft attention change LIME / IntGrad LRP / GradCAM
  • 46. Outline • Impressed Structure In Deep Learning - Transfer learning - GAN - Reinforcement learning - Capsule, Spiking NN • Black-box • Advantage of Statistics 47
  • 47. Advantage of Statistics in Deep Learning • [2019/02] 深度學習的發展遇到了 3 個瓶頸! - Alan Yuille 電腦視覺領域奠基者表示,深度學習正面臨三大瓶頸 • 三大瓶頸:需要大量標註數據、過度擬合基準數據、對圖像變化過度敏感 • 組合爆炸:真實世界的圖像,從組合學觀點來看太大量了 任何一個數據集,不管多大,都很難表達出現實的複雜程度 - Pedro Domingos 分析 1.6 萬篇論文後表示,深度學習的發展終點將近 • [2017/12] AI 熱潮,會不會只是一場泡沫? - 就像 100 年前的電力、20 年前的網際網路一樣,AI 也會改變每一個產業。 48
  • 48. Advantage of Statistics in Deep Learning • CS vs. DS 處理問題方式 49 初階 Computer Science 1. 直接套模型 2. 參考別人調參數和改架構 3. 用更熱門的模型架構 4. 上社群、論壇求解 5. 沒轍了 初階 Data Science / Statistics 1. 分析資料型態 2. 選擇合適模型 3. 猜測可能的問題 4. 找工具 or 方法驗證猜想 5. 調整輸入資料 or 模型參數 6. 沒轍了 初階 CS 可能永久卡關 1. 數學不好 2. 不擅長資料視覺化 統計分析 初階 Statistics 較弱 • 參考 “從統計到資料科學”
  • 49. Advantage of Statistics in Deep Learning • CS vs. DS 處理問題方式:用套件找邊界 (pixel 值變化) 50 找肝臟區域 改善腫瘤預測區域 同一個套件為什麼效果差這麼多? 覺得這個套件很爛 腫瘤預測區域 改善預測區域
  • 50. Advantage of Statistics in Deep Learning • CS vs. DS 處理問題方式: 51 看了幾個例子後猜測 1. FNH 在 ART vs. PV 差異較 HCC & HEM 大 2. HEM 的質地比 HCC 的不均勻 肝癌 CT 影像 你會怎麼驗證猜測?
  • 51. Advantage of Statistics in Deep Learning • 我一開始做論文的處理問題方式: 52 我用折線圖,除了測站間值有高低其他都看不出來 老師:換 Box Plot 畫看看 哇!!真的有東西 為什麼同一個類型 box range 不一樣 我現在會用 group box plot 畫在一起
  • 52. Outline • Impressed Structure In Deep Learning - Transfer learning - GAN - Reinforcement learning - Capsule, Spiking NN • Black-box • Advantage of Statistics 53
  • 53. Q&A Thanks for your attention! 54