aloysius-lim / bigrf

Random forests for R for large data sets, optimized with parallel tree-growing and disk-based memory
91 stars 26 forks source link

"could not find function "big.matrix"" #6

Closed asteriske closed 10 years ago

asteriske commented 10 years ago

When I try to run the example code in parallel, I receive the error "could not find function "big.matrix""

library(bigmemory)                                                    

x <- Cars93                                                           
y <- Cars93$Type                                                      

vars <- c(4:22)                                                       

cl <- makeCluster(4)                                                  
registerDoParallel(cl)                                                
        forest1 <- bigrfc(x[1:60,], y[1:60], ntrees=50,varselect=vars)
#stopCluster(cl)                                                       

> forest1 <- bigrfc(x[1:60,], y[1:60], ntrees=50,varselect=vars)      
Error in { : task 1 failed - "could not find function "big.matrix""   
aloysius-lim commented 10 years ago

Could you send me the output of sessionInfo()?

asteriske commented 10 years ago

R version 3.0.2 (2013-09-25) Platform: x86_64-redhat-linux-gnu (64-bit)

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] parallel stats graphics grDevices utils datasets methods [8] base

other attached packages: [1] doParallel_1.0.6 iterators_1.0.6 foreach_1.4.1 [4] caret_6.0-22 ggplot2_0.9.3.1 lattice_0.20-24 [7] bigrf_0.1-8 bigmemory_4.4.6 BH_1.51.0-3 [10] bigmemory.sri_0.1.2 devtools_1.4.1

loaded via a namespace (and not attached): [1] car_2.0-19 codetools_0.2-8 colorspace_1.2-4 compiler_3.0.2 [5] dichromat_2.0-0 digest_0.6.4 evaluate_0.5.1 grid_3.0.2 [9] gtable_0.1.2 httr_0.2 labeling_0.2 MASS_7.3-29 [13] memoise_0.1 munsell_0.4.2 nnet_7.3-7 plyr_1.8 [17] proto_0.3-10 RColorBrewer_1.0-5 RCurl_1.95-4.1 reshape2_1.2.2 [21] scales_0.2.3 stringr_0.6.2 tcltk_3.0.2 tools_3.0.2 [25] whisker_0.3-2

On Tue, Feb 18, 2014 at 6:32 PM, Aloysius Lim notifications@github.comwrote:

Could you send me the output of sessionInfo()?

Reply to this email directly or view it on GitHubhttps://github.com/aloysius-lim/bigrf/issues/6#issuecomment-35448888 .

aloysius-lim commented 10 years ago

The problem seems to be the use of snow instead of multicore parallelism (see the documentation for the parallel package). It seems that with snow sockets, the bigmemory namespace is not shared across the cluster. To run bigrfc() in parallel, make sure that you use multicore parallelism as shown below. Calling registerDoParallel() with the cores argument causes doParallel to use multicore rather than snow.

library(bigrf, doParallel, MASS)
x <- Cars93
y <- Cars93$Type

vars <- c(4:22)

registerDoParallel(cores=4)
forest1 <- bigrfc(x[1:60,], y[1:60], ntrees=50,varselect=vars)
carlosacp526 commented 6 years ago

hi , I've the same problem

forest <- bigrfc(x, y, ntree=30L, varselect=vars, cachepath=NULL) Show Traceback

Rerun with Debug Error in { : task 1 failed - "no se pudo encontrar la función "big.matrix""

sessionInfo() R version 3.4.1 (2017-06-30) Platform: x86_64-w64-mingw32/x64 (64-bit) Running under: Windows 7 x64 (build 7601) Service Pack 1

Matrix products: default

locale: [1] LC_COLLATE=Spanish_Peru.1252 [2] LC_CTYPE=Spanish_Peru.1252
[3] LC_MONETARY=Spanish_Peru.1252 [4] LC_NUMERIC=C
[5] LC_TIME=Spanish_Peru.1252

attached base packages: [1] stats4 grid parallel stats
[5] graphics grDevices utils datasets [9] methods base

other attached packages: [1] party_1.3-1 strucchange_1.5-1
[3] sandwich_2.4-0 zoo_1.8-0
[5] modeltools_0.2-21 mvtnorm_1.0-6
[7] biganalytics_1.1.14 biglm_0.9-1
[9] DBI_1.0.0 doMPI_0.2.2
[11] Rmpi_0.6-7 devtools_1.13.5
[13] plyr_1.8.4 doParallel_1.0.11
[15] iterators_1.0.9 foreach_1.4.4
[17] bigmemory_4.5.33

loaded via a namespace (and not attached): [1] Rcpp_0.12.18 compiler_3.4.1
[3] git2r_0.21.0 tools_3.4.1
[5] digest_0.6.12 memoise_1.1.0
[7] lattice_0.20-35 Matrix_1.2-10
[9] curl_3.1 coin_1.2-1
[11] withr_2.1.1 httr_1.3.1
[13] knitr_1.20 R6_2.2.2
[15] bigmemory.sri_0.1.3 survival_2.41-3
[17] multcomp_1.4-7 TH.data_1.0-8
[19] MASS_7.3-47 codetools_0.2-15
[21] splines_3.4.1