-
Notifications
You must be signed in to change notification settings - Fork 341
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
"etsTargetFunctionInit" not resolved from current namespace (forecast) #378
Comments
Hi, I tried this but couldn't reproduce the problem: devtools::test("/home/bergmeir/code-other/mlr", filter = "ets")
Loading mlr
Loading required package: testthat
Loading required package: ParamHelpers
Testing mlr
fcregr_ets : .....
DONE Session as follows: R version 3.2.0 (2015-04-16)
Platform: x86_64-redhat-linux-gnu (64-bit)
Running under: Fedora 20 (Heisenbug)
locale:
[1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C LC_TIME=en_US.UTF-8
[4] LC_COLLATE=en_US.UTF-8 LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8
[7] LC_PAPER=en_US.UTF-8 LC_NAME=en_US.UTF-8 LC_ADDRESS=en_US.UTF-8
[10] LC_TELEPHONE=en_US.UTF-8 LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=en_US.UTF-8
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] checkmate_1.8.1 mlr_2.10 ParamHelpers_1.9 testthat_0.11.0 rj_2.0.4-2
[6] vimcom_1.2-5 setwidth_1.0-4 colorout_1.1-0
loaded via a namespace (and not attached):
[1] parallelMap_1.3 Rcpp_0.12.7 plyr_1.8.4 tseries_0.10-35 xts_0.9-7
[6] tools_3.2.0 digest_0.6.10 rj.gd_2.0.0-1 lubridate_1.5.6 lattice_0.20-33
[11] memoise_1.0.0 tibble_1.1 gtable_0.2.0 shiny_0.13.2 DBI_0.4-1
[16] parallel_3.2.0 withr_1.0.1 stringr_1.1.0 dplyr_0.5.0 roxygen2_5.0.1
[21] ggvis_0.4.2 devtools_1.10.0 nnet_7.3-12 forecast_7.3 grid_3.2.0
[26] data.table_1.9.6 R6_2.1.2 tcltk_3.2.0 survival_2.38-3 ggplot2_2.1.0
[31] magrittr_1.5 splines_3.2.0 backports_1.0.3 scales_0.4.0 BBmisc_1.10
[36] htmltools_0.3.5 assertthat_0.1 timeDate_3012.100 mime_0.4 colorspace_1.2-6
[41] xtable_1.8-2 fracdiff_1.4-2 httpuv_1.3.3 quadprog_1.5-5 stringi_1.1.1
[46] munsell_0.4.3 chron_2.3-47 crayon_1.3.1 zoo_1.7-13 ` Does it make a difference if you explicitly load the package with a library(forecast) ? As a side note, your code didn't work, you have fcregr.train which I assumed is fcregr.xts Regards, |
@cbergmeir I should have mentioned this, the error only happens if you run the test twice. Which is very odd. For example, with a fresh R session # devtools::test(filter = "ets")
# Loading mlr
# Loading required package: testthat
# Loading required package: ParamHelpers
# Testing mlr
# fcregr_ets: .....
# DONE ===================================================================================================================
# Running a second time
devtools::test(filter = "ets")
# Loading mlr
# Testing mlr
# fcregr_ets: 1
# Failed -----------------------------------------------------------------------------------------------------------------
# 1. Error: fcregr_ets (@test_fcregr_ets.R#20) ---------------------------------------------------------------------------
# "etsTargetFunctionInit" not resolved from current namespace (forecast)
# Loading forecast
library(forecast)
devtools::test(filter = "ets")
# Failed -----------------------------------------------------------------------------------------------------------------
# 1. Error: fcregr_ets (@test_fcregr_ets.R#20) ---------------------------------------------------------------------------
# "etsTargetFunctionInit" not resolved from current namespace (forecast) However! If I start a fresh R session and load forecast first, the tests run fine. library(forecast)
devtools::test(filter = "ets")
# Loading mlr
# Loading required package: testthat
# Loading required package: ParamHelpers
# Testing mlr
# fcregr_ets: .....
# DONE ===================================================================================================================
devtools::test(filter = "ets")
# Loading mlr
# Testing mlr
# fcregr_ets: .....
# DONE ===================================================================================================================
devtools::test(filter = "ets")
# Loading mlr
# Testing mlr
# fcregr_ets: .....
# DONE ===================================================================================================================
After speaking with @berndbischl, who I have cc'd here as this is slightly out of my depth and they have had this problem with mlr before, the problem comes from
Looking at when res <- .Call("etsTargetFunctionInit", y=y, nstate=nstate, errortype=switch(errortype,"A"=1,"M"=2),
trendtype=switch(trendtype,"N"=0,"A"=1,"M"=2), seasontype=switch(seasontype,"N"=0,"A"=1,"M"=2),
damped=damped, lowerb=lowerb, upperb=upperb,
opt.crit=opt.crit, nmse=as.integer(nmse), bounds=bounds, m=m,
optAlpha, optBeta, optGamma, optPhi,
givenAlpha, givenBeta, givenGamma, givenPhi,
alpha, beta, gamma, phi, env, package="forecast") This might sound silly, but does it matter that it is lower case Another possible point of interest from the same link, but rewritten for forecast
getNativeSymbolInfo("etsTargetFunctionInit")$package
# DLL name: forecast
# Filename: /home/steve/R/x86_64-pc-linux-gnu-library/3.3/forecast/libs/forecast.so
# Dynamic lookup: TRUE getCallingDLLe(getNamespace("forecast"))
# DLL name: forecast
# Filename: /home/steve/R/x86_64-pc-linux-gnu-library/3.3/forecast/libs/forecast.so
# Dynamic lookup: TRUE |
Hi, thanks a lot for spotting the problem. I could reproduce the error and changing "package" to "PACKAGE" fixes it. Fixed with commit bbf87bf |
I'm currently working to implement forecast within mlr. When writing my unit tests for
ets
a strange error will happen semi-sporadically. With a clean restart of R the following code will not produce an errorbelow is the session Info for this
Now when I attempt to run my test we encounter the error. The test can be run by cloning
https://github.com/Stevo15025/mlr
and running the following code
And now when we run the first block of code we also receive the same error
Below is the post-test session info
Could the problem be that there are too many packages loaded? Why would
etsTargetFunctionInit
disappear?The text was updated successfully, but these errors were encountered: