GithubHelp home page GithubHelp logo

fabletools's Issues

library(fablelite) gets error: 'fablelite.rdb' is corrupt

After load fablelite package from Github, library(fablelite) command gets error message "fablelite.rdb is corrupt".

Because fable has a dependency on fablelite, fable cannot be used until this error is fixed.

Environment and Logs

version:
platform x86_64-apple-darwin15.6.0
arch x86_64
os darwin15.6.0
system x86_64, darwin15.6.0
status
major 3
minor 5.1
year 2018
month 07
day 02
svn rev 74947
language R
version.string R version 3.5.1 (2018-07-02)
nickname Feather Spray

RStudio Version 1.1.383

> devtools::install_github("tidyverts/fablelite", force = TRUE)
Downloading GitHub repo tidyverts/fablelite@master
from URL https://api.github.com/repos/tidyverts/fablelite/zipball/master
Installing fablelite
'/Library/Frameworks/R.framework/Resources/bin/R' --no-site-file --no-environ --no-save --no-restore --quiet CMD INSTALL  \
 '/private/var/folders/n1/11dpffjn3r11dq0v3m1xd_zc0000gq/T/RtmpfXceZA/devtools14da36f494d26/tidyverts-fablelite-700b12c'  \
  --library='/Library/Frameworks/R.framework/Versions/3.5/Resources/library' --install-tests 
* installing *source* package 'fablelite' ...
** R
** inst
** tests
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
*** copying figures
** building package indices
** testing if installed package can be loaded
* DONE (fablelite)

> library(fablelite)
Error: package or namespace load failed for ‘fablelite’ in get(method, envir = home):
 lazy-load database '/Library/Frameworks/R.framework/Versions/3.5/Resources/library/fablelite/R/fablelite.rdb' is corrupt
