全局代理和局部代理
一、Global Surrogate全局代理
具体步骤如下:
Perform the following steps to obtain a surrogate model:
- 1. Select a dataset X. This can be the same dataset that was used for training the black box model or a new dataset from the same distribution. You could even select a subset of the data or a grid of points, depending on your application.
- 2. For the selected dataset X, get the predictions of the black box model.
- 3. Select an interpretable model type (linear model, decision tree, ...).
- 4. Train the interpretable model on the dataset X and its predictions.
- 5. Congratulations! You now have a surrogate model.
- 6. Measure how well the surrogate model replicates the predictions of the black box model.
- 7. Interpret the surrogate model.
具体怎么衡量代理模拟黑盒模型的好坏程度,我们可以用R-squared
越大说明代理模拟黑盒模型模拟得越好
二、Local Surrogate (LIME)局部代理
Local surrogate models are interpretable models that are used to explain individual predictions of black box machine learning models.强调是对个体预测结果的可解释性
The recipe for training local surrogate models:
-
Select your instance of interest for which you want to have an explanation of its black box prediction.
-
Perturb your dataset and get the black box predictions for these new points.
-
Weight the new samples according to their proximity to the instance of interest.
-
Train a weighted, interpretable model on the dataset with the variations.
-
Explain the prediction by interpreting the local model.
How do you get the variations of the data? This depends on the type of data, which can be either text, image or tabular data. For text and images, the solution is to turn single words or super-pixels on or off. In the case of tabular data, LIME creates new samples by perturbing each feature individually, drawing from a normal distribution with mean and standard deviation taken from the feature.(怎么变换数据?对于image或text,可以关掉单个像素或word;对于tabular,可以从原feature中提取出mean和std,模拟新样本。)