From 417434b4ddbbc36f2434e88c96218454548f389b Mon Sep 17 00:00:00 2001 From: "Steven Paul Sanderson II, MPH" Date: Thu, 28 Jul 2022 10:22:14 -0400 Subject: [PATCH] Fixes #342 --- NAMESPACE | 1 + NEWS.md | 5 ++- R/utils-get-boilerplate-fit-wflw.R | 33 ++++++++++++++-- _pkgdown.yml | 4 ++ man/ts_extract_auto_fitted_workflow.Rd | 53 ++++++++++++++++++++++++++ man/ts_get_date_columns.Rd | 2 +- man/ts_is_date_class.Rd | 2 +- 7 files changed, 94 insertions(+), 6 deletions(-) create mode 100644 man/ts_extract_auto_fitted_workflow.Rd diff --git a/NAMESPACE b/NAMESPACE index c3655cc0..6b65b1f0 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -55,6 +55,7 @@ export(ts_auto_xgboost) export(ts_calendar_heatmap_plot) export(ts_compare_data) export(ts_event_analysis_plot) +export(ts_extract_auto_fitted_workflow) export(ts_feature_cluster) export(ts_feature_cluster_plot) export(ts_forecast_simulator) diff --git a/NEWS.md b/NEWS.md index d9f0a4cd..d97ac184 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,6 +1,6 @@ # healthyR.ts (development version) -## Breakingn Changes +## Breaking Changes None ## New Features @@ -9,6 +9,9 @@ out the fitted workflow from any of the Boilerplate functions. ## Minor Fixes and Improvements 1. Fix #343 - Add attributes to output list of boilerplate functions. +2. Fix #347 - Fix `ts_auto_lm()` by dropping `step_rm()` and `step_corr()` which +would prevent `calibrate_and_plot()` from working due to `modeltime_calibration()` +failing. Also dropped unused parameters from function and documentation. # healthyR.ts 0.2.1 diff --git a/R/utils-get-boilerplate-fit-wflw.R b/R/utils-get-boilerplate-fit-wflw.R index 052b440b..aebac79e 100644 --- a/R/utils-get-boilerplate-fit-wflw.R +++ b/R/utils-get-boilerplate-fit-wflw.R @@ -4,15 +4,42 @@ #' #' @author Steven P. Sanderson II, MPH #' -#' @details +#' @details Extract the fitted workflow from a `ts_auto_` function. This will +#' only work on those functions that are designated as _Boilerplate_. #' -#' @description +#' @description Extract the fitted workflow from a `ts_auto_` function. #' -#' @param +#' @param .input This is the output list object of a `ts_auto_` function. #' #' @examples +#' \dontrun{ +#' library(dplyr) +#' +#' data <- AirPassengers %>% +#' ts_to_tbl() %>% +#' select(-index) +#' +#' splits <- time_series_split( +#' data +#' , date_col +#' , assess = 12 +#' , skip = 3 +#' , cumulative = TRUE +#' ) +#' +#' ts_lm <- ts_auto_lm( +#' .data = data, +#' .date_col = date_col, +#' .value_col = value, +#' .rsamp_obj = splits, +#' .formula = value ~ ., +#' ) +#' +#' ts_extract_auto_fitted_workflow(ts_lm) +#' } #' #' @return +#' A fitted `workflow` object. #' #' @export #' diff --git a/_pkgdown.yml b/_pkgdown.yml index 922a117b..0c67e245 100644 --- a/_pkgdown.yml +++ b/_pkgdown.yml @@ -65,8 +65,12 @@ reference: - matches("ts_wfs") - title: Time Series Boiler Plate Functions desc: healthyR.ts automatic time series functions to create in a single call a Recipe, Model Specification, Workflow, Model Fit, Tuned Model and Calibration object. + - subtitle: Auto Workflows - contents: - has_concept("Boiler_Plate") + - subtitle: Extractors + - contents: + - has_concept("Boilerplate Utility") - title: Time Series Vector Functions desc: healthyR.ts vectorized Functions - contents: diff --git a/man/ts_extract_auto_fitted_workflow.Rd b/man/ts_extract_auto_fitted_workflow.Rd new file mode 100644 index 00000000..39570da6 --- /dev/null +++ b/man/ts_extract_auto_fitted_workflow.Rd @@ -0,0 +1,53 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/utils-get-boilerplate-fit-wflw.R +\name{ts_extract_auto_fitted_workflow} +\alias{ts_extract_auto_fitted_workflow} +\title{Extract Boilerplate Items} +\usage{ +ts_extract_auto_fitted_workflow(.input) +} +\arguments{ +\item{.input}{This is the output list object of a \code{ts_auto_} function.} +} +\value{ +A fitted \code{workflow} object. +} +\description{ +Extract the fitted workflow from a \code{ts_auto_} function. +} +\details{ +Extract the fitted workflow from a \code{ts_auto_} function. This will +only work on those functions that are designated as \emph{Boilerplate}. +} +\examples{ +\dontrun{ +library(dplyr) + +data <- AirPassengers \%>\% + ts_to_tbl() \%>\% + select(-index) + +splits <- time_series_split( + data + , date_col + , assess = 12 + , skip = 3 + , cumulative = TRUE +) + +ts_lm <- ts_auto_lm( + .data = data, + .date_col = date_col, + .value_col = value, + .rsamp_obj = splits, + .formula = value ~ ., +) + +ts_extract_auto_fitted_workflow(ts_lm) +} + +} +\author{ +Steven P. Sanderson II, MPH +} +\concept{Boilerplate Utility} diff --git a/man/ts_get_date_columns.Rd b/man/ts_get_date_columns.Rd index 22c2870e..dce9ca2c 100644 --- a/man/ts_get_date_columns.Rd +++ b/man/ts_get_date_columns.Rd @@ -1,5 +1,5 @@ % Generated by roxygen2: do not edit by hand -% Please edit documentation in R/time-helpers.R +% Please edit documentation in R/utils-time-helpers.R \name{ts_get_date_columns} \alias{ts_get_date_columns} \title{Get date or datetime variables (column names)} diff --git a/man/ts_is_date_class.Rd b/man/ts_is_date_class.Rd index 029c7a25..c7b9f4ba 100644 --- a/man/ts_is_date_class.Rd +++ b/man/ts_is_date_class.Rd @@ -1,5 +1,5 @@ % Generated by roxygen2: do not edit by hand -% Please edit documentation in R/time-helpers.R +% Please edit documentation in R/utils-time-helpers.R \name{ts_is_date_class} \alias{ts_is_date_class} \title{Check if an object is a date class}