hai_auto_wflw_metrics(.data)Introduction
When working with the {tidymodels} framework there are ways to pull model metrics from a workflow, since {healthyR.ai} is built on and around the {tidyverse} and {tidymodels} we can do the same. This post will focus on the function hai_auto_wflw_metrics()
Function
Let’s take a look at the function call.
The only parameter is .data and this is strictly the output object of one of the hai_auto_ boiler plate functions
Example
Since this function requires the input from an hai_auto function, we will walk through an example with the iris data set. We are going to use the hai_auto_knn() to classify the Species.
library(healthyR.ai)
data <- iris
rec_obj <- hai_knn_data_prepper(data, Species ~ .)
auto_knn <- hai_auto_knn(
  .data = data,
  .rec_obj = rec_obj,
  .best_metric = "f_meas",
  .model_type = "classification",
  .grid_size = 2,
  .num_cores = 4
)
hai_auto_wflw_metrics(auto_knn)# A tibble: 22 × 9
   neighbors weight_func dist_power .metric  .esti…¹  mean     n std_err .config
       <int> <chr>            <dbl> <chr>    <chr>   <dbl> <int>   <dbl> <chr>  
 1         8 rank             0.888 accuracy multic… 0.95     25 0.00652 Prepro…
 2         8 rank             0.888 bal_acc… macro   0.962    25 0.00471 Prepro…
 3         8 rank             0.888 f_meas   macro   0.947    25 0.00649 Prepro…
 4         8 rank             0.888 kap      multic… 0.922    25 0.0102  Prepro…
 5         8 rank             0.888 mcc      multic… 0.925    25 0.00964 Prepro…
 6         8 rank             0.888 npv      macro   0.975    25 0.00351 Prepro…
 7         8 rank             0.888 ppv      macro   0.949    25 0.00663 Prepro…
 8         8 rank             0.888 precisi… macro   0.949    25 0.00663 Prepro…
 9         8 rank             0.888 recall   macro   0.949    25 0.00633 Prepro…
10         8 rank             0.888 sensiti… macro   0.949    25 0.00633 Prepro…
# … with 12 more rows, and abbreviated variable name ¹.estimator
As we see this pulls out the full metric table from the workflow.
Voila!