In addition: Warning messages:
1: In .registerS3method(fin[i, 1], fin[i, 2], fin[i, 3], fin[i, 4],  :
  restarting interrupted promise evaluation
2: In get(method, envir = home) :
  restarting interrupted promise evaluation
3: In get(method, envir = home) : internal error -3 in R_decompress1

geom_forecast() not working with facet_calendar()

library(tsibble)
library(fable)
library(lubridate)
library(ggplot2)
elec_mth <- tsibbledata::elecdemand %>% 
  filter_index(~ "2014-01-30") %>% 
  index_by(datehour = floor_date(index, "hour")) %>% 
  summarise(avg_supply = mean(Demand)) %>% 
  mutate(
    hour = hour(datehour),
    date = as_date(datehour)
  )

elec_fc <- elec_mth %>% 
  model(ets = ETS(avg_supply)) %>% 
  forecast(h = 24)
#> Selecting index: "datehour"
elec_fc$date <- as_date(elec_fc$datehour)

# elec_fc %>% 
#   autoplot(data = elec_mth) +
#   sugrrants::facet_calendar(~ date)

elec_mth %>% 
  ggplot(aes(x = hour, y = avg_supply)) +
  geom_line() +
  geom_forecast(
    aes(ymin = lower, ymax = upper, level = level),
    fortify(elec_fc), stat = "identity"
  ) +
  sugrrants::facet_calendar(~ date)
#> Error: All columns in a tibble must be 1d or 2d objects:
#> * Column `x` is function

Created on 2018-12-31 by the reprex package (v0.2.1)

bind_cols for mables not working

library(tidyverse)
library(tsibble)
library(fable)
fit1 <- WWWusage %>% as_tsibble() %>%
  model(
    naive = NAIVE(value)
  )
fit2 <- WWWusage %>% as_tsibble() %>%
  model(
    mean = MEAN(value)
  ) 
fit <- bind_cols(fit1,fit2)
glance(fit)

Combination forecast variance

Currently the combination forecast variance assumes that the correlation across h is identical... can we do better than this?

devtools install is failing for fablelite

devtools::install_github("tidyverts/fablelite")
...
Error: package or namespace load failed for ‘fablelite’:
object 'is_vector_s3' not found whilst loading namespace 'fablelite'
Error: loading failed
Execution halted
ERROR: loading failed

  • removing ‘/usr/local/lib/R/site-library/fablelite’
    Installation failed: Command failed (1)

I tried it on R 3.4.3 and R 3.5.1

Warning: Computation failed in `stat_forecast()`: All inputs to rbind.fill must be data.frames

Getting an error with geom_forecast():

library(ggplot2)
library(tsibble)
#> 
#> Attaching package: 'tsibble'
#> The following objects are masked from 'package:stats':
#> 
#>     filter, lag
library(tsibbledata)
library(fable)
#> Loading required package: fablelite


tsibbledata::aus_livestock %>% 
  autoplot() + 
  guides(color = FALSE) +
  geom_forecast()
#> Plot variable not specified, automatically selected `var = Count`
#> Warning: Computation failed in `stat_forecast()`:
#> All inputs to rbind.fill must be data.frames

Sorry for the messy plot. It was the first internal dataset I could find that replicated the error I was seeing on internal company data. It's clearer with less paths, but the forecast geom isn't being added to the underlying plot.

accuracy problem

library(tsibble)
library(lubridate)
library(tsibbledata)
library(fable)

google_2015 <- gafa_stock %>%
  filter(Symbol == "GOOG") %>%
  mutate(day = row_number()) %>%
  update_tsibble(index = day, regular = TRUE) %>%
  filter(year(Date) == 2015)
google_2015_tr <- google_2015 %>%
  head(-8) %>%
  stretch_tsibble(.init = 3, .step = 1)
fc <- google_2015_tr %>%
  model(RW(Close ~ drift())) %>%
  forecast(h=8) %>%
  group_by(.id) %>%
  mutate(h = row_number()) %>%
  ungroup()
fc %>%
  accuracy(google_2015, by = "h")
#> Error in abs(.train): non-numeric argument to mathematical function

Created on 2019-04-01 by the reprex package (v0.2.1)

Problems installing fablelite from github using devtools

Similar to previous install problem with namespace which I see was fixed. However ...
Trying to install fablelite on Mac:
platform x86_64-apple-darwin15.6.0
version.string R version 3.5.2 (2018-12-20)
with error message "object 'n_keys' not found whilst loading namespace 'fablelite'":

devtools::install_github("tidyverts/fablelite")
Downloading GitHub repo tidyverts/fablelite@master
✔ checking for file ‘/private/var/folders/ks/x4lpc3qx7jj2h0vxd3ppqrsw0000gn/T/Rtmp7NlNge/remotes6f14bc40af6/tidyverts-fablelite-87cdee8/DESCRIPTION’ ...
─ preparing ‘fablelite’:
✔ checking DESCRIPTION meta-information ...
─ checking for LF line-endings in source and make files and shell scripts
─ checking for empty or unneeded directories
─ building ‘fablelite_0.0.0.9100.tar.gz’

  • installing source package ‘fablelite’ ...
    ** R
    ** inst
    ** byte-compile and prepare package for lazy loading
    ** help
    *** installing help indices
    *** copying figures
    ** building package indices
    ** testing if installed package can be loaded
    Error: package or namespace load failed for ‘fablelite’:
    object 'n_keys' not found whilst loading namespace 'fablelite'
    Error: loading failed
    Execution halted
    ERROR: loading failed
  • removing ‘/Library/Frameworks/R.framework/Versions/3.5/Resources/library/fablelite’
    Error in i.p(...) :
    (converted from warning) installation of package ‘/var/folders/ks/x4lpc3qx7jj2h0vxd3ppqrsw0000gn/T//Rtmp7NlNge/file6f13d5b53be/fablelite_0.0.0.9100.tar.gz’ had non-zero exit status

geom_forecast() has gpar error for fc.args = list(h = 1)

When doing a one period ahead forecast with geom_forecast, geom_forecast() throws an error. For any other time horizon, or just using the default, it works fine.

library(tidyverse)
library(tsibble)
#> 
#> Attaching package: 'tsibble'
#> The following object is masked from 'package:dplyr':
#> 
#>     id
#> The following objects are masked from 'package:stats':
#> 
#>     filter, lag
library(fable)
#> Loading required package: fablelite
library(tsibbledata)

aus_livestock%>%
  nest(-Animal, -State) %>%
  slice(10) %>%
  unnest() %>%
  ggplot(aes(Month, Count)) +
  geom_path() +
  geom_forecast(fc.args = list(h = 20))

aus_livestock%>%
  nest(-Animal, -State) %>%
  slice(10) %>%
  unnest() %>%
  ggplot(aes(Month, Count)) +
  geom_path() +
  geom_forecast(fc.args = list(h = 1))
#> Error in check.length(gparname): 'gpar' element 'fontsize' must not be length 0

Created on 2019-03-11 by the reprex package (v0.2.1)

Revise API for geom_forecast()

Ideally,

geom_forecast(
  mapping = aes(x = x, y = y, distribution = ..distribution..), data = fbl_ts,
  levels = c(80, 95), stats = "identity", other_args
)
  • x & y inherit from ggplot()
  • levels better to be constants instead of aesthetic mapping.
  • stats = "identity" better to be the default instead of "forecast"

Error running interpolation example

From this page: https://tidyverts.github.io/tidy-forecasting-principles/methods.html I run the example:
olympic_running %>%
model(lm = TSLM(Time ~ trend())) %>%
interpolate(olympic_running)

I get this error:
Error: A mable must contain at least one model. To remove all models, first convert to a tibble with as_tibble().

The backtrace says:> rlang::last_trace()
x

  1. -olympic_running %>% model(lm = TSLM(Time ~ trend())) %>% interpolate(olympic_running)
  2. +-base::withVisible(eval(quote(_fseq(_lhs)), env, env))
  3. -base::eval(quote(_fseq(_lhs)), env, env)
  4. \-base::eval(quote(`_fseq`(`_lhs`)), env, env)
    
  5.   \-global::`_fseq`(`_lhs`)
    
  6.     \-magrittr::freduce(value, `_function_list`)
    
  7.       +-base::withVisible(function_list[[k]](value))
    
  8.       \-function_list[[k]](value)
    
  9.         +-generics::interpolate(., olympic_running)
    
  10.         \-fablelite:::interpolate.mdl_df(., olympic_running)
    
  11.           \-`%>%`(...)
    
  12.             +-base::withVisible(eval(quote(`_fseq`(`_lhs`)), env, env))
    
  13.             \-base::eval(quote(`_fseq`(`_lhs`)), env, env)
    
  14.               \-base::eval(quote(`_fseq`(`_lhs`)), env, env)
    
  15.                 \-fablelite:::`_fseq`(`_lhs`)
    
  16.                   \-magrittr::freduce(value, `_function_list`)
    
  17.                     \-function_list[[i]](value)
    
  18.                       +-dplyr::transmute(...)
    
  19.                       \-dplyr:::transmute.default(...)
    
  20.                         +-dplyr::select(out, one_of(keep))
    
  21.                         \-fablelite:::select.mdl_df(out, one_of(keep))
    

Here's my sessionInfo:

sessionInfo()
R version 3.5.2 (2018-12-20)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 7 x64 (build 7601) Service Pack 1
...
other attached packages:
[1] dplyr_0.8.0 ggplot2_3.1.0 tsibbledata_0.0.0.9000 tsibble_0.6.2.9000 fable_0.0.0.9100 fablelite_0.0.0.9100

Improve error messages for missing exogenous regressors in forecast's new_data

Elaborating on the example from README:

library(fable)
library(tsibble)
library(tsibbledata)
library(lubridate)

# Adding a new measurable
aus_retail <-  aus_retail %>% mutate(Const=1)

aus_retail %>%
  filter(
    State %in% c("New South Wales", "Victoria"),
    Industry == "Department stores"
  ) %>% 
  model(
    lm = TSLM(Turnover~trend()),
  ) %>%
  forecast %>% 
  autoplot(filter(aus_retail, year(Month) > 2010), level = NULL)

works well, however mentioning a column name (Const) in place of trend():

library(tsibble)
library(tsibbledata)
library(lubridate)
aus_retail %>%
  filter(
    State %in% c("New South Wales", "Victoria"),
    Industry == "Department stores"
  ) %>% 
  model(
    lm = TSLM(Turnover~0+Const),
  ) %>%
  forecast %>% 
  autoplot(filter(aus_retail, year(Month) > 2010), level = NULL)

results in

Error in eval(predvars, data, env): object 'Const' not found

(same with Q1, ..., Q4 in #125)

tsibble::tbl_sum not exported

Changes to tsibble mean fablelite can no longer be installed.

> remotes::install_github("tidyverts/fablelite")
Downloading GitHub repo tidyverts/fablelite@master
✔  checking for file ‘/tmp/RtmpmOyHbR/remotes7aa24fd10a7/tidyverts-fablelite-e24a578/DESCRIPTION’ ...
─  preparing ‘fablelite’:
✔  checking DESCRIPTION meta-information ...
─  checking for LF line-endings in source and make files and shell scripts
─  checking for empty or unneeded directories
─  building ‘fablelite_0.0.0.9100.tar.gz’
   
Installing package into ‘/home/hyndman/R/x86_64-pc-linux-gnu-library/3.5’
(as ‘lib’ is unspecified)
* installing *source* package ‘fablelite’ ...
** R
** inst
** byte-compile and prepare package for lazy loading
Error : object ‘tbl_sum’ is not exported by 'namespace:tsibble'
ERROR: lazy loading failed for package ‘fablelite’
* removing ‘/home/hyndman/R/x86_64-pc-linux-gnu-library/3.5/fablelite’
* restoring previous ‘/home/hyndman/R/x86_64-pc-linux-gnu-library/3.5/fablelite’
Error in utils::install.packages(pkgs = pkgs, lib = lib, repos = myrepos,  : 
  (converted from warning) installation of package ‘/tmp/RtmpmOyHbR/file7aa4c62d3f5/fablelite_0.0.0.9100.tar.gz’ had non-zero exit status

Remove augment methods from models

fablelite should handle augment if it is missing for a particular model, requiring developers to specify fitted and residuals methods only.

fablelite methods for fitted and residuals should also perform back-transformations where appropriate (interfering when type = "response" for residuals to calculate it with back-transformations).

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.