Skip to content

Commit

Permalink
Fix map seasonality plots (#110)
Browse files Browse the repository at this point in the history
* compute seasonality even for map

* update test plots

* update ignore files

* try to fix test for windows
  • Loading branch information
Kucharssim authored Dec 5, 2024
1 parent bb08d21 commit 705b93f
Show file tree
Hide file tree
Showing 22 changed files with 960 additions and 956 deletions.
2 changes: 2 additions & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
^renv$
^renv\.lock$
^.*\.Rproj$
^\.Rproj\.user$
^\.travis\.yml$
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -58,3 +58,5 @@ Thumbs.db
# RStudio files
.Rproj.user
_processedLockFile.lock
.Rprofile
renv/
16 changes: 8 additions & 8 deletions R/prophet.R
Original file line number Diff line number Diff line change
Expand Up @@ -366,6 +366,14 @@ Prophet <- function(jaspResults, dataset = NULL, options) {
}

.prophetModelResultsReduce <- function(prophetModelResults, options) {
# seasonality estimates
predictedSeasonalities <- list()
for (seas in options[["seasonalities"]]) {
name <- seas[["name"]]
predictedSeasonalities[[name]] <- .prophetPredictSeasonality(name, prophetModelResults, options)
}
prophetModelResults[["predictedSeasonalities"]] <- predictedSeasonalities

if (options$estimation == "mcmc") {
# posterior summaries
ci <- .prophetIntervalLevels(options, "credible")
Expand All @@ -383,14 +391,6 @@ Prophet <- function(jaspResults, dataset = NULL, options) {
}
prophetModelResults[["parameterDensities"]] <- parameterDensities

# seasonality estimates
predictedSeasonalities <- list()
for (seas in options[["seasonalities"]]) {
name <- seas[["name"]]
predictedSeasonalities[[name]] <- .prophetPredictSeasonality(name, prophetModelResults, options)
}
prophetModelResults[["predictedSeasonalities"]] <- predictedSeasonalities

# remove stanfit and mcmc samples from the results to reduce size of the results
prophetModelResults$stan.fit <- NULL
prophetModelResults$params <- NULL
Expand Down
188 changes: 94 additions & 94 deletions tests/testthat/_snaps/prophet/changepoint-plotdays.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
180 changes: 90 additions & 90 deletions tests/testthat/_snaps/prophet/changepoint-plothours.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
188 changes: 94 additions & 94 deletions tests/testthat/_snaps/prophet/changepoint-plotmins.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
188 changes: 94 additions & 94 deletions tests/testthat/_snaps/prophet/changepoint-plotsecs.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
180 changes: 90 additions & 90 deletions tests/testthat/_snaps/prophet/changepoint-plotweeks.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
180 changes: 90 additions & 90 deletions tests/testthat/_snaps/prophet/changepoint-plotyears.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
332 changes: 166 additions & 166 deletions tests/testthat/_snaps/prophet/covariate-plot-multi.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
146 changes: 73 additions & 73 deletions tests/testthat/_snaps/prophet/growth-rate.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
158 changes: 79 additions & 79 deletions tests/testthat/_snaps/prophet/offset.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
138 changes: 69 additions & 69 deletions tests/testthat/_snaps/prophet/residual-variance.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion tests/testthat/_snaps/prophet/trend-forecast-plot.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion tests/testthat/test-prophet.R
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ test_that("Parameter Estimates Table results match (MAP)", {
{
# test windows result
testthat::skip_on_os(c("mac", "linux"))
jaspTools::expect_equal_tables(table, list(-2.50859195109382, -2.31656506358638, 0.32805219661169))
jaspTools::expect_equal_tables(table, list(-2.50358957234044, -2.32147823235013, 0.328046513061461))
}

{
Expand Down

0 comments on commit 705b93f

Please sign in to comment.