loss_yardstick: Wrapper for Loss Functions from the yardstick Package

View source: R/misc_loss_functions.R

loss_yardstickR Documentation

Wrapper for Loss Functions from the yardstick Package

Description

The yardstick package provides many auxiliary functions for calculating the predictive performance of the model. However, they have an interface that is consistent with the tidyverse philosophy. The loss_yardstick function adapts loss functions from the yardstick package to functions understood by DALEX. Type compatibility for y-values and for predictions must be guaranteed by the user.

Usage

loss_yardstick(loss, reverse = FALSE, reference = 1)

Arguments

loss

loss function from the yardstick package

reverse

shall the metric be reversed? for loss metrics lower values are better. reverse = TRUE is useful for accuracy-like metrics

reference

if the metric is reverse then it is calculated as reference - loss. The default value is 1.

Value

loss function that can be used in the model_parts function

Examples

 
 titanic_glm_model <- glm(survived~., data = titanic_imputed, family = "binomial")
 explainer_glm <- DALEX::explain(titanic_glm_model,
                                 data = titanic_imputed[,-8],
                                 y = factor(titanic_imputed$survived))
 # See the 'How to use DALEX with the yardstick package' vignette
 # which explains this model with measures implemented in the 'yardstick' package



DALEX documentation built on Jan. 16, 2023, 1:06 a.m.

Related to loss_yardstick in DALEX...