R Prophet crashing Rstudio in loop

送分小仙女□ 提交于 2019-12-11 07:05:47

问题


I've been using prophet in R on windows for several months now and have recently started seeing random RStudio crashes. Prior to a few days ago, I was having no issues. I know that's not much to go off of, but I'm hoping someone can recognize what might be going on with my system. I've noticed that it crashes more frequently when n.changepoints is higher than the default of 25.

I see the crashes on both R 3.4 and 3.5. I have Rtools installed properly and can compile cpp code inline as documented in the Rstan installation.

Here is in the system that I'm working on. I have the latest version of prophet and Rcpp.

> sessionInfo()
R version 3.5.0 (2018-04-23)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows Server >= 2012 x64 (build 9200)

Matrix products: default

locale:
[1] C

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

other attached packages:
 [1] healthcareai_2.0.0 bindrcpp_0.2.2     odbc_1.1.6         reshape2_1.4.3     rmarkdown_1.10     prophet_0.3.0.1    Rcpp_0.12.17       lubridate_1.7.4   
 [9] dbplyr_1.2.1       forcats_0.3.0      stringr_1.3.1      dplyr_0.7.5        purrr_0.2.5        readr_1.1.1        tidyr_0.8.1        tibble_1.4.2      
[17] ggplot2_2.2.1      tidyverse_1.2.1    DBI_1.0.0         

loaded via a namespace (and not attached):
 [1] nlme_3.1-137       bit64_0.9-7        dimRed_0.1.0       httr_1.3.1         rprojroot_1.3-2    rstan_2.17.3       tools_3.5.0        backports_1.1.2   
 [9] utf8_1.1.4         R6_2.2.2           rpart_4.1-13       lazyeval_0.2.1     colorspace_1.3-2   nnet_7.3-12        withr_2.1.2        tidyselect_0.2.4  
[17] gridExtra_2.3      mnormt_1.5-5       bit_1.1-12         compiler_3.5.0     glmnet_2.0-16      cli_1.0.0          rvest_0.3.2        xml2_1.2.0        
[25] scales_0.5.0       sfsmisc_1.1-2      DEoptimR_1.0-8     psych_1.8.4        robustbase_0.93-1  digest_0.6.15      StanHeaders_2.17.2 foreign_0.8-70    
[33] pkgconfig_2.0.1    htmltools_0.3.6    rlang_0.2.1        readxl_1.1.0       ddalpha_1.3.4      MLmetrics_1.1.1    rstudioapi_0.7     bindr_0.1.1       
[41] jsonlite_1.5       ModelMetrics_1.1.0 inline_0.3.15      magrittr_1.5       Matrix_1.2-14      munsell_0.5.0      abind_1.4-5        stringi_1.1.7     
[49] yaml_2.1.19        MASS_7.3-49        plyr_1.8.4         recipes_0.1.3      grid_3.5.0         blob_1.1.1         pls_2.6-0          parallel_3.5.0    
[57] crayon_1.3.4       lattice_0.20-35    cowplot_0.9.2      haven_1.1.1        splines_3.5.0      hms_0.4.2          knitr_1.20         pillar_1.2.3      
[65] ranger_0.10.1      igraph_1.2.1       codetools_0.2-15   stats4_3.5.0       CVST_0.2-2         magic_1.5-8        glue_1.2.0         evaluate_0.10.1   
[73] data.table_1.11.4  modelr_0.1.2       foreach_1.4.4      cellranger_1.1.0   gtable_0.2.0       kernlab_0.9-26     assertthat_0.2.0   DRR_0.0.3         
[81] gower_0.1.2        prodlim_2018.04.18 broom_0.4.4        e1071_1.6-8        class_7.3-14       survival_2.41-3    geometry_0.3-6     timeDate_3043.102 
[89] RcppRoll_0.3.0     kknn_1.3.1         iterators_1.0.9    lava_1.6.1         caret_6.0-80       ipred_0.9-6  

Here is the code that I'm running. It sometimes (1/5 times?) crashes Rstudio with a "session terminated" error.

for (i in 1:length(f_names)) {
  d <- data_list[[i]]

  m <- prophet(df = d, 
               holidays = h_daily,
               n.changepoints = 100,
               changepoint.prior.scale = 100)

  future <- make_future_dataframe(m, periods = 14, freq = "day")

  f <- predict(m, future)
  forecast_list[[i]] <- f
}

If you've ever encountered something like this or know what I can do to give more info, please advise!

Edit: I'm using Rstudio 1.1.447. This also happens in Rgui and R command line.


回答1:


This was traced to a problem with rlang 0.2.1 Installing version 0.2.0 or 0.2.2 fixed the issue for me and many others. Install a specific version with devtools::install_version("rlang", version="0.2.2")




回答2:


I encountered the same when i used it to forecast on daily basis, try to do forecast on monthly basis

make_future_dataframe(m, periods= , freq="month")

For daily basis forecasting, prophet package is not working properly



来源:https://stackoverflow.com/questions/51249162/r-prophet-crashing-rstudio-in-loop

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!