audit: Deprecated

View source: R/audit.R

auditR Documentation

Deprecated

Description

The audit() function is deprecated, use explain from the DALEX package instead.

Usage

audit(
  object,
  data = NULL,
  y = NULL,
  predict.function = NULL,
  residual.function = NULL,
  label = NULL,
  predict_function = NULL,
  residual_function = NULL
)

Arguments

object

An object containing a model or object of class explainer (see explain).

data

Data.frame or matrix - data that will be used by further validation functions. If not provided, will be extracted from the model.

y

Response vector that will be used by further validation functions. Some functions may require an integer vector containing binary labels with values 0,1. If not provided, will be extracted from the model.

predict.function

Function that takes two arguments: model and data. It should return a numeric vector with predictions.

residual.function

Function that takes three arguments: model, data and response vector. It should return a numeric vector with model residuals for given data. If not provided, response residuals (y-\hat{y}) are calculated.

label

Character - the name of the model. By default it's extracted from the 'class' attribute of the model.

predict_function

Function that takes two arguments: model and data. It should return a numeric vector with predictions.

residual_function

Function that takes three arguments: model, data and response vector. It should return a numeric vector with model residuals for given data. If not provided, response residuals (y-\hat{y}) are calculated.

Value

An object of class explainer.

Examples

data(titanic_imputed, package = "DALEX")

model_glm <- glm(survived ~ ., family = binomial, data = titanic_imputed)
audit_glm <- audit(model_glm,
                   data = titanic_imputed,
                   y = titanic_imputed$survived)

p_fun <- function(model, data) { predict(model, data, response = "link") }
audit_glm_newpred <- audit(model_glm,
                           data = titanic_imputed,
                           y = titanic_imputed$survived,
                           predict.function = p_fun)


library(randomForest)
model_rf <- randomForest(Species ~ ., data=iris)
audit_rf <- audit(model_rf)


auditor documentation built on Nov. 2, 2023, 6:13 p.m.