performance_metrics.Rd 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. % Generated by roxygen2: do not edit by hand
  2. % Please edit documentation in R/diagnostics.R
  3. \name{performance_metrics}
  4. \alias{performance_metrics}
  5. \title{Compute performance metrics from cross-validation results.}
  6. \usage{
  7. performance_metrics(df, metrics = NULL, rolling_window = 0.1)
  8. }
  9. \arguments{
  10. \item{df}{The dataframe returned by cross_validation.}
  11. \item{metrics}{An array of performance metrics to compute. If not provided,
  12. will use c('mse', 'rmse', 'mae', 'mape', 'coverage').}
  13. \item{rolling_window}{Proportion of data to use in each rolling window for
  14. computing the metrics. Should be in [0, 1].}
  15. }
  16. \value{
  17. A dataframe with a column for each metric, and column 'horizon'.
  18. }
  19. \description{
  20. Computes a suite of performance metrics on the output of cross-validation.
  21. By default the following metrics are included:
  22. 'mse': mean squared error
  23. 'rmse': root mean squared error
  24. 'mae': mean absolute error
  25. 'mape': mean percent error
  26. 'coverage': coverage of the upper and lower intervals
  27. }
  28. \details{
  29. A subset of these can be specified by passing a list of names as the
  30. `metrics` argument.
  31. Metrics are calculated over a rolling window of cross validation
  32. predictions, after sorting by horizon. The size of that window (number of
  33. simulated forecast points) is determined by the rolling_window argument,
  34. which specifies a proportion of simulated forecast points to include in
  35. each window. rolling_window=0 will compute it separately for each simulated
  36. forecast point (i.e., 'mse' will actually be squared error with no mean).
  37. The default of rolling_window=0.1 will use 10% of the rows in df in each
  38. window. rolling_window=1 will compute the metric across all simulated
  39. forecast points. The results are set to the right edge of the window.
  40. The output is a dataframe containing column 'horizon' along with columns
  41. for each of the metrics computed.
  42. }