Code Monkey home page Code Monkey logo

fable.bsts's People

Contributors

bradisbrad avatar davidtedfordholt avatar mitchelloharawild avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

fable.bsts's Issues

BSTS doesn't seem to like yearmonth date format

Potential seasonal or date format issue

I think this may have to do with the seasonal special, but we're getting NULL models on yearmonth data when normal dates work. We're also seeing both return NULL models for a seasonal call of 1 month regardless of date format.

library(tidyverse)
library(fabletools)
library(fable)
devtools::install_github('bradisbrad/fable.bsts')
#> Skipping install of 'fable.bsts' from a github remote, the SHA1 (9b263921) has not changed since last install.
#>   Use `force = TRUE` to force installation

source('~/proj/pers/repo/fable.bsts/data-raw/lax_passengers.R')
#> 
#> Attaching package: 'lubridate'
#> The following object is masked from 'package:tsibble':
#> 
#>     interval
#> The following objects are masked from 'package:base':
#> 
#>     date, intersect, setdiff, union
#> `summarise()` regrouping output by 'date' (override with `.groups` argument)

data <- lax_passengers %>% 
  mutate(date = yearmonth(date))

data %>% 
  fabletools::model(
    bsts = fable.bsts::BSTS(passengers ~ intercept() + ar() + seasonal('1 week'))
  )
#> Warning: 2 errors (1 unique) encountered for bsts
#> [2] order.by requires an appropriate time-based object
#> # A mable: 2 x 2
#> # Key:     type [2]
#>   type                  bsts
#>   <chr>              <model>
#> 1 Domestic      <NULL model>
#> 2 International <NULL model>

data <- lax_passengers 

data %>% 
  fabletools::model(
    bsts = fable.bsts::BSTS(passengers ~ intercept() + ar() + seasonal('1 week'))
  )
#> # A mable: 2 x 2
#> # Key:     type [2]
#>   type             bsts
#>   <chr>         <model>
#> 1 Domestic       <BSTS>
#> 2 International  <BSTS>

data %>% 
  fabletools::model(
    bsts = fable.bsts::BSTS(passengers ~ intercept() + ar() + seasonal('1 month'))
  )
#> Warning: 2 errors (1 unique) encountered for bsts
#> [2] nseasons == round(nseasons) is not TRUE
#> # A mable: 2 x 2
#> # Key:     type [2]
#>   type                  bsts
#>   <chr>              <model>
#> 1 Domestic      <NULL model>
#> 2 International <NULL model>

Created on 2020-09-09 by the reprex package (v0.3.0)

Add NormalPrior

We will need to figure out how to specify a prior intuitively. This includes the question of how much would need to be specified BEFORE the fable workflow, and whether or not things need to be in a tibble with the same key structure, a tsibble with the same key structure and index values, maybe just partial index values, or as columns in the tsibble, itself... I don't know!

This will be alongside SdPrior and all the other specific prior specification methods.

constrain trend types

From Steven Scott:

There should only be (at most) one non-stationary trend model and one stationary trend model. Multiple seasonal models are okay, as long as the seasonal periods are different. The shorter and more "boring" your data, the fewer state models you should have. E.g. you could have a local linear trend plus an AR, but in the airline data (for example) that's probably asking for trouble.

write warnings for invalid models

I'm not entirely sure that we will be able to warn for all of them, but if we find model specifications that don't make sense or don't run we need to document them and create warnings for them. It would be nice if those warnings just returned an empty mbl object instead of erroring the process out.

Add Travis stuff

It seems like I should use this. And probably other tools for checking package builds and coverage and whatnot.

Install error

I'm getting the following error when trying to install the package:

> remotes::install_github('https://github.com/davidtedfordholt/fable.bsts')
Downloading GitHub repo davidtedfordholt/fable.bsts@HEADchecking for file/private/var/folders/wl/klf5ry4n2vg4lfmtqk5tv5sr0000gn/T/RtmppBnAzW/remotesaf2e146d3d0e/davidtedfordholt-fable.bsts-4488a12/DESCRIPTION...preparingfable.bsts:checking DESCRIPTION meta-information ...checking for LF line-endings in source and make files and shell scriptschecking for empty or unneeded directoriesbuildingfable.bsts_0.1.0.tar.gz* installing *source* packagefable.bsts...
** using non-staged installation via StagedInstall field
** R
** byte-compile and prepare package for lazy loading
Error in is_regular_interval(x) && sum(vec_c(!!!vec_data(x))) == 0 : 
  invalid 'x' type in 'x && y'
Error: unable to load R code in packagefable.bstsExecution halted
ERROR: lazy loading failed for packagefable.bsts

use of future package integration doesn't load libraries

In the following example, the dtwclust library is explicitly loaded into each worker. I'm not sure how to explicitly load things like rlang into the workers when using the implementation of the future packages in fable. @mitchelloharawild , I assume I'm just failing to put the required packages someplace appropriate, to ensure that they get called?

require("doParallel")
# Create parallel workers
workers <- makeCluster(2L)
# Preload dtwclust in each worker; not necessary but useful invisible(clusterEvalQ(workers, library("dtwclust")))
# Register the backend; this step MUST be done registerDoParallel(workers)

Install failure :package or namespace load failed for ‘future’

