Skip to contents

Allow for an increase in loss to find a simpler model

Usage

trade_loss_for_simplicity(alphas_grid, losses, increase)

Arguments

alphas_grid

The data frame of model parameters being evaluated

losses

A vector of length equal to rows of alphas_grid, representing the loss associated with each set of model parameters

increase

The allowed increase in loss in percentage points compared to the best observed loss

Value

A scalar integer

See also

Examples

# Returns `1` when all options are equal

alphas_grid <- data.frame(
  alpha = rep(0, 10),
  alpha_seasonal = rep(0, 10),
  alpha_seasonal_decay = rep(0, 10)
)

losses <- rep(1, 10)

trade_loss_for_simplicity(
  alphas_grid = alphas_grid,
  losses = losses,
  increase = 1
)
#> [1] 1

# Considers only options with 0 loss if best loss is 0
# (here, the originally best index with 0 loss has a less simple model)

alphas_grid <- data.frame(
  alpha = c(0.5, rep(0, 2)),
  alpha_seasonal = rep(0, 3),
  alpha_seasonal_decay = rep(0, 3)
)

losses <- c(0, 1, 0)

trade_loss_for_simplicity(
  alphas_grid = alphas_grid,
  losses = losses,
  increase = 1
)
#> [1] 3

# When multiple options exist in the allowed range of performance reduction,
# the best loss of those with the highest simplicity dominates

alphas_grid <- data.frame(
  alpha = c(0.5, 0.5, 0.5, 0.5, 0),
  alpha_seasonal = c(0.5, 0.5, 0, 0, 0),
  alpha_seasonal_decay = c(0.5, 0, 0, 0, 0)
)

losses <- c(100, 101, 103, 102, 110)

trade_loss_for_simplicity(
  alphas_grid = alphas_grid,
  losses = losses,
  increase = 5
)
#> [1] 4