Spaces:
Sleeping
Sleeping
remove .parallel
Browse files- calculate_shap.R +8 -17
calculate_shap.R
CHANGED
@@ -46,8 +46,7 @@ calculate_shap_deprecated <- function(dataset,model,nsim=10) {
|
|
46 |
X = trainset,
|
47 |
pred_wrapper = p_function_G,
|
48 |
nsim = nsim,
|
49 |
-
newdata = trainset_G
|
50 |
-
.parallel = FALSE
|
51 |
)
|
52 |
message(" - Calculating SHAP values for class GM")
|
53 |
shap_values_GM <-
|
@@ -56,8 +55,7 @@ calculate_shap_deprecated <- function(dataset,model,nsim=10) {
|
|
56 |
X = trainset,
|
57 |
pred_wrapper = p_function_GM,
|
58 |
nsim = nsim,
|
59 |
-
newdata = trainset_GM
|
60 |
-
.parallel = FALSE
|
61 |
)
|
62 |
message(" - Calculating SHAP values for class R")
|
63 |
shap_values_R <-
|
@@ -66,8 +64,7 @@ calculate_shap_deprecated <- function(dataset,model,nsim=10) {
|
|
66 |
X = trainset,
|
67 |
pred_wrapper = p_function_R,
|
68 |
nsim = nsim,
|
69 |
-
newdata = trainset_R
|
70 |
-
.parallel = FALSE
|
71 |
)
|
72 |
message(" - Calculating SHAP values for class W")
|
73 |
shap_values_W <-
|
@@ -76,8 +73,7 @@ calculate_shap_deprecated <- function(dataset,model,nsim=10) {
|
|
76 |
X = trainset,
|
77 |
pred_wrapper = p_function_W,
|
78 |
nsim = nsim,
|
79 |
-
newdata = trainset_W
|
80 |
-
.parallel = FALSE
|
81 |
# adjust = TRUE
|
82 |
)
|
83 |
|
@@ -169,8 +165,7 @@ calculate_shap <- function(dataset,model,nsim=10) {
|
|
169 |
X = trainset,
|
170 |
pred_wrapper = p_function_G,
|
171 |
nsim = nsim,
|
172 |
-
newdata = trainset_G
|
173 |
-
.parallel = FALSE
|
174 |
)
|
175 |
message(" - Calculating SHAP values for class GM")
|
176 |
shap_values_GM <-
|
@@ -179,8 +174,7 @@ calculate_shap <- function(dataset,model,nsim=10) {
|
|
179 |
X = trainset,
|
180 |
pred_wrapper = p_function_GM,
|
181 |
nsim = nsim,
|
182 |
-
newdata = trainset_GM
|
183 |
-
.parallel = FALSE
|
184 |
)
|
185 |
message(" - Calculating SHAP values for class R")
|
186 |
shap_values_R <-
|
@@ -189,8 +183,7 @@ calculate_shap <- function(dataset,model,nsim=10) {
|
|
189 |
X = trainset,
|
190 |
pred_wrapper = p_function_R,
|
191 |
nsim = nsim,
|
192 |
-
newdata = trainset_R
|
193 |
-
.parallel = FALSE
|
194 |
)
|
195 |
message(" - Calculating SHAP values for class W")
|
196 |
shap_values_W <-
|
@@ -199,8 +192,7 @@ calculate_shap <- function(dataset,model,nsim=10) {
|
|
199 |
X = trainset,
|
200 |
pred_wrapper = p_function_W,
|
201 |
nsim = nsim,
|
202 |
-
newdata = trainset_W
|
203 |
-
.parallel = FALSE
|
204 |
# adjust = TRUE
|
205 |
)
|
206 |
|
@@ -275,7 +267,6 @@ calculate_shap_class <- function(dataset, new_data, model,nsim=10,
|
|
275 |
pred_wrapper = function_class,
|
276 |
nsim = nsim,
|
277 |
newdata = new_data_class,
|
278 |
-
.parallel = FALSE
|
279 |
)
|
280 |
|
281 |
shap_values_class$class<-Activity
|
|
|
46 |
X = trainset,
|
47 |
pred_wrapper = p_function_G,
|
48 |
nsim = nsim,
|
49 |
+
newdata = trainset_G
|
|
|
50 |
)
|
51 |
message(" - Calculating SHAP values for class GM")
|
52 |
shap_values_GM <-
|
|
|
55 |
X = trainset,
|
56 |
pred_wrapper = p_function_GM,
|
57 |
nsim = nsim,
|
58 |
+
newdata = trainset_GM
|
|
|
59 |
)
|
60 |
message(" - Calculating SHAP values for class R")
|
61 |
shap_values_R <-
|
|
|
64 |
X = trainset,
|
65 |
pred_wrapper = p_function_R,
|
66 |
nsim = nsim,
|
67 |
+
newdata = trainset_R
|
|
|
68 |
)
|
69 |
message(" - Calculating SHAP values for class W")
|
70 |
shap_values_W <-
|
|
|
73 |
X = trainset,
|
74 |
pred_wrapper = p_function_W,
|
75 |
nsim = nsim,
|
76 |
+
newdata = trainset_W
|
|
|
77 |
# adjust = TRUE
|
78 |
)
|
79 |
|
|
|
165 |
X = trainset,
|
166 |
pred_wrapper = p_function_G,
|
167 |
nsim = nsim,
|
168 |
+
newdata = trainset_G
|
|
|
169 |
)
|
170 |
message(" - Calculating SHAP values for class GM")
|
171 |
shap_values_GM <-
|
|
|
174 |
X = trainset,
|
175 |
pred_wrapper = p_function_GM,
|
176 |
nsim = nsim,
|
177 |
+
newdata = trainset_GM
|
|
|
178 |
)
|
179 |
message(" - Calculating SHAP values for class R")
|
180 |
shap_values_R <-
|
|
|
183 |
X = trainset,
|
184 |
pred_wrapper = p_function_R,
|
185 |
nsim = nsim,
|
186 |
+
newdata = trainset_R
|
|
|
187 |
)
|
188 |
message(" - Calculating SHAP values for class W")
|
189 |
shap_values_W <-
|
|
|
192 |
X = trainset,
|
193 |
pred_wrapper = p_function_W,
|
194 |
nsim = nsim,
|
195 |
+
newdata = trainset_W
|
|
|
196 |
# adjust = TRUE
|
197 |
)
|
198 |
|
|
|
267 |
pred_wrapper = function_class,
|
268 |
nsim = nsim,
|
269 |
newdata = new_data_class,
|
|
|
270 |
)
|
271 |
|
272 |
shap_values_class$class<-Activity
|