Skip to content

Custom parameters for explainer functions #75

@agosiewska

Description

@agosiewska

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))

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions