Model Uncertainty
==
###### tags: `working`
研究一下 Model Uncertainty $\mathcal{I}(y, \theta | x^*, D)$ 的意思...
$\mathcal{I}(y, \theta | x^*, D)$ 的定義是:在給定 new datapoint $x^*$ 和 training dataset $D$ 之後,model i.e. $\theta$ 對 prediction $y$ 的 mutual information
## Mutual information
$X$ 和 $Y$ 為兩個 random variable,定義 $$I(X, Y)=D_{\text{KL}}(P(X,Y)\|P(X)P(Y))$$直覺上的意思是
- "知道 $X$ 後,推論 $Y$ 的能力" 或
- "知道 $Y$ 後,推論 $X$ 的能力"
## 所以 Model Uncertainty 直覺上是...
- 給定 new datapoint $x^*$ 和 training dataset $D$ 之後,$\theta$ 影響 $y$ 的能力
- Model uncertainty 高的將會是 variational layer 重抽樣之後最不穩定的
## 觀察
### 高 model uncertainty
在 notebook 裡面,我們的 data 抓到的之中,model uncertainty 高的是
1. (對人來說不重要,要抓不抓都對) 對 label 人員來說容易漏標很小或很淡的 defect,也許抓了對產線來說是 OVKL
2. (視覺上相像,但規則上不能抓) 明明很像是 Lack_of_SM_Gold 的開窗區
另外,這之中並沒有明顯 misjudge 的部分
### 低 model uncertainty
Model uncertainty 最低的,導通孔露金 Through_Hole 出現次數最多,可能因為其特徵在所有 defect class 是被公認最特別的
### 抓到的 instance (score>0.7) 中,model uncertainty 對應 score 的關係

## 討論
> 高uncertainty,對人類來說不太重要,但卻對模型來說是詭異的,這樣解釋滿合理的阿
> 所以我們可以印出 低的uncertainty 給他們看,然而uncertainty高的就是要多討論、多人工審查。因為高uncertainty可能代表unsure and OOD的情況!
> 高的 model uncertainty 代表高的 total uncertainty,代表模型常常判成多個類別,或者 confidence 忽高忽低
> 這樣都代表這個defect 有其他不是模型熟悉的、或是人類熟悉的information
## 比較 model uncertainty 與 data uncertainty
> **Model uncertainty**, or epistemic uncertainty [23], measures the uncertainty in estimating the model parameters given the training data - this measures how well the model is matched to the data. Model uncertainty is reducible as the size of training data increases.
> **Data uncertainty**, or aleatoric uncertainty [23], is irreducible uncertainty which arises from the natural complexity of the data, such as class overlap, label noise, homoscedastic and heteroscedastic noise. Data uncertainty can be considered a ’known-unknown’ - the model understands (knows) the data and can confidently state whether a given input is difficult to classify (an unknown).
所以有可能的 use cases 是
1. 看到 model uncertainty 大的就加圖
2. 看到 data uncertainty 大的就請人來複判