This function sorts the results by a specific performance metric.

rank_results(x, rank_metric = NULL, select_best = FALSE)

Arguments

x

A workflow set that has all results.

rank_metric

A character string for a metric.

select_best

A logical; should the results only contain the numerically best submodel per workflow.

Value

A tibble with columns: wflow_id, .config, .metric, mean, std_err, n, preprocessor, model, and rank.

Details

If some models have the exact same performance, rank(value, ties.method = "random") is used (with a reproducible seed) so that all ranks are integers.

No columns are returned for the tuning parameters since they are likely to be different (or not exist) for some models. The wflow_id and .config columns can be used to determine the corresponding parameter values.

Examples

rank_results(chi_features_res)
#> # A tibble: 40 × 9 #> wflow_id .config .metric mean std_err n preprocessor model rank #> <chr> <chr> <chr> <dbl> <dbl> <int> <chr> <chr> <int> #> 1 plus_pca_lm Preprocess… rmse 0.574 NA 1 recipe linea… 1 #> 2 plus_pca_lm Preprocess… rsq 0.989 NA 1 recipe linea… 1 #> 3 plus_pca_lm Preprocess… rmse 0.586 NA 1 recipe linea… 2 #> 4 plus_pca_lm Preprocess… rsq 0.989 NA 1 recipe linea… 2 #> 5 plus_pca_lm Preprocess… rmse 0.590 NA 1 recipe linea… 3 #> 6 plus_pca_lm Preprocess… rsq 0.988 NA 1 recipe linea… 3 #> 7 plus_pca_lm Preprocess… rmse 0.591 NA 1 recipe linea… 4 #> 8 plus_pca_lm Preprocess… rsq 0.988 NA 1 recipe linea… 4 #> 9 plus_pca_lm Preprocess… rmse 0.594 NA 1 recipe linea… 5 #> 10 plus_pca_lm Preprocess… rsq 0.989 NA 1 recipe linea… 5 #> # … with 30 more rows
rank_results(chi_features_res, select_best = TRUE)
#> # A tibble: 6 × 9 #> wflow_id .config .metric mean std_err n preprocessor model rank #> <chr> <chr> <chr> <dbl> <dbl> <int> <chr> <chr> <int> #> 1 plus_pca_lm Preprocesso… rmse 0.574 NA 1 recipe linea… 1 #> 2 plus_pca_lm Preprocesso… rsq 0.989 NA 1 recipe linea… 1 #> 3 plus_holid… Preprocesso… rmse 0.646 NA 1 recipe linea… 2 #> 4 plus_holid… Preprocesso… rsq 0.986 NA 1 recipe linea… 2 #> 5 date_lm Preprocesso… rmse 0.733 NA 1 recipe linea… 3 #> 6 date_lm Preprocesso… rsq 0.982 NA 1 recipe linea… 3
rank_results(chi_features_res, rank_metric = "rsq")
#> # A tibble: 40 × 9 #> wflow_id .config .metric mean std_err n preprocessor model rank #> <chr> <chr> <chr> <dbl> <dbl> <int> <chr> <chr> <int> #> 1 plus_pca_lm Preprocess… rmse 0.594 NA 1 recipe linea… 1 #> 2 plus_pca_lm Preprocess… rsq 0.989 NA 1 recipe linea… 1 #> 3 plus_pca_lm Preprocess… rmse 0.574 NA 1 recipe linea… 2 #> 4 plus_pca_lm Preprocess… rsq 0.989 NA 1 recipe linea… 2 #> 5 plus_pca_lm Preprocess… rmse 0.586 NA 1 recipe linea… 3 #> 6 plus_pca_lm Preprocess… rsq 0.989 NA 1 recipe linea… 3 #> 7 plus_pca_lm Preprocess… rmse 0.591 NA 1 recipe linea… 4 #> 8 plus_pca_lm Preprocess… rsq 0.988 NA 1 recipe linea… 4 #> 9 plus_pca_lm Preprocess… rmse 0.590 NA 1 recipe linea… 5 #> 10 plus_pca_lm Preprocess… rsq 0.988 NA 1 recipe linea… 5 #> # … with 30 more rows