Giter VIP home page Giter VIP logo

danigiro / foreco Goto Github PK

View Code? Open in Web Editor NEW
25.0 1.0 4.0 6.04 MB

Point Forecast Reconciliation - Provides classical (bottom-up), optimal and heuristic combination forecast reconciliation procedures for cross-sectional, temporal, and cross-temporal linearly constrained time series.

Home Page: https://danigiro.github.io/FoReco/index.html

License: GNU General Public License v3.0

R 100.00%
forecasting reconciliation r cran time-series

foreco's Issues

Release FoReco 0.2.6

Prepare for release:

  • git pull
  • Check current CRAN check results
  • Polish NEWS
  • devtools::build_readme()
  • urlchecker::url_check()
  • devtools::check(remote = TRUE, manual = TRUE)
  • devtools::check_win_devel()
  • rhub::check_for_cran()
  • revdepcheck::revdep_check(num_workers = 4)
  • Update cran-comments.md
  • git push

Submit to CRAN:

  • usethis::use_version('patch')
  • devtools::submit_cran()
  • Approve email

Wait for CRAN...

  • Accepted ๐ŸŽ‰
  • git push
  • usethis::use_github_release()
  • usethis::use_dev_version()
  • git push

Release FoReco 0.2.4

Prepare for release:

  • git pull
  • Check current CRAN check results
  • Polish NEWS
  • devtools::build_readme()
  • urlchecker::url_check()
  • devtools::check(remote = TRUE, manual = TRUE)
  • devtools::check_win_devel()
  • rhub::check_for_cran()
  • revdepcheck::revdep_check(num_workers = 4)
  • Update cran-comments.md
  • git push

Submit to CRAN:

  • usethis::use_version('patch')
  • devtools::submit_cran()
  • Approve email

Wait for CRAN...

  • Accepted ๐ŸŽ‰
  • git push
  • usethis::use_github_release()
  • usethis::use_dev_version()
  • git push

Converting the Package to Python

@danigiro I wanted to convert this package to Python and use it in produciton. But I am not able to find alternatives to the some parts of code. Any info on what will be best way to convert it.. where do I start..

`htsrec` function doesn't work as intended when `nn = TRUE` and `nn_type = "osqp"`

Please see below.

