modelDown icon indicating copy to clipboard operation
modelDown copied to clipboard

Custom parameters for explainer functions

Open agosiewska opened this issue 6 years ago • 0 comments

It would be great to have an option to pass arguments to explainers.

For example, I would like to generate modelDown with my own loss function for a variable_importance() function. An analogy for doing something like this, but with modelDown:

library("breakDown")
library("randomForest")
HR_rf_model <- randomForest(factor(status == "fired")~., data = HR, ntree = 100)
explainer_rf  <- explain(HR_rf_model, data = HR, y = HR$status == "fired")

custom_loss_auc <- function(y, yhat) {
  1 - mltools::auc_roc(yhat, y)
}

vd_rf <- variable_importance(explainer_rf, loss = custom_loss_auc)
vd_rf

How about adding parameter params that takes a list with names corresponding to explainer's parameters? For the example above it would be something like this:

modelDown(explainer_rf, params = list("variable_importance" = list(loss = custom_loss))

agosiewska avatar Jul 02 '19 20:07 agosiewska