{"id":21182761,"url":"https://github.com/jszitas/blaze","last_synced_at":"2026-05-20T09:35:11.830Z","repository":{"id":159552570,"uuid":"547556095","full_name":"JSzitas/blaze","owner":"JSzitas","description":"A C++17 implementation of ARIMA following R","archived":false,"fork":false,"pushed_at":"2023-09-02T19:37:40.000Z","size":2478,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-21T12:34:00.852Z","etag":null,"topics":["arima","cpp","cpp17","forecasting","working-in-progress"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/JSzitas.png","metadata":{"files":{"readme":"README.Rmd","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2022-10-07T22:16:39.000Z","updated_at":"2024-09-18T19:45:58.000Z","dependencies_parsed_at":"2023-09-22T03:04:38.825Z","dependency_job_id":null,"html_url":"https://github.com/JSzitas/blaze","commit_stats":{"total_commits":251,"total_committers":1,"mean_commits":251.0,"dds":0.0,"last_synced_commit":"494707547d0008954cb049cd3e90f9148e4d33f9"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JSzitas%2Fblaze","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JSzitas%2Fblaze/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JSzitas%2Fblaze/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JSzitas%2Fblaze/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/JSzitas","download_url":"https://codeload.github.com/JSzitas/blaze/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243639379,"owners_count":20323505,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["arima","cpp","cpp17","forecasting","working-in-progress"],"created_at":"2024-11-20T17:57:53.284Z","updated_at":"2025-12-30T12:50:46.527Z","avatar_url":"https://github.com/JSzitas.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"---\noutput: github_document\n---\n\n\u003c!-- README.md is generated from README.Rmd. Please edit that file --\u003e\n\n```{r, include = FALSE}\nknitr::opts_chunk$set(\n  collapse = TRUE,\n  comment = \"#\u003e\",\n  fig.path = \"man/figures/README-\",\n  out.width = \"100%\"\n)\n```\n\n# blazearima\n\n\u003c!-- badges: start --\u003e\n[![Lifecycle: experimental](https://img.shields.io/badge/lifecycle-experimental-orange.svg)](https://lifecycle.r-lib.org/articles/stages.html#experimental)\n[![R-CMD-check](https://github.com/JSzitas/fasttbats/workflows/R-CMD-check/badge.svg)](https://github.com/JSzitas/fasttbats/actions)\n\u003c!-- badges: end --\u003e\n\n**TODO: Update**\n\nAn intentionally very fast (S)ARIMA(X) implementation. This intends to be as accurate as possible, overcoming both **R** and **statsforecast** implementation\nof **arima**, while hopefully also being faster, with a lower memory footprint. \n\u003c!-- This faster goal seems to have been reached, at least comparing against **R**'s arima:  --\u003e\nOn the roadmap is even more refinements to speed, python bindings, and auto arima functionality akin to **R**'s **forecast::auto.arima**.\n\n# Currently available functionality \n\n```{r, echo = FALSE, warning=FALSE,message=FALSE}\npkgload::load_all(compile=TRUE, quiet = TRUE)\n```\n\nA simple object oriented **R** interface exists: \n\n\n```{r}\n# create a new object \narima_obj \u003c- new(BlazeArima, c(lynx[1:100]), c(4, 0, 1, 0, 0, 0, 1), list(), \"Gardner\", \"CSS-ML\", c(TRUE, FALSE, TRUE), 1000000)\n# fit model\narima_obj$fit()\n# create forecasts\narima_obj$forecast(14, list()) -\u003e cpp_fcst\n# showcase of fitted model - this is not a particularly great fit: \nplot.ts(c(lynx[91:114]))\nlines(c(rep(NA,10), cpp_fcst$forecast), col = \"red\")\n# we can compare this to the R arima implementation:\nlines(c(rep(NA,10),predict(arima(c(lynx[1:100]),\n                                 order = c(4,0,1), method = \"CSS-ML\"), 14)$pred),\n      col = \"blue\")\n```\n\n\nThere are some cases where our optimizer (we use [cppNumericalSolvers](https://github.com/PatWie/CppNumericalSolvers)) seems to be more accurate than the default R solver:\n\n```{r}\n\np \u003c- 2\nd \u003c- 1\nq \u003c- 1\nP \u003c- 2\nD \u003c- 1\nQ \u003c- 1\nseason \u003c- 10\nuse_mean \u003c- TRUE\n\ntrain \u003c- c(lynx)[1:100]\ntest \u003c- lynx[101:114]\n\narima_obj \u003c- new(BlazeArima, train, c(p, d, q, P, D, Q, season), list(), \"Gardner\", \"CSS-ML\", c(use_mean, TRUE), 1000000)\narima_obj$fit()\n\narima_obj$forecast(14, list()) -\u003e cpp_fcst\n\narima_mod \u003c- arima(train,\n  order = c(p, d, q), seasonal = list(order = c(P, D, Q), period = season),\n  include.mean = use_mean,\n  transform.pars = TRUE, kappa = 1000000, method = \"CSS-ML\"\n)\npredict(arima_mod, 14) -\u003e r_fcst\n\nplot.ts(c(lynx)[91:114])\nlines(c( rep(NA, 10), cpp_fcst$forecast), col = \"red\")\nlines(c( rep(NA, 10), r_fcst$pred), col = \"green\")\n\n```\n\nThis could be attributed to numerous factors - R's **optim** uses internal parameter scaling for optimizer line searches, whereas we standardize all inputs. \n**optim** uses, as far as I can tell, a version of Armijo line-search(TODO: add refs), whereas cppNumericalSolvers can (and is configured here) to use MoreThuente. There are some other differences in implementation, but these, I think, are most important.\n\n# Thanks, recognition\n\nThis package really follows the 'I stand on the shoulders of giants' idea. It would have never been possible without all the careful work put into R's `arima()` implementation done by many member of the R Core Team and others over the years. I do believe professor Ripley is of particular note here, and deserves recognition for being one of the driving forces behind such an awesome project. \n\nI further want to thank the authors of the awesome **Eigen** C++ template library. This library is one of the silent drivers of much of this computation, particularly the handling of external variables. \n\nFinally, last but not least, I believe the many people who contributed to the great **CppNumericalSolvers** library deserve recognition. This is the library used for optimization in this package, and it's relatively straightforward implementation has been a huge boon. \n\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjszitas%2Fblaze","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjszitas%2Fblaze","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjszitas%2Fblaze/lists"}