Skip to contents

Get the best parameter configuration from an optimized module. This is the parameter set that achieved the highest (or lowest, for minimization) score during optimization.

Usage

best_params(module, flatten = TRUE)

Arguments

module

A DSPrrr module that has been optimized.

flatten

Logical; if TRUE (default), return a simple named list. If FALSE, return the parameters as stored (may include nested structure).

Value

A named list of the best parameters, or NULL if the module has not been optimized.

Examples

if (FALSE) {
mod <- module(signature("text -> sentiment"), type = "predict")
mod$optimize_grid(
  data = train_data,
  metric = metric_exact_match(),
  parameters = list(temperature = c(0.3, 0.7, 1.0))
)
best_params(mod)
# $temperature
# [1] 0.7
}