library(hts)
#> Loading required package: forecast
#> Registered S3 method overwritten by 'quantmod':
#>   method            from
#>   as.zoo.data.frame zoo
library(FoReco)
#> Warning: package 'FoReco' was built under R version 4.3.3
#> Loading required package: Matrix
#> Loading required package: osqp
#> Warning: package 'osqp' was built under R version 4.3.3
#> โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ FoReco 0.2.6 โ”€โ”€
set.seed(123)
abc <- ts(0.5 + matrix(sort(rnorm(200)), ncol = 4, nrow = 50))
nodes <- list(2, c(2, 2))
y <- hts(abc, nodes = nodes)
#> Since argument characters are not specified, the default labelling system is used.
h <- 12
ally <- aggts(y)
n <- nrow(ally)
p <- ncol(ally)
allf <- matrix(NA,nrow = h,ncol = ncol(ally))
for(i in 1:p)
{
  fit <- auto.arima(ally[, i])
  allf[, i] <- forecast(fit, h = h)$mean
}
htsrec(allf, comb = "ols", C = smatrix(y)[1:3,], keep = "recf", nn = FALSE)
#>       serie1     serie2   serie3     serie4    serie5    serie6   serie7
#> h1  5.294030 0.28844210 5.005588 -0.1386732 0.4271153 1.0532083 3.952380
#> h2  5.473805 0.26662846 5.207177 -0.1490871 0.4157156 1.0434417 4.163735
#> h3  5.653610 0.24486500 5.408745 -0.1597520 0.4046170 1.0336652 4.375080
#> h4  5.833394 0.22306733 5.610327 -0.1702386 0.3933059 1.0238954 4.586432
#> h5  6.013193 0.20129296 5.811900 -0.1808519 0.3821448 1.0141210 4.797779
#> h6  6.192981 0.17950274 6.013479 -0.1913751 0.3708778 1.0043498 5.009129
#> h7  6.372777 0.15772329 6.215053 -0.2019623 0.3596856 0.9945764 5.220477
#> h8  6.552567 0.13593653 6.416631 -0.2125041 0.3484406 0.9848045 5.431826
#> h9  6.732361 0.11415473 6.618206 -0.2230781 0.3372329 0.9750316 5.643175
#> h10 6.912153 0.09236957 6.819783 -0.2336292 0.3259988 0.9652594 5.854524
#> h11 7.091946 0.07058668 7.021359 -0.2441967 0.3147833 0.9554867 6.065873
#> h12 7.271738 0.04880226 7.222936 -0.2547525 0.3035547 0.9457143 6.277222
combinef(allf, nodes = nodes, nonnegative = FALSE, keep = "all")
#>           [,1]       [,2]     [,3]       [,4]      [,5]      [,6]     [,7]
#>  [1,] 5.294030 0.28844210 5.005588 -0.1386732 0.4271153 1.0532083 3.952380
#>  [2,] 5.473805 0.26662846 5.207177 -0.1490871 0.4157156 1.0434417 4.163735
#>  [3,] 5.653610 0.24486500 5.408745 -0.1597520 0.4046170 1.0336652 4.375080
#>  [4,] 5.833394 0.22306733 5.610327 -0.1702386 0.3933059 1.0238954 4.586432
#>  [5,] 6.013193 0.20129296 5.811900 -0.1808519 0.3821448 1.0141210 4.797779
#>  [6,] 6.192981 0.17950274 6.013479 -0.1913751 0.3708778 1.0043498 5.009129
#>  [7,] 6.372777 0.15772329 6.215053 -0.2019623 0.3596856 0.9945764 5.220477
#>  [8,] 6.552567 0.13593653 6.416631 -0.2125041 0.3484406 0.9848045 5.431826
#>  [9,] 6.732361 0.11415473 6.618206 -0.2230781 0.3372329 0.9750316 5.643175
#> [10,] 6.912153 0.09236957 6.819783 -0.2336292 0.3259988 0.9652594 5.854524
#> [11,] 7.091946 0.07058668 7.021359 -0.2441967 0.3147833 0.9554867 6.065873
#> [12,] 7.271738 0.04880226 7.222936 -0.2547525 0.3035547 0.9457143 6.277222
htsrec(allf, comb = "ols", C = smatrix(y)[1:3,], keep = "recf", nn = TRUE)
#> Warning: OSQP flag -4 OSQP pri_res 1.89503316505579e-06
#> Warning: OSQP flag -4 OSQP pri_res 1.89476372725039e-06
#> Warning: OSQP flag -4 OSQP pri_res 1.89535603567492e-06
#> Warning: OSQP flag -4 OSQP pri_res 1.89519846571784e-06
#> Warning: OSQP flag -4 OSQP pri_res 1.89522438631684e-06
#> Warning: OSQP flag -4 OSQP pri_res 1.89534762284893e-06
#> Warning: OSQP flag -4 OSQP pri_res 1.89524621418968e-06
#> Warning: OSQP flag -4 OSQP pri_res 1.8955886389449e-06
#> Warning: OSQP flag -4 OSQP pri_res 1.89518414117629e-06
#> Warning: OSQP flag -4 OSQP pri_res 1.89527509064646e-06
#> Warning: OSQP flag -4 OSQP pri_res 1.89532261174463e-06
#> Warning: OSQP flag -4 OSQP pri_res 1.89510910786339e-06
#> $recf
#>         serie1     serie2     serie3     serie4     serie5     serie6
#> h1  2143289344 2143289344 2143289344 2143289344 2143289344 2143289344
#> h2  2143289344 2143289344 2143289344 2143289344 2143289344 2143289344
#> h3  2143289344 2143289344 2143289344 2143289344 2143289344 2143289344
#> h4  2143289344 2143289344 2143289344 2143289344 2143289344 2143289344
#> h5  2143289344 2143289344 2143289344 2143289344 2143289344 2143289344
#> h6  2143289344 2143289344 2143289344 2143289344 2143289344 2143289344
#> h7  2143289344 2143289344 2143289344 2143289344 2143289344 2143289344
#> h8  2143289344 2143289344 2143289344 2143289344 2143289344 2143289344
#> h9  2143289344 2143289344 2143289344 2143289344 2143289344 2143289344
#> h10 2143289344 2143289344 2143289344 2143289344 2143289344 2143289344
#> h11 2143289344 2143289344 2143289344 2143289344 2143289344 2143289344
#> h12 2143289344 2143289344 2143289344 2143289344 2143289344 2143289344
#>         serie7
#> h1  2143289344
#> h2  2143289344
#> h3  2143289344
#> h4  2143289344
#> h5  2143289344
#> h6  2143289344
#> h7  2143289344
#> h8  2143289344
#> h9  2143289344
#> h10 2143289344
#> h11 2143289344
#> h12 2143289344
#> 
#> $info
#>    obj_val  run_time iter      pri_res status status_polish
#> 1   -1e+30 0.0000747   25 1.895033e-06     -4             0
#> 2   -1e+30 0.0000504   25 1.894764e-06     -4             0
#> 3   -1e+30 0.0000567   25 1.895356e-06     -4             0
#> 4   -1e+30 0.0000459   25 1.895198e-06     -4             0
#> 5   -1e+30 0.0000467   25 1.895224e-06     -4             0
#> 6   -1e+30 0.0000534   25 1.895348e-06     -4             0
#> 7   -1e+30 0.0000527   25 1.895246e-06     -4             0
#> 8   -1e+30 0.0000487   25 1.895589e-06     -4             0
#> 9   -1e+30 0.0000731   25 1.895184e-06     -4             0
#> 10  -1e+30 0.0000542   25 1.895275e-06     -4             0
#> 11  -1e+30 0.0000339   25 1.895323e-06     -4             0
#> 12  -1e+30 0.0001343   25 1.895109e-06     -4             0
combinef(allf, nodes = nodes, nonnegative = TRUE, keep = "all")
#> Warning in combinef(allf, nodes = nodes, nonnegative = TRUE, keep = "all"):
#> Negative base forecasts are truncated to zero.
#> Time Series:
#> Start = 1 
#> End = 12 
#> Frequency = 1 
#>       Total         A        B AA        AB        BA       BB
#>  1 5.326032 0.3417779 4.984254  0 0.3417779 1.0425411 3.941713
#>  2 5.508210 0.3239697 5.184240  0 0.3239697 1.0319735 4.152267
#>  3 5.690476 0.3063081 5.384168  0 0.3063081 1.0213765 4.362791
#>  4 5.872680 0.2885437 5.584136  0 0.2885437 1.0108002 4.573336
#>  5 6.054928 0.2708514 5.784076  0 0.2708514 1.0002093 4.783867
#>  6 6.237145 0.2531085 5.984036  0 0.2531085 0.9896286 4.994408
#>  7 6.419383 0.2354011 6.183982  0 0.2354011 0.9790409 5.204941
#>  8 6.601607 0.2176689 6.383938  0 0.2176689 0.9684580 5.415480
#>  9 6.783841 0.1999540 6.583887  0 0.1999540 0.9578717 5.626015
#> 10 6.966067 0.1822270 6.783840  0 0.1822270 0.9472879 5.836553
#> 11 7.148299 0.1645085 6.983791  0 0.1645085 0.9367023 6.047088
#> 12 7.330527 0.1467840 7.183743  0 0.1467840 0.9261179 6.257625

Created on 2024-05-23 with reprex v2.1.0

Release FoReco 0.1.0

Prepare for release:

  • Check that description is informative
  • Check licensing of included files
  • devtools::build_readme()
  • usethis::use_cran_comments()
  • devtools::check(remote = TRUE, manual = TRUE)
  • devtools::check_win_devel()
  • rhub::check_for_cran()
  • Update cran-comments.md
  • Review pkgdown reference index for, e.g., missing topics
  • Draft blog post

Submit to CRAN:

  • usethis::use_version('minor')
  • devtools::submit_cran()
  • Approve email

Wait for CRAN...

  • Accepted ๐ŸŽ‰
  • usethis::use_github_release()
  • usethis::use_dev_version()
  • Update install instructions in README

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.