yardstick percent metrics, different scale?

For percentage yardstick metrics such as MAPE, it seems that 50% is 50 instead of 0.5.

Should this be the case or could there be a scaling option?

The area this affected me is when integrating with other code where 0.5 is 50% and in tables formatting using scales::percent().

Example code below

library(yardstick)
#> For binary classification, the first factor level is assumed to be the event.
#> Use the argument `event_level = "second"` to alter this as needed.
library(dplyr)
#> 
#> Attaching package: 'dplyr'
#> The following objects are masked from 'package:stats':
#> 
#>     filter, lag
#> The following objects are masked from 'package:base':
#> 
#>     intersect, setdiff, setequal, union
library(scales)

df <- tibble::tibble(
  item = c("a"),
  forecast = c(12),
  actual = c(7)
)

my_metric_set <- metric_set(mpe, mape, smape)

df %>%
  group_by(item) %>%
  my_metric_set(
    truth = actual,
    estimate = forecast
  )
#> # A tibble: 3 x 4
#>   item  .metric .estimator .estimate
#>   <chr> <chr>   <chr>          <dbl>
#> 1 a     mpe     standard       -71.4
#> 2 a     mape    standard        71.4
#> 3 a     smape   standard        52.6

scales::percent(52.6)
#> [1] "5 260%"

scales::percent(0.526)
#> [1] "53%"

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.