LLH commited on
Commit
9ceac59
·
1 Parent(s): 3cfb9a3

2024/03/09/15:00

Browse files
Files changed (2) hide show
  1. analysis/others/shap_model.py +3 -3
  2. data/notes.md +2 -0
analysis/others/shap_model.py CHANGED
@@ -7,7 +7,7 @@ from classes.static_custom_class import StaticValue
7
 
8
  def draw_shap_beeswarm(model, x, feature_names, type, paint_object):
9
  plt.clf()
10
- x = shap.sample(x, min(123, len(x)), random_state=StaticValue.RANDOM_STATE)
11
  explainer = shap.KernelExplainer(model.predict, x)
12
  shap_values = explainer(x)
13
 
@@ -21,7 +21,7 @@ def draw_shap_beeswarm(model, x, feature_names, type, paint_object):
21
 
22
  def draw_waterfall(model, x, feature_names, number, paint_object):
23
  plt.clf()
24
- x = shap.sample(x, min(123, len(x)), random_state=StaticValue.RANDOM_STATE)
25
  explainer = shap.KernelExplainer(model.predict, x, feature_names=feature_names)
26
  shap_values = explainer(x)
27
 
@@ -48,7 +48,7 @@ def draw_force(model, x, feature_names, number, paint_object):
48
 
49
  def draw_dependence(model, x, feature_names, col, paint_object):
50
  plt.clf()
51
- x = shap.sample(x, min(123, len(x)), random_state=StaticValue.RANDOM_STATE)
52
  explainer = shap.KernelExplainer(model.predict, x, feature_names=feature_names)
53
  shap_values = explainer(x)
54
 
 
7
 
8
  def draw_shap_beeswarm(model, x, feature_names, type, paint_object):
9
  plt.clf()
10
+ x = shap.sample(x, min(60, len(x)), random_state=StaticValue.RANDOM_STATE)
11
  explainer = shap.KernelExplainer(model.predict, x)
12
  shap_values = explainer(x)
13
 
 
21
 
22
  def draw_waterfall(model, x, feature_names, number, paint_object):
23
  plt.clf()
24
+ x = shap.sample(x, min(60, len(x)), random_state=StaticValue.RANDOM_STATE)
25
  explainer = shap.KernelExplainer(model.predict, x, feature_names=feature_names)
26
  shap_values = explainer(x)
27
 
 
48
 
49
  def draw_dependence(model, x, feature_names, col, paint_object):
50
  plt.clf()
51
+ x = shap.sample(x, min(60, len(x)), random_state=StaticValue.RANDOM_STATE)
52
  explainer = shap.KernelExplainer(model.predict, x, feature_names=feature_names)
53
  shap_values = explainer(x)
54
 
data/notes.md CHANGED
@@ -10,6 +10,8 @@
10
  - ଘ(੭ˊ꒳​ˋ)੭
11
 
12
  ## 注意事项
 
 
13
  - 模型训练和可视化过程暂未实现进度条,后续版本可能会出该功能
14
 
15
  ## 解释
 
10
  - ଘ(੭ˊ꒳​ˋ)੭
11
 
12
  ## 注意事项
13
+ - 程序部署在Hugginface上,为gradio框架,由于gradio直接部署的方案是刚出的,所以有时候程序可能存在不稳定
14
+ - 若程序出现ERROR,刷新重新开始即可
15
  - 模型训练和可视化过程暂未实现进度条,后续版本可能会出该功能
16
 
17
  ## 解释