Skip to contents

module_metrics() returns one row per grid-search trial recorded on a module by optimize_grid() (or GridSearchTeleprompter()). Like module_trials(), it reads only module$state$trials.

Usage

module_metrics(module, metrics = NULL, truth = NULL, estimate = NULL, ...)

Arguments

module

A module.

metrics

Optional yardstick metric or metric set. Currently never computed; see Details.

truth, estimate

Column names for the yardstick metrics. Required when metrics is supplied.

...

Passed to the yardstick metrics.

Value

A tibble with one row per trial and columns trial_id, score, mean_score (the trial score), median_score, std_dev, n_evaluated, n_errors, params (list-column of the trial's parameters), scores and yardstick.

Details

The per-example evaluation results are not kept with the trials, so median_score, std_dev, n_evaluated and n_errors are NA, scores is empty, and the yardstick metrics requested with metrics are not computed: the yardstick column is always NULL. Use module_trials() or top_trials() for trial scores.

Examples

# Without trials the result is an empty tibble with these columns
module_metrics(module(signature("text -> sentiment")))
#> # A tibble: 0 × 10
#> # ℹ 10 variables: trial_id <int>, score <dbl>, mean_score <dbl>,
#> #   median_score <dbl>, std_dev <dbl>, n_evaluated <int>, n_errors <int>,
#> #   params <list>, scores <list>, yardstick <list>