# finnts 0.7.0

## Improvements

- New AI Agent Capabilities
  - `iterate_forecast()` can use LLM's to find the optimal combination of data and inputs to create the most accurate forecast. 
  - `update_forecast()` can take previously trained models from `iterate_forecast()` to create forecasts on new data fast.  
  - `ask_agent()` can be used to ask questions about the forecast, data, or models to get insights.
  - Helper functions `set_project_info()` and `set_agent_info` to assist in iterating and updating forecasts. 
  - New functions to retrieve information from agent runs:
    - Added `get_agent_forecast()` to retrieve the final forecast output from an agent run.
    - Added `get_best_agent_run()` to retrieve the run metadata information from an agent run. 
    - Added `get_summarized_models()` to retrieve model summary information from an agent run.
    - Added `get_eda_data()` to retrieve the exploratory data analysis results from an agent run.

- New Chronos2 Model Integration
  - Added Chronos2, in addition to the existing model, to support zero-shot forecasting
  - It supports both historical and future external regressors
  - It can be used as a global model
  - Added a Chronos controller, which will support other Chronos variant API POST requests as well
  - Added two new package dependencies: `jsonlite` and `httr`
  - Integrated Chronos2 into the finn agent workflow
  - Added `chronos-bolt-base` foundation model. Uses the same Chronos API as `chronos2` but does not support external regressors. Passes `model_type = "chronos-bolt-base"` to the API.
  - Added `chronos-bolt-tiny` foundation model. Lightweight Chronos model variant using the same API as `chronos2` and `chronos-bolt-base`. Does not support external regressors. Passes `model_type = "chronos-bolt-tiny"` to the API.

- New TimesFM Integration
  - Added TimesFM as a new foundation model for zero-shot time series forecasting
  - TimesFM is a local-only model (not global) that does not support external regressors
  - Uses its own API endpoint, configured via `TIMESFM_API_URL` and `TIMESFM_API_TOKEN` environment variables
  - Supports daily, weekly, monthly, quarterly, and yearly frequency data

- New TimeGPT Integration
  - Added TimeGPT in addition to existing model to support zero shot forecasting
  - Added support for both historical and future external regressors
  - Added timegpt-long-horizon model
  - Added finetuning for depth and layers
  - Enabled TimeGPT as a global model
  - Added support for padding time series that don't meet minimum data requirements
  - Integrated TimeGPT into the finn agent workflow
  - Declared `nixtlar` as an optional dependency. TimeGPT requires R 4.1 or newer, while core FinnTS workflows remain available on R 4.0.

- Updated Train Model function
  - Added debug arg to trace error while training over various models
  - Fixed differencing restoration for combo data in global models.
    
- Updated how outliers are handled in `prep_data()`. Outliers are removed from the training data, but still kept in the testing splits during time series cross validation.

- Adaptive daily ARIMA to reduce runtime
  - Users continue to select `"arima"`; daily workflows now use the bounded `arima_fast` engine while non-daily workflows retain classic `auto_arima` behavior.
  - The daily engine validates nonseasonal, weekly-difference, 364/365-day-difference, and Fourier-with-ARIMA-errors strategies on an internal holdout, then refits the simplest competitive strategy. Finn's outer back-tests continue to score original targets when outlier cleaning is enabled.
  - Daily candidate searches use nonseasonal frequency-one ARIMA fits and never construct the expensive period-365 seasonal state-space model.
  - Candidate failures fall through to another validation-successful strategy or a deterministic drift fallback. No model timeout or process-termination behavior was added.
  - Agent model summaries identify the actual engine, selected strategy, transformed and effective ARIMA orders, Fourier/seasonal settings, validation WMAPE, candidate scores, and fallback status.
  - Added `forecast` as a direct `Imports` dependency. It was already transitively required by `modeltime`; using its mature ARIMA implementation avoids reimplementing numerical estimation. This adds no new runtime service, credential, or network surface and retains the package's existing open-source dependency chain.

- Updated optional variable-importance support for `vip` 0.5.0. `vip` remains
  in `Suggests` and is resolved from its maintainer's r-universe repository.
  `ranger` is now declared directly in `Suggests`, and Boruta feature selection
  uses Boruta's ranger adapter to preserve behavior after Boruta 10.0 changed
  its default importance provider. FinnTS continues to install and run without
  these optional packages: feature selection now fails early with installation
  guidance, while model summaries retain all sections except variable
  importance.