Package installation of fable.bsts fails with the message:

Error : package or namespace load failed for ‘future’:
 .onLoad failed in loadNamespace() for 'globals', details:
  call: asNamespace(ns, base.OK = FALSE)
  error: not a namespace
Error: unable to load R code in package ‘fable.bsts’
Execution halted

The package future exists on my system and is up to date. It was successfully installed via install.packages.

My system:

  • R version: 4.0.0
  • Platform: macOS 10.15.4 (Catalina)

Installation error

Please briefly describe your problem and what output you expect. If you have a question, please don't use this form. Instead, ask on https://stackoverflow.com/.

Please include a minimal reproducible example (AKA a reprex). If you've never heard of a reprex before, start by reading https://www.tidyverse.org/help/#reprex.


I encountered the following error while installing fable.bsts on my AWS SageMaker notebook instances. Can you please help me with this? Thanks!

Below is the R code for installation

ipak <- function(pkg){
  new.pkg <- pkg[!(pkg %in% installed.packages()[, "Package"])]
  if (length(new.pkg))
    install.packages(new.pkg, dependencies = TRUE)
  try(sapply(pkg, require, character.only = TRUE), silent = TRUE)
}
packages <- c("fable", "tsibble", 
              "tsibbledata", 
              "lubridate", "dplyr", 
              "ggplot2", "stringi","fable.prophet", "remotes")
ipak(packages)

remotes::install_github("davidtedfordholt/fable.bsts")

Please see below for the error message

_Downloading GitHub repo davidtedfordholt/fable.bsts@HEAD

Boom (NA -> 0.9.11) [CRAN]
timechange (NA -> 0.1.1 ) [CRAN]
lubridate (1.8.0 -> 1.9.0 ) [CRAN]
BoomSpike... (NA -> 1.2.5 ) [CRAN]
bsts (NA -> 0.9.9 ) [CRAN]
Installing 5 packages: Boom, timechange, lubridate, BoomSpikeSlab, bsts

Updating HTML index of packages in '.Library'

Making 'packages.html' ...
done

Running R CMD build...

  • checking for file ‘/tmp/RtmpQwSs0m/remotes27a876a9353a/davidtedfordholt-fable.bsts-4488a12/DESCRIPTION’ ... OK
  • preparing ‘fable.bsts’:
  • checking DESCRIPTION meta-information ... OK
  • checking for LF line-endings in source and make files and shell scripts
  • checking for empty or unneeded directories
    Omitted ‘LazyData’ from DESCRIPTION
  • building ‘fable.bsts_0.1.0.tar.gz’
    Warning message in i.p(...):
    “installation of package ‘/tmp/RtmpQwSs0m/file27a8520733d4/fable.bsts_0.1.0.tar.gz’ had non-zero exit status”_

The environment info is here

R version 4.2.2 (2022-10-31)
Platform: x86_64-conda-linux-gnu (64-bit)
Running under: Amazon Linux 2

Matrix products: default
BLAS/LAPACK: /home/ec2-user/anaconda3/envs/R/lib/libopenblasp-r0.3.21.so

locale:
[1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C
[3] LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8
[5] LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8
[7] LC_PAPER=en_US.UTF-8 LC_NAME=C
[9] LC_ADDRESS=C LC_TELEPHONE=C
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C

attached base packages:
[1] stats graphics grDevices utils datasets methods base

other attached packages:
[1] remotes_2.4.2 fable.prophet_0.1.0 Rcpp_1.0.9
[4] bsts_0.9.9 xts_0.12.2 zoo_1.8-11
[7] BoomSpikeSlab_1.2.5 Boom_0.9.11 stringi_1.7.8
[10] ggplot2_3.4.0 dplyr_1.0.10 lubridate_1.9.0
[13] tsibbledata_0.4.1 tsibble_1.1.3 fable_0.3.2
[16] fabletools_0.3.2

loaded via a namespace (and not attached):
[1] pbdZMQ_0.3-8 tidyselect_1.2.0 repr_1.1.4
[4] purrr_0.3.5 lattice_0.20-45 colorspace_2.0-3
[7] vctrs_0.5.1 generics_0.1.3 htmltools_0.5.3
[10] base64enc_0.1-3 utf8_1.2.2 rlang_1.0.6
[13] pillar_1.8.1 glue_1.6.2 withr_2.5.0
[16] DBI_1.1.3 rappdirs_0.3.3 distributional_0.3.1
[19] uuid_1.1-0 lifecycle_1.0.3 munsell_0.5.0
[22] anytime_0.3.9 gtable_0.3.1 evaluate_0.18
[25] fastmap_1.1.0 curl_4.3.3 fansi_1.0.3
[28] IRdisplay_1.1 scales_1.2.1 IRkernel_1.3
[31] jsonlite_1.8.3 farver_2.1.1 digest_0.6.30
[34] grid_4.2.2 cli_3.4.1 tools_4.2.2
[37] magrittr_2.0.3 tibble_3.1.8 crayon_1.5.2
[40] tidyr_1.2.1 pkgconfig_2.0.3 ellipsis_0.3.2
[43] MASS_7.3-58.1 assertthat_0.2.1 R6_2.5.1
[46] compiler_4.2.2

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.