Skip to contents

Computes the relation of score before a change (e.g. PFI, LOCO, ...) and after.

Usage

compute_score(
  scores_pre,
  scores_post,
  relation = c("difference", "ratio"),
  minimize = TRUE
)

Arguments

scores_pre

(numeric) Score before change.

scores_post

(numeric) Score after change.

relation

(character(1): "difference") Either "difference" or "ratio". If "difference", then scores_post - scores_pre is computed, otherwise scores_post / scores_pre.

minimize

(logical(1), TRUE) Whether the score needs to be minimized (e.g. RMSE) or maximized (e.g. AUC).

Value

A numeric vector of the same length as scores_pre and scores_post

Details

If minimize == TRUE, then scores_post - scores_pre is computed for relation == "difference", otherwise scores_pre - scores_post is given. If minimize == FALSE, then scores_pre - scores_post is computed.

Examples


pre = rnorm(10)
post = pre + runif(10)

compute_score(pre, post)
#>  [1] 0.90602006 0.92675843 0.92669598 0.90918197 0.88983910 0.45575959
#>  [7] 0.61000367 0.09088416 0.36835267 0.37838893
compute_score(pre, post, "ratio")
#>  [1]  0.32430894 -0.09002874  0.36909528  8.85950798  7.17093792 16.39726009
#>  [7]  1.39762237  1.14754062  0.14517079  1.46801779
compute_score(pre, post, minimize = FALSE)
#>  [1] -0.90602006 -0.92675843 -0.92669598 -0.90918197 -0.88983910 -0.45575959
#>  [7] -0.61000367 -0.09088416 -0.36835267 -0.37838893