## Bug Fixes

-   Prevented random MARS tuning failures when `prune_method = "cv"` was selected without the required folds. Automatic grids now use the five non-CV pruning methods, while explicit multistep CV pruning supplies a bounded fold count.
-   Fixed `subscript out of bounds` failures for time series combos containing non-ASCII characters. File name hashes are now stable regardless of how the text was read in (e.g. `read.csv` vs `vroom`), so input data, EDA, and forecast outputs resolve to the same file.
-   Fixed partial-fold models incorrectly winning Best_Model selection. Models that fail on some back-test folds are now excluded from best-model ranking while other complete models continue normally.
-   Fixed `null_converter()` crash in agent workflow when input is `NA`.
-   Added retry with exponential backoff (up to 3 retries) for Chronos and TimesFM API calls on transient failures (HTTP 429, 5xx, connection errors).
-   Fixed hierarchical forecast reconciliation failure caused by floating-point Target discrepancies across models.
-   Improved error messages during hierarchical reconciliation to include the underlying error for easier debugging.
-   Fixed aggregation error when running hierarchical forecasts with standard hierarchy approach.
-   Fixed hierarchical issues when a combo variable contains a single unique value.
-   Fixed issue when reconciling standard hierarchical forecasts.
-   Fixed weighted mape calculation when target variable has negative values.
-   Support for latest xgboost 3x version.
-   Fixed model summary for global models by considering average models too.
-   Fixed issue when future values of external regressors exist in some series but not all, leading to missing data issues when training a global model.
-   Fixed issue around NA handling with external regressors. 
-   Fixed issue when reconciling hierarchical forecasts that are very close to zero.
-   Fixed issue when checking if best models have been selected before. 
-   Fixed multistep Cubist, GLMnet, MARS, polynomial SVM, and radial SVM failures caused by non-unique fiscal date-index joins expanding assessment rows.
-   Multistep prediction now preserves one prediction per original assessment row and fails explicitly on missing, duplicated, padded, truncated, recycled, or non-finite output.
-   Removed XGBoost multistep prediction padding and truncation that previously masked row-alignment defects.
-   Custom multistep `lag_periods` now propagate consistently through feature engineering, feature selection, model training, and forecast updates. Lag lists that do not cover the forecast horizon automatically include the horizon as a final boundary.

## Breaking Changes

- `experiment_name` within `set_run_info()` has been changed to `project_name` to comply with new AI agent capabilities. 
- Migrated from the `qs` package to [`qs2`](https://CRAN.R-project.org/package=qs2) for fast object serialization. The `qs2` package is actively maintained and CRAN-ready with improved compression. Files previously saved with `qs` format cannot be read by `qs2`; any cached `.qs` files from prior runs will need to be regenerated.

# finnts 0.6.0

## Improvements

-   Shortened global model list to just xgboost
-   Faster xgboost model training for larger datasets 
-   Faster feature selection for global model training
-   Added `seasonal_period` within `prep_models()` for more control over multiple seasonal periods in models like tbats

## Bug Fixes

-   Error in formatting of training data for global models
-   Error when using multiple external regressors with future values
-   Remove `target_log_transformation` within `prep_data()`, since `box_cox` has now replaced it for automated power transformations
-   Error when running hierarchical forecasts with weekly data

# finnts 0.5.0

## Improvements

-   Added support for hierarchical forecasting with external regressors
-   Allow global models for hierarchical forecasts
-   Multistep horizon forecasts for R1 recipe, listed as `multistep_horizon` within `prep_data()` 
-   Always save the most accurate model average, regardless if selected as best model. This allows for improved scaling with large data sets.
-   Automatically condense large forecasts (+3k time series) into smaller amount of files to make it easier to read forecast outputs
-   Improved weighted MAPE calculation across all time series
-   Changed default for box_cox argument in `prep_data()` to FALSE
-   Support for spark version 3.4 in Azure Synapse/Fabric

## Bug Fixes

-   Error in run_type column join in final forecast output
-   Error in running feature selection

## Breaking Changes

-   Minimum R version now set to R 4.0 to comply with package dependency minimum version for tune

# finnts 0.4.0

## Improvements

-   Tidymodels speed up
-   Added external regressor support for ARIMA by introducing a new model option of `arimax`, which uses engineered features in addition to any external regressors supplied.
-   Automated feature selection, refer to feature selection vignette for more details
-   Error handling in hierarchical forecast reconciliation
-   Box-cox and differencing transformations
-   Added new function, `list_models()`, that lists available models in the package 

## Bug Fixes

-   Best model selection
-   Hierarchical forecast reconciliation

# finnts 0.3.0

## Improvements

-   Spark data frame support. Initial input data can now be a spark data frame, enabling millions of time series to be ran across a spark compute cluster.
-   Updated train/validation/test process for multivariate ML models.
-   In addition to existing `forecast_time_series()`, added new sub components of the finnts forecast process that can be called separately or in a production pipeline. Allows for more control of the forecast process
    -   `prep_data()`
    -   `prep_models()`
    -   `train_models()`
    -   `ensemble_models()`
    -   `final_models()`
-   Automated read and write capabilities. Intermediate and final Finn outputs are now automatically written to disk (see options below). This creates better MLOps capabilities, easier scale on spark, and better fault tolerance by not needing to start the whole forecast process over from scratch if an error occurred.
    -   Temporary location on local machine, which will then get deleted after R session is closed.
    -   Path on local machine or a mounted Azure Data Lake Storage path in spark to save the intermediate and final Finn run results.
    -   Azure Blob Storage to store non-spark runs on a data lake. SharePoint/OneDrive storage to store non-spark runs within M365.
-   New MLOps features that allow you to retrieve the final trained models through `get_trained_models()`, get specific run information thorough `get_run_info()`, and even retrieve the initial feature engineered data through `get_prepped_data()`.

## Deprecated

-   `run_model_parallel` has been replaced with `inner_parallel` within `forecast_time_series()`
-   Data being returned as a list when running `forecast_time_series()`. Instead please use `get_forecast_data()` to retrieve Finn forecast outputs.

## Breaking Changes

-   No longer support for Azure Batch parallel processing, please use spark instead
-   Parallel processing through spark now needs a mounted Azure Data Lake Storage path supplied through `set_run_info()`. Please refer to the vignettes for more details.

# finnts 0.2.4

## Dependency Fixes

-   Fixed dependency issue with timetk. 

# finnts 0.2.3

## Dependency Fixes

-   Removed package dependency modeltime.gluonts and its deep learning models because the package is no longer on CRAN.

# finnts 0.2.2

## Bug Fixes

-   Fixed hierarchical forecast reconciliation issues for certain forecasts that have high residuals. 
-   Compliant with latest dplyr v1.1.0

# finnts 0.2.1

## Bug Fixes

-   Fixed feature engineering issue around NaN/Inf values when computing log values of negative external regressor values.
-   Fixed issue of ensuring random seed is set correctly in parallel processing.

# finnts 0.2.0

## Improvements

-   Added spark support to run Finn in parallel on Azure Databricks or Azure Synapse.
-   Added error handling when creating simple model averages. Should allow forecast to keep running even if there are memory issues when averaging individual forecast models, which helps on large data sets.
-   Expand Azure Batch task timeout from one day to one week. Prevents errors when running large forecasts that take over a day to run in Azure Batch.

## Deprecated

-   Deprecated azure_batch parallel compute option within forecast_time_series function since the Azure Batch R packages are deprecated. Please use the new integration with spark on Azure.

# finnts 0.1.1

## Default Function Behavior

-   Change default behavior to only run R1 feature engineering recipe when the argument run_global_models is set to TRUE or NULL and recipes_to_run is set to NULL in the forecast_time_series function. Running R2 recipe with global models on large data sets often results in RAM issues when running in Azure Batch.

## Bug Fixes

-   Fixed error when converting infinite values to NA values after model forecasts are created.
-   Changed the cubist model to reference the new cubist model definition in parsnip package.
-   Fixed bug in hierarchical forecasting. Missing values in the hierarchy are converted from NA to zero, which fixes how data is aggregated at various levels of hierarchy.

# finnts 0.1.0

-   Initial CRAN Release
