Learn R Programming

filtro (version 0.2.0)

show_best_desirability_num: Show best desirability scores, based on number of predictors (plural)

Description

Similar to show_best_desirability_prop() that can simultaneously optimize multiple scores using desirability functions. See show_best_score_num() for singular scoring method.

Usage

show_best_desirability_num(x, ..., num_terms = 5)

Value

A tibble with num_terms

number 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.

num_terms

An integer value specifying the number of predictors to consider.

Details

See show_best_desirability_prop() for details.

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_num(
  ames_scores_results,
  maximize(cor_pearson, low = 0, high = 1)
)

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

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

show_best_desirability_num(
  ames_scores_results,
  maximize(cor_pearson, low = 0, high = 1),
  maximize(imp_rf),
  maximize(infogain),
  num_terms = 2
)

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

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

Run the code above in your browser using DataLab