Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ When adding or changing user-facing behavior:
- happy path
- 1–2 edge cases
- regression test for the bug/feature request (if applicable)
- avoid using finnts::: or finnts:: to call internal/exported functions; instead, call them directly (e.g. use `my_function()` instead of `finnts:::my_function()`).
4. **Docs**:
- update roxygen comments (`@param`, `@return`, `@examples`)
- run `devtools::document()` so `man/*.Rd` stays in sync
Expand Down
3 changes: 2 additions & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: finnts
Title: Microsoft Finance Time Series Forecasting Framework
Version: 0.6.0.9022
Version: 0.6.0.9023
Authors@R:
c(person(given = "Mike",
family = "Tokic",
Expand Down Expand Up @@ -43,6 +43,7 @@ Imports:
glue,
glmnet,
gtools,
hardhat,
hts,
kernlab,
lubridate,
Expand Down
2 changes: 1 addition & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# finnts 0.6.0.9022 (development version)
# finnts 0.6.0.9023 (development version)

## Improvements
- TimeGPT Integration
Expand Down
2 changes: 1 addition & 1 deletion R/ensemble_models.R
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ ensemble_models <- function(run_info,

set.seed(seed)

grid <- dials::grid_latin_hypercube(parameters, size = num_hyperparameters)
grid <- dials::grid_space_filling(parameters, size = num_hyperparameters)

hyperparameters_temp <- grid %>%
dplyr::group_split(dplyr::row_number(), .keep = FALSE) %>%
Expand Down
10 changes: 5 additions & 5 deletions R/models.R
Original file line number Diff line number Diff line change
Expand Up @@ -481,15 +481,15 @@ get_kfold_tune_grid <- function(train_data,
)
}

#' Get grid_latin_hypercube
#' Get space-filling grid
#'
#' @param model_spec Model Spec Obj
#'
#' @return gives the latin hypercube grid
#' @return gives a space-filling parameter grid
#' @noRd
get_latin_hypercube_grid <- function(model_spec) {
dials::grid_latin_hypercube(
dials::parameters(model_spec),
get_space_filling_grid <- function(model_spec) {
dials::grid_space_filling(
hardhat::extract_parameter_set_dials(model_spec),
size = 10
)
}
Expand Down
4 changes: 2 additions & 2 deletions R/parallel_util.R
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ par_start <- function(run_info,
add_packages <- c(add_packages, "arrow")
}

if (run_info$object_output == "qs") {
add_packages <- c(add_packages, "qs")
if (run_info$object_output == "qs2") {
add_packages <- c(add_packages, "qs2")
}

# register cluster
Expand Down
26 changes: 16 additions & 10 deletions R/timegpt_model.R
Original file line number Diff line number Diff line change
Expand Up @@ -320,16 +320,22 @@ pad_time_series_data <- function(train_df, date_type, min_size = NULL) {
}

# For each combo, calculate how far back we need to go to add required rows
combos_to_pad <- combos_to_pad %>%
dplyr::mutate(
start_date = dplyr::case_when(
date_type == "day" ~ earliest_date - lubridate::days(rows_to_add),
date_type == "week" ~ earliest_date - lubridate::weeks(rows_to_add),
date_type == "month" ~ earliest_date - months(rows_to_add),
date_type == "quarter" ~ earliest_date - months(rows_to_add * 3),
date_type == "year" ~ earliest_date - lubridate::years(rows_to_add)
)
)
if (date_type == "day") {
combos_to_pad <- combos_to_pad %>%
dplyr::mutate(start_date = earliest_date - lubridate::days(rows_to_add))
} else if (date_type == "week") {
combos_to_pad <- combos_to_pad %>%
dplyr::mutate(start_date = earliest_date - lubridate::weeks(rows_to_add))
} else if (date_type == "month") {
combos_to_pad <- combos_to_pad %>%
dplyr::mutate(start_date = earliest_date - months(rows_to_add))
} else if (date_type == "quarter") {
combos_to_pad <- combos_to_pad %>%
dplyr::mutate(start_date = earliest_date - months(rows_to_add * 3))
} else if (date_type == "year") {
combos_to_pad <- combos_to_pad %>%
dplyr::mutate(start_date = earliest_date - lubridate::years(rows_to_add))
}

# Create complete date sequences for each combo
create_date_sequence <- function(start, end, by_type) {
Expand Down
2 changes: 1 addition & 1 deletion R/utility.R
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ utils::globalVariables(c(
"to", "total_rows", "weighted_mape", "Analysis_Type", "Metric", "Value_Numeric",
"is_stationary", "outlier_pct", "model_class", "section", "value", "Hierarchy_Level",
"Sort_Order", "run_id", "date_type", "file_path", "models_to_run", "underscore_count",
"max_iterations", "run_complete"
"max_iterations", "run_complete", "earliest_date", "rows_to_add"
))

#' @importFrom magrittr %>%
Expand Down
Loading
Loading