File size: 340 Bytes
bd39f54
 
0136ac6
c95b9af
bd39f54
11b81b9
bd39f54
 
 
0136ac6
 
11b81b9
bd39f54
11b81b9
bd39f54
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
import matplotlib.pyplot as plt

import shap


def shap_calculate(model, x, feature_names, paint_object):
    explainer = shap.Explainer(model.predict, x)
    shap_values = explainer(x)

    shap.summary_plot(shap_values, x, feature_names=feature_names, show=False)

    plt.title(paint_object.get_name())

    return plt, paint_object