Learn R Programming

filtro (version 0.2.0)

show_best_desirability_prop: Show best desirability scores, based on proportion of predictors (plural)

Description

Analogous to, and adapted from desirability2::show_best_desirability() that can simultaneously optimize multiple scores using desirability functions. See show_best_score_prop() for singular filtering method.

Usage

show_best_desirability_prop(x, ..., prop_terms = 1)

Value

A tibble with prop_terms

proportion of rows. When showing the results, the metrics are presented in "wide format" (one column per metric) and there are new columns for the corresponding desirability values (each starts with .d_).

Arguments

x

A tibble or data frame returned by fill_safe_values().

...

One or more desirability selectors to configure the optimization.

prop_terms

A numeric value specifying the proportion of predictors to consider.

Details

Desirability functions might help when selecting the best model based on more than one performance metric. The user creates a desirability function to map values of a metric to a [0, 1] range where 1.0 is most desirable and zero is unacceptable. After constructing these for the metric of interest, the overall desirability is computed using the geometric mean of the individual desirabilities.

The verbs that can be used in ... (and their arguments) are:

  • maximize() when larger values are better, such as the area under the ROC score.

  • minimize() for metrics such as RMSE or the Brier score.

  • target() for cases when a specific value of the metric is important.

  • constrain() is used when there is a range of values that are equally desirable.

Examples

Run this code

library(desirability2)
library(dplyr)

# Remove outcome
ames_scores_results <- ames_scores_results |>
  dplyr::select(-outcome)
ames_scores_results

show_best_desirability_prop(
  ames_scores_results,
  maximize(cor_pearson, low = 0, high = 1)
)

show_best_desirability_prop(
  ames_scores_results,
  maximize(cor_pearson, low = 0, high = 1),
  maximize(imp_rf)
)

show_best_desirability_prop(
  ames_scores_results,
  maximize(cor_pearson, low = 0, high = 1),
  maximize(imp_rf),
  maximize(infogain)
)

show_best_desirability_prop(
  ames_scores_results,
  maximize(cor_pearson, low = 0, high = 1),
  maximize(imp_rf),
  maximize(infogain),
  prop_terms = 0.2
)

show_best_desirability_prop(
  ames_scores_results,
  target(cor_pearson, low = 0.2, target = 0.255, high = 0.9)
)

show_best_desirability_prop(
  ames_scores_results,
  constrain(cor_pearson, low = 0.2, high = 1)
)

Run the code above in your browser using DataLab