Skip to content

Commit

Permalink
Merge pull request #497 from spsanderson/development
Browse files Browse the repository at this point in the history
Fixes #489
  • Loading branch information
spsanderson authored Oct 27, 2023
2 parents db87ba5 + 6a5558e commit 1353f0e
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 10 deletions.
2 changes: 2 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ None
## Minor Fixes and Improvements
1. Fix #480 - Add attributes to output of `ts_growth_rate_vec()`
2. Fix #481 #483 - Update `auto_stationarize()`
3. Fix #489 - Update `ts_auto_arima()` to utilize the parsnip engine of `auto_arima`
if `.tune` is set to `FALSE`

# healthyR.ts 0.2.11

Expand Down
26 changes: 18 additions & 8 deletions R/boilerplate-autoarima.R
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
#' , cumulative = TRUE
#' )
#'
#' ts_auto_arima <- ts_auto_arima(
#' ts_aa <- ts_auto_arima(
#' .data = data,
#' .num_cores = 2,
#' .date_col = date_col,
Expand All @@ -63,7 +63,7 @@
#' .tune = FALSE
#' )
#'
#' ts_auto_arima$recipe_info
#' ts_aa$recipe_info
#' }
#'
#' @return
Expand Down Expand Up @@ -135,14 +135,24 @@ ts_auto_arima <- function(.data, .date_col, .value_col, .formula, .rsamp_obj,
, seasonal_ar = tune::tune()
, seasonal_differences = tune::tune()
, seasonal_ma = tune::tune()
)
) %>%
parsnip::set_mode(mode = "regression") %>%
parsnip::set_engine("arima")
} else {
model_spec <- modeltime::arima_reg()
model_spec <- modeltime::arima_reg() %>%
parsnip::set_mode(mode = "regression") %>%
parsnip::set_engine("auto_arima")
}

model_spec <- model_spec %>%
parsnip::set_mode(mode = "regression") %>%
parsnip::set_engine("arima")
# if (.tune == TRUE){
# model_spec <- model_spec %>%
# parsnip::set_mode(mode = "regression") %>%
# parsnip::set_engine("arima")
# } else {
# model_spec <- model_spec %>%
# parsnip::set_mode(mode = "regression") %>%
# parsnip::set_engine("auto_arima")
# }

# Workflow ----
wflw <- workflows::workflow() %>%
Expand Down Expand Up @@ -256,7 +266,7 @@ ts_auto_arima <- function(.data, .date_col, .value_col, .formula, .rsamp_obj,
attr(output, ".best_metric") <- .best_metric
attr(output, ".bootstrap_final") <- .bootstrap_final
attr(output, ".mode") <- "regression"
attr(output, ".parsnip_engine") <- "arima"
attr(output, ".parsnip_engine") <- ifelse(.tune, "arima", "auto_arima")
attr(output, ".function_family") <- "boilerplate"

return(invisible(output))
Expand Down
4 changes: 2 additions & 2 deletions man/ts_auto_arima.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 1353f0e

Please sign in to comment.