# 6.3 Prototypes and Criticisms
### MMD-critic 如何做為解釋型 AI ?
MMD-critic 提供三面向的解釋-
1. better understand the data distribution
1. building an interpretable model
1. making a black box model interpretable
### Prototype
A prototype is a data instance that is representative of all the data.
用一個特定的data instance代表母體
### Criticism
A criticism is a data instance that is not well represented by the set of prototypes.
與Prototypes不像的data instance
##選擇Prototype與Criticism方法:
1. K-medoids
延伸:https://www.itread01.com/content/1546282480.html
(K-means 和 K-medoids 之間的差異就類似於一個數據樣本的均值和中位數之間的差異)
2. MMD-critic <=章節主要內容
Maximum Mean Discrepancy (MMD)
MMD-critic compares the distribution of the data and the distribution of the selected prototypes.
Selects prototypes that minimize the discrepancy between the two distributions.
選擇一組Prototypes,讓此組之Distribution與母體Distribution差異最小
* Theory
* 先選你想要的Prototypes與Criticisms數量
* 用貪婪的方式(Greedy Search)找出Prototypes
* 用Greedy Search找出Criticisms
* Goal : Minimize MMD2
$MMD^2=\frac{1}{m^2}\sum_{i,j=1}^m{}k(z_i,z_j)-\frac{2}{mn}\sum_{i,j=1}^{m,n}k(z_i,x_j)+\frac{1}{n^2}\sum_{i,j=1}^n{}k(x_i,x_j)$
A choice for the kernel(k) is the radial basis function kernel:
$k(x,x^\prime)=exp\left(-\gamma||x-x^\prime||^2\right)$
延伸:Kernel Function
https://towardsdatascience.com/kernel-function-6f1d2be6091
* Finding Criticism:
$witness(x)=\frac{1}{n}\sum_{i=1}^nk(x,x_i)-\frac{1}{m}\sum_{j=1}^mk(x,z_j)$
### witness function
<公式概念>
用來評估 原始群集與 Prototype 群集之間的相似度
witness = 點X 與原始值的相似度-點X 與經挑選prototype的相似度
<其值代表的意義>
1. 越接近零,表示該點所在處 Prototype 與 原始值分布相似
2. +/-越大方向的值,代表 Prototypes 錯估的方向
這些極端值之絕對值越大,代表點X所在的位置附近的prototype無法被 prototype 好好解釋,適合拿來當criticism
* 負越大代表Prototypes不具代表性
* 正越大代表應該納入更多附近的點當Prototypes
the witness function gives you the means of evaluating in which empirical distribution the point x fits better.
>(語句還原) >> (A) and (B) fits 的程度評估
> the witness function gives you
> (A)the means of evaluating empirical
> fits better
> (B)The distribution which the point x fits in
>
witness function 與 prototype 挑選方式是相互獨立的
(不管prototype手挑還是演算法挑,witness function都可以評估)
### good sanity check
MMD-critic 運用Prototype 與 critics 的分析,可以更了解trainig 資料的分布,也可以了解模型因資料所產生的弱點
Prototype 與 critics 是兩群長的比較不一樣的資料,比較模型對於者兩群的差異,就能知道模型到底夠不夠好
### 缺點
各種參數的甜蜜點難抓
還沒有好的套件可用
延伸(論文) :
https://papers.nips.cc/paper/6300-examples-are-not-enough-learn-to-criticize-criticism-for-interpretability.pdf
###### tags: `重點摘要`