# 8. HUNG-YI LEE 2022 ML - Auto-encoder/Anomaly Detection ###### tags: `Machine Learning` [slide](https://speech.ee.ntu.edu.tw/~hylee/ml/ml2021-course-data/auto_v8.pdf) [自編碼器 (Auto-encoder) (上) – 基本概念](https://youtu.be/3oHlf8-J3Nc) [自編碼器 (Auto-encoder) (下) – 領結變聲器與更多應用](https://youtu.be/JZvEzb5PV3U) [Anomaly Detection (1/7)](https://youtu.be/gDp2LXGnVLQ) [Anomaly Detection (2/7)](https://youtu.be/cYrNjLxkoXs) [Anomaly Detection (3/7)](https://youtu.be/ueDlm2FkCnw) [Anomaly Detection (4/7)](https://youtu.be/XwkHOUPbc0Q) [Anomaly Detection (5/7)](https://youtu.be/Fh1xFBktRLQ) [Anomaly Detection (6/7)](https://youtu.be/LmFWzmn2rFY) [Anomaly Detection (7/7)](https://youtu.be/6W8FqUGYyDo) ## Self-supervised learning * Pre-train概念: 需要先自己構思出**不需要標記資料的工作**,並利用大量unlabel data來訓練,來學出一個model,eg. BERT填空題、GPT補完文章等等。這些model本身沒什麼用,但是可以用在downstream task上。 而在BERT、GPT之前更古早、不需要標記資料的工作是auto-encoder。 ### auto-encoder的基本概念 * 架構 * 很像cycle GAN概念。 將照片透過兩次轉換後,希望與原始照片越像越好  * 應用 auto-encoder的NN encoder部分常被應用在高維度圖像的**維度壓縮(dimension reduction)**,並且壓縮後的低維度vector(中間)又稱之為bottleneck,**適合用在其他下游任務** * dimension reduction其他補充  * De-noising Auto-encoder  * 其他應用:Feature Disentanglement技術 Disentangle: 把糾纏的東西解開 * 可應用在Voice Conversion語者轉換 過去會採用label成對資料來訓練(監督式學習),現在有auto-encoder的自監督式學習方式,我們已知某些dim是某人的聲音特徵、某些dim代表某人的聲音內容,如下所示:  * 也可應用在影像、nlp上 * 其他應用:Discrete Latent Representation技術 * 中間的latent representation,或中間的embedding可以有不同表示方式  * 知名Discrete Latent Representation方式 - **VQVAE** * 若應用在phonetic上,codebook可以學到基本發音單位(each vector = 母音)  * Text as Representation * encoder & decoder 皆 seq2seq * 需要descriminator(GAN概念),避免中間的summary text只有decoder看得懂  * Tree as Embedding * auto-encoder的其他應用 * decoder可作為generator - **VAE**  * 可用來壓縮(失真lossy的壓縮)  * Anomaly Detection異常檢測 * intro * 新資料與過去訓練資料的相似度 * 訓練一個可以判斷的model來輸出正常/異常 * "相似"的定義取決於應用情境 * 應用 * 詐欺偵測 - 正常刷卡/詐欺刷卡紀錄 * 網路侵入偵測 - 連線紀錄 * 癌症偵測 - 正常細胞vs變異細胞 * 難處: * 正常資料分常多,但異常資料非常少(難以收集),所以無法訓練binary classifier * 解法:auto-encoder * Auto-encoder Approach * 當輸入照片很難重建,可能就是異常狀況 * 其他Anomaly Detection介紹 * [Anomaly Detection (1/7)](https://youtu.be/gDp2LXGnVLQ) [Anomaly Detection (2/7)](https://youtu.be/cYrNjLxkoXs) [Anomaly Detection (3/7)](https://youtu.be/ueDlm2FkCnw) [Anomaly Detection (4/7)](https://youtu.be/XwkHOUPbc0Q) [Anomaly Detection (5/7)](https://youtu.be/Fh1xFBktRLQ) [Anomaly Detection (6/7)](https://youtu.be/LmFWzmn2rFY) [Anomaly Detection (7/7)](https://youtu.be/6W8FqUGYyDo) ### Anomaly Detection * 找出與訓練資料"不一樣"的東西  * 由於異常資料的例子太多(無法全部規在一類);且異常資料很難取得,因此問題無法簡單的用Binary Classification來處理。 * <span style="color:red;font-weight:bold;">問題分類</span>: * 可用logistic regression/generated model/NN來訓練classifier,將training data x輸出對應的y label,而沒看過的東西輸出unknown label。此model為**Open-set Recognition** * 當你的資料沒有label時,又可分為**訓練資料是乾淨的**(僅有正常資料)或**污染的**(混雜異常資料) * <span style="color:red;font-weight:bold;">with Labels架構</span> * 訓練集(使用信心分數的方式) * development集(調整threshold使系統更好,並評估系統好壞),eg.ROC curve * 測試集(給照片predict) * classifier可能的侷限 * 有時候如果分類器是以特徵(eg.膚色)來判別,很有可能會效果很差。**解法**可以**透過收集夠多異常資料,一邊做分類時,看到異常資料給高entropy、正常資料給低entropy**等等;或是**採用GAN並採用一些限制,生成出有點像真實照片的資料**。以下為文獻參考 * <span style="color:red;font-weight:bold;">without Labels架構</span> * 需要訓練資料(eg.玩家,每個玩家表達為一個vector) * 因為沒有Label,無法用classifier及confident。所以我們可以**訓練一個模型輸出機率** * 如何實作呢? 1. 使用likelihood最大化方法 2. 接著找出probability density function(**機率論的多參數Gaussian Distribution**),窮舉所有μ跟Σ,找出最大的值 * 很顯然的,假設常態分布是很強的假設,有其他進階模型可自行深入研究 3. 訂定threshold * 我們可以訓練出自己的μ star跟Σ star * 其他方法: * auto-encoder(參考Anomaly Detection異常檢測 auto-encoder approach) * One-class SVM * Isolated Forest
×
Sign in
Email
Password
Forgot password
or
By clicking below, you agree to our
terms of service
.
Sign in via Facebook
Sign in via Twitter
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
New to HackMD?
Sign up