Skip to contents

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

Usage

compute_score_relation(
  scores_pre,
  scores_post,
  relation = "difference",
  minimize = TRUE
)

Arguments

scores_pre

(numeric()) Score before change.

scores_post

(numeric()) Score after change.

relation

(character(1), "difference") Either "difference" or "ratio".

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.

Examples


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

compute_score_relation(pre, post)
#>  [1] 0.72830566 0.41247286 0.15922928 0.84570355 0.88436910 0.39599811
#>  [7] 0.03814079 0.95139597 0.78372752 0.21943974
compute_score_relation(pre, post, "ratio")
#>  [1] 2.13429016 0.01163002 0.86916936 1.39660369 0.18826730 4.39943753
#>  [7] 1.03024210 1.91425802 0.19157035 1.56162023
compute_score_relation(pre, post, minimize = FALSE)
#>  [1] -0.72830566 -0.41247286 -0.15922928 -0.84570355 -0.88436910 -0.39599811
#>  [7] -0.03814079 -0.95139597 -0.78372752 -0.21943974