R先知在循环中崩溃了Rstudio

时间:2018-07-09 15:33:07

标签: r rcpp rstan facebook-prophet

我已经在Windows的R中使用先知了几个月了,最近开始看到随机的RStudio崩溃。几天前,我没有任何问题。我知道这还不算什么,但我希望有人能够认识到我的系统可能正在发生什么。我注意到,当n.changepoints高于默认值25时,它崩溃的频率更高。

我看到R 3.4和3.5都崩溃了。我已经正确安装了Rtools,并且可以按Rstan installation.

中的说明内联编译cpp代码。

这是我正在使用的系统中。我有最新版本的先知和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  

这是我正在运行的代码。有时(1/5次?)使R​​studio崩溃,并显示“会话终止”错误。

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
}

如果您遇到过类似情况,或者知道我可以提供更多信息,请提出建议!

编辑:我正在使用Rstudio 1.1.447。 Rgui和R命令行中也会发生这种情况。

2 个答案:

答案 0 :(得分:0)

This was traced to a problem with rlang 0.2.1安装版本0.2.0或0.2.2为我和其他许多人解决了该问题。使用devtools::install_version("rlang", version="0.2.2")

安装特定版本

答案 1 :(得分:0)

我每天使用它进行预测时遇到相同的情况,尝试每月进行预测

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

对于日常预报,先知套餐无法正常工作