Skip to contents

Extract the top k trials from a module's optimization history or a TrialLog, ranked by score.

Usage

top_trials(x, k = 5L, objective = c("maximize", "minimize"))

Arguments

x

A DSPrrr module with optimization trials, or a TrialLog object.

k

Integer; number of top trials to return. Default is 5.

objective

Optimization direction: "maximize" (default) or "minimize".

Value

A tibble with the top k trials, including trial_id, score, parameters, and other trial metadata.

Examples

if (FALSE) {
# Get top 3 trials from module
top_trials(mod, k = 3)

# Get top trials from a TrialLog
log <- load_trial_log("path/to/logs")
top_trials(log, k = 10, objective = "minimize")
}