ModelOriented / iBreakDown

Break Down with interactions for local explanations (SHAP, BreakDown, iBreakDown)
https://ModelOriented.github.io/iBreakDown/
GNU General Public License v3.0
82 stars 15 forks source link

Problem with predict function #12

Closed komosinskid closed 5 years ago

komosinskid commented 5 years ago
library(DALEX2)
library(ggplot2)
library(breakDown2)

head(HR)
new_observation <- HR_test[1,]
new_observation

library(nnet)
m_glm <- multinom(status ~ . , data = HR, probabilities = TRUE, model = TRUE)

p_fun <- function(object, newdata){predict(object, newdata=newdata, type="prob")}

bd_glm <- local_attributions(m_glm,
                            data = HR_test,
                            new_observation =  new_observation,
                            keep_distributions = TRUE,
                            predict_function = p_fun)

#bd_glm
plot(bd_glm)
plot(bd_glm, start_baseline = TRUE)
plot(bd_glm, plot_distributions = TRUE)

bd_glm causes error plot bd_glm overlaps figures

plot distrobutions work well

komosinskid commented 5 years ago

sometimes predict returns a vector and sometimes a data frame

pbiecek commented 5 years ago

fixed as in https://modeloriented.github.io/iBreakDown/articles/vignette_breakDown2_classification.html