tidyverts / fabletools

General fable features useful for extension packages
http://fabletools.tidyverts.org/
89 stars 31 forks source link

Add `coverage()` accuracy metric #368

Open mitchelloharawild opened 1 year ago

mitchelloharawild commented 1 year ago
coverage <- function(.dist, .actual, percentile = 80, na.rm = TRUE, ...){
  intvl <- hilo(.dist, percentile)
  within <- (.actual > intvl$lower) & (.actual < intvl$upper)
  mean(within)
}