biomodhub / biomod2

BIOMOD is a computer platform for ensemble forecasting of species distributions, enabling the treatment of a range of methodological uncertainties in models and the examination of species-environment relationships.
89 stars 22 forks source link

Error in BIOMOD_EnsembleModeling -错误于{: task 1 failed - "task 1 failed - "在为函数“get_predictions”选择方法时计算参数“obj”时出错:链结无效"" #545

Open chenyongpeng1 opened 1 day ago

chenyongpeng1 commented 1 day ago

Dear biomod2 Team,

I hope this email finds you well.

I am currently encountering an issue while using the biomod2 package. I have updated to the latest version, biomod2 4.2.6-2, and noticed the addition of the tune.args and cluster functionalities. BIOMOD_Modelingsection works better than in the previous version. However, I encountered the following error in BIOMOD_EnsembleModeling,and I suspect it might be related to the MaxEnt model.

Code used to get the error


`myResp <- as.numeric(DataSpecies[, myRespName])
myRespXY <- DataSpecies[, c( 'Longitude','Latitude')]

myResp.PA <- ifelse(myResp == 1, 1, NA)
n_PA_3 <- length(DataSpecies$apis) 

myBiomodData <- BIOMOD_FormatingData(expl.var = myExpl,
                                     resp.var = myResp.PA,
                                     resp.xy = myRespXY,
                                     resp.name = myRespName,
                                     PA.nb.rep = 4,
                                     PA.nb.absences =  c(rep(n_PA_3, 2), rep(10000, 2)),
                                     PA.strategy = 'random',
                                     filter.raster = TRUE,
                                     dir.name = getwd(),
                                     seed.val = 1234)

myBiomodData

saveRDS(myBiomodData, "myBiomodData.rds")
myBiomodData <- readRDS("myBiomodData.rds")

PA_used <- colnames(myBiomodData @PA.table)
PA1_10 <- paste0("PA", 1:2) # PAs with max number (=10000 pseudoabsences)
PA11_20 <- paste0("PA", 3:4)# PAs with equal number of PA than presences

GLM <- PA1_10 # need large set of PA number
GBM <- PA11_20 # need equal number than presences
GAM <-  PA1_10 # need large set of PA number
RF <- PA11_20 # need equal number than presences
MAXENT <- PA1_10 # need large set of PA number
XGBOOST<-PA11_20
models.pa <- list(GBM = GBM, RF = RF, GLM = GLM, GAM = GAM, MAXENT = MAXENT, XGBOOST= XGBOOST)

opt.d <- bm_ModelingOptions(data.type = 'binary',
                            models = c("GAM","GBM", "RF", "MAXENT","XGBOOST"),
                            strategy = 'default') # we do not include the calibration table, so the tuning is done over the PA datasets only

form.GLM <- bm_MakeFormula(resp.name = myBiomodData @sp.name,
                           expl.var = head(myBiomodData @data.env.var),
                           type = 'quadratic',
                           interaction.level = 0)

user.GLM <- list('_PA1_allRun' = list(formula = form.GLM),
                 '_PA2_allRun' = list(formula = form.GLM),
                 '_PA3_allRun' = list(formula = form.GLM),
                 '_PA4_allRun' = list(formula = form.GLM))

tuned.gam <- bm_Tuning(model = 'GAM',
                       tuning.fun = 'gam', ## see in ModelsTable
                       bm.options = opt.d@options$GAM.binary.mgcv.gam,
                       do.formula = F,
                       bm.format = myBiomodData ,
                       metric.eval = "TSS")

tuned.rf <- bm_Tuning(model = 'RF',
                      tuning.fun = 'rf', ## see in ModelsTable
                      bm.options = opt.d@options$RF.binary.randomForest.randomForest,
                      do.formula = F,
                      bm.format = myBiomodData ,
                      metric.eval = "TSS")

tuned.gbm <- bm_Tuning(model = "GBM",
                       tuning.fun = "gbm", ## see in ModelsTable
                       bm.options = opt.d@options$GBM.binary.gbm.gbm,
                       do.formula = F,
                       bm.format = myBiomodData ,
                       metric.eval = "TSS")

tuned.maxent <- bm_Tuning(model = "MAXENT",
                          tuning.fun = "ENMevaluate", ## see in ModelsTable
                          bm.options = opt.d@options$MAXENT.binary.MAXENT.MAXENT,
                          do.formula = F,
                          bm.format = myBiomodData ,
                          metric.eval = "or.mtp.avg",
                          params.train = list(MAXENT.algorithm= "maxnet", MAXENT.parallel = FALSE))

tuned.xgboost <- bm_Tuning(model = "XGBOOST",
                           tuning.fun = "xgbTree",
                           do.formula = TRUE,
                           bm.options = opt.d@options$XGBOOST.binary.xgboost,
                           bm.format = myBiomodData)

user.val <- list(GLM.binary.stats.glm= user.GLM,
                 GAM.binary.mgcv.gam = tuned.gam,
                 RF.binary.randomForest.randomForest = tuned.rf,
                 GBM.binary.gbm.gbm = tuned.gbm,
                 MAXENT.binary.MAXENT.MAXENT=tuned.maxent,
                 XGBOOST.binary.xgboost.xgboost=tuned.xgboost)

myBiomodOption <- bm_ModelingOptions(data.type = 'binary',
                                     models = c("GLM", "GBM", "GAM", "RF", "MAXENT","XGBOOST"),
                                     strategy = "user.defined",
                                     user.base = 'bigboss',
                                     bm.format = myBiomodData ,
                                     user.val = user.val)

myCVtable_folds <- bm_CrossValidation(bm.format = myBiomodData ,
                                      strategy = "kfold",
                                      nb.rep= 4,
                                      k=5,
                                      do.full.models = TRUE)

myBiomodModelOut <- BIOMOD_Modeling(bm.format = myBiomodData ,
                                                     models = c("GLM", "GBM", "GAM", "RF", "MAXENT","XGBOOST"),
                                                     models.pa = models.pa, #Set which PA number should each model use
                                                     CV.strategy = 'user.defined',
                                                     CV.user.table = myCVtable_folds,
                                                     OPT.user = myBiomodOption,
                                                     OPT.strategy = "bigboss",
                                                     metric.eval = c('TSS', 'ROC', 'KAPPA'),
                                                     var.import = 3,#number of permutations to evaluate the variable importance
                                                     prevalence = 0.5,  # Equal weighting of presences and absences
                                                     nb.cpu = 1)

myBiomodModelEval<-get_evaluations(myBiomodModelOut)
myBiomodModelEval
get_variables_importance(myBiomodModelOut)
dimnames(myBiomodModelEval)
write.csv(myBiomodModelEval,file = "./myBiomodModelEval_145.csv")

varimportan=get_variables_importance(myBiomodModelOut)
write.csv(varimportan,"./varimportan_20.csv")         

bm_PlotEvalMean(bm.out = myBiomodModelOut)
bm_PlotEvalBoxplot(bm.out = myBiomodModelOut, group.by = c('algo', 'algo'))

myBiomodEM <- BIOMOD_EnsembleModeling(bm.mod = myBiomodModelOut,
                                      models.chosen = 'all',
                                      em.by = "all",
                                      metric.select = c('TSS'),
                                      metric.select.thresh = c(0.8),
                                      var.import = 3,
                                      metric.eval = c('TSS'),
                                      em.algo = c( 'EMcv',  'EMca', 'EMwmean'),
                                      # em.algo = c('EMca', 'EMwmean'),
                                      EMci.alpha = 0.05,
                                      EMwmean.decay = 'proportional')
 myBiomodEM <- BIOMOD_EnsembleModeling(bm.mod = myBiomodModelOut,
+                                       models.chosen = 'all',
+                                       em.by = "all",
+                                       metric.select = c('TSS'),
+                                       metric.select.thresh = c(0.8),
+                                       var.import = 3,
+                                       metric.eval = c('TSS'),
+                                       em.algo = c( 'EMcv',  'EMca', 'EMwmean'),
+                                       # em.algo = c('EMca', 'EMwmean'),
+                                       EMci.alpha = 0.05,
+                                       EMwmean.decay = 'proportional')

-=-=-=-=-=-=-=-=-=-=-=-= Build Ensemble Models -=-=-=-=-=-=-=-=-=-=-=-=

   ! all models available will be included in ensemble.modeling
  ! Ensemble Models will be filtered and/or weighted using validation dataset (if possible). Please use `metric.select.dataset` for alternative options.
   > Evaluation & Weighting methods summary :
      TSS over 0.8

!!! Removed models using the Full dataset as ensemble models cannot merge repetition dataset (RUN1, RUN2, ...) with Full dataset unless em.by = 'PA+run'.

  > mergedData_mergedRun_mergedAlgo ensemble modeling
   ! Additional projection required for ensemble models merging several pseudo-absence dataset...
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= Do Single Models Projection -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= Do Single Models Projection -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= Do Single Models Projection -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= Do Single Models Projection -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
错误于{: 
  task 1 failed - "task 1 failed - "在为函数“get_predictions”选择方法时计算参数“obj”时出错:链结无效""
> 

myBiomodData -=-=-=-=-=-=-=-=-=-=-=-= BIOMOD.formated.data -=-=-=-=-=-=-=-=-=-=-=- = dir.name = D:/apist sp.name = apis 2406 presences, 0 true absences and 24829 undefined points in dataset 9 explanatory variables bio13 bio14 bio18 bio19 Min. : 0.0 Min. : 0.0 Min. : 0 Min. : 0.0 1st Qu.: 48.0 1st Qu.: 3.0 1st Qu.: 92 1st Qu.: 24.0 Median : 87.0 Median : 11.0 Median : 191 Median : 60.0 Mean : 140.4 Mean : 21.9 Mean : 249 Mean : 143.1 3rd Qu.: 204.0 3rd Qu.: 27.0 3rd Qu.: 319 3rd Qu.: 140.0 Max. :2439.0 Max. :448.0 Max. :4732 Max. :4402.0 bio2 bio3 bio5 elev Min. : 1.000 Min. : 9.456 Min. :-8.82 Min. :-260.0 1st Qu.: 8.528 1st Qu.: 23.358 1st Qu.:21.34 1st Qu.: 138.0 Median :10.907 Median : 35.117 Median :28.80 Median : 347.0 Mean :10.913 Mean : 40.063 Mean :26.85 Mean : 631.9 3rd Qu.:13.238 3rd Qu.: 53.603 3rd Qu.:33.42 3rd Qu.: 799.0 Max. :20.253 Max. :100.000 Max. :48.11 Max. :5970.0 hii_v2geo1 Min. :-128.000 1st Qu.: 1.256 Median : 8.094 Mean : 7.776 3rd Qu.: 17.707 Max. : 62.279 4 Pseudo Absences dataset available ( PA1, PA2, PA3, PA4 ) with 2428 (PA1, PA2), 10000 (PA3, PA4) pseudo absences -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=



> myBiomodModelOut  -=-=-=-=-=-=-=-=-=-=-=-=-= BIOMOD.models.out -=-=-=-=-=-=-=-=-=-=-=-=-=  Modeling folder : D:/apist  Species modeled : apis  Modeling id : 1732172687  Considered variables : bio13 bio14 bio18 bio19 bio2 bio3 bio5 elev  hii_v2geo1   Computed Models :  apis_PA1_RUN1_GLM apis_PA1_RUN1_GAM  apis_PA1_RUN1_MAXENT apis_PA1_RUN2_GLM apis_PA1_RUN2_GAM  apis_PA1_RUN2_MAXENT apis_PA1_RUN3_GLM apis_PA1_RUN3_GAM  apis_PA1_RUN3_MAXENT apis_PA1_RUN4_GLM apis_PA1_RUN4_GAM  apis_PA1_RUN4_MAXENT apis_PA1_RUN5_GLM apis_PA1_RUN5_GAM  apis_PA1_RUN5_MAXENT apis_PA1_RUN6_GLM apis_PA1_RUN6_GAM  apis_PA1_RUN6_MAXENT apis_PA1_RUN7_GLM apis_PA1_RUN7_GAM  apis_PA1_RUN7_MAXENT apis_PA1_RUN8_GLM apis_PA1_RUN8_GAM  apis_PA1_RUN8_MAXENT apis_PA1_RUN9_GLM apis_PA1_RUN9_GAM  apis_PA1_RUN9_MAXENT apis_PA1_RUN10_GLM apis_PA1_RUN10_GAM  apis_PA1_RUN10_MAXENT apis_PA1_RUN11_GLM apis_PA1_RUN11_GAM  apis_PA1_RUN11_MAXENT apis_PA1_RUN12_GLM apis_PA1_RUN12_GAM  apis_PA1_RUN12_MAXENT apis_PA1_RUN13_GLM apis_PA1_RUN13_GAM  apis_PA1_RUN13_MAXENT apis_PA1_RUN14_GLM apis_PA1_RUN14_GAM  apis_PA1_RUN14_MAXENT apis_PA1_RUN15_GLM apis_PA1_RUN15_GAM  apis_PA1_RUN15_MAXENT apis_PA1_RUN16_GLM apis_PA1_RUN16_GAM  apis_PA1_RUN16_MAXENT apis_PA1_RUN17_GLM apis_PA1_RUN17_GAM  apis_PA1_RUN17_MAXENT apis_PA1_RUN18_GLM apis_PA1_RUN18_GAM  apis_PA1_RUN18_MAXENT apis_PA1_RUN19_GLM apis_PA1_RUN19_GAM  apis_PA1_RUN19_MAXENT apis_PA1_RUN20_GLM apis_PA1_RUN20_GAM  apis_PA1_RUN20_MAXENT apis_PA1_allRun_GLM apis_PA1_allRun_GAM  apis_PA1_allRun_MAXENT apis_PA2_RUN1_GLM apis_PA2_RUN1_GAM  apis_PA2_RUN1_MAXENT apis_PA2_RUN2_GLM apis_PA2_RUN2_GAM  apis_PA2_RUN2_MAXENT apis_PA2_RUN3_GLM apis_PA2_RUN3_GAM  apis_PA2_RUN3_MAXENT apis_PA2_RUN4_GLM apis_PA2_RUN4_GAM  apis_PA2_RUN4_MAXENT apis_PA2_RUN5_GLM apis_PA2_RUN5_GAM  apis_PA2_RUN5_MAXENT apis_PA2_RUN6_GLM apis_PA2_RUN6_GAM  apis_PA2_RUN6_MAXENT apis_PA2_RUN7_GLM apis_PA2_RUN7_GAM  apis_PA2_RUN7_MAXENT apis_PA2_RUN8_GLM apis_PA2_RUN8_GAM  apis_PA2_RUN8_MAXENT apis_PA2_RUN9_GLM apis_PA2_RUN9_GAM  apis_PA2_RUN9_MAXENT apis_PA2_RUN10_GLM apis_PA2_RUN10_GAM  apis_PA2_RUN10_MAXENT apis_PA2_RUN11_GLM apis_PA2_RUN11_GAM  apis_PA2_RUN11_MAXENT apis_PA2_RUN12_GLM apis_PA2_RUN12_GAM  apis_PA2_RUN12_MAXENT apis_PA2_RUN13_GLM apis_PA2_RUN13_GAM  apis_PA2_RUN13_MAXENT apis_PA2_RUN14_GLM apis_PA2_RUN14_GAM  apis_PA2_RUN14_MAXENT apis_PA2_RUN15_GLM apis_PA2_RUN15_GAM  apis_PA2_RUN15_MAXENT apis_PA2_RUN16_GLM apis_PA2_RUN16_GAM  apis_PA2_RUN16_MAXENT apis_PA2_RUN17_GLM apis_PA2_RUN17_GAM  apis_PA2_RUN17_MAXENT apis_PA2_RUN18_GLM apis_PA2_RUN18_GAM  apis_PA2_RUN18_MAXENT apis_PA2_RUN19_GLM apis_PA2_RUN19_GAM  apis_PA2_RUN19_MAXENT apis_PA2_RUN20_GLM apis_PA2_RUN20_GAM  apis_PA2_RUN20_MAXENT apis_PA2_allRun_GLM apis_PA2_allRun_GAM  apis_PA2_allRun_MAXENT apis_PA3_RUN1_GBM apis_PA3_RUN1_RF  apis_PA3_RUN1_XGBOOST apis_PA3_RUN2_GBM apis_PA3_RUN2_RF  apis_PA3_RUN2_XGBOOST apis_PA3_RUN3_GBM apis_PA3_RUN3_RF  apis_PA3_RUN3_XGBOOST apis_PA3_RUN4_GBM apis_PA3_RUN4_RF  apis_PA3_RUN4_XGBOOST apis_PA3_RUN5_GBM apis_PA3_RUN5_RF  apis_PA3_RUN5_XGBOOST apis_PA3_RUN6_GBM apis_PA3_RUN6_RF  apis_PA3_RUN6_XGBOOST apis_PA3_RUN7_GBM apis_PA3_RUN7_RF  apis_PA3_RUN7_XGBOOST apis_PA3_RUN8_GBM apis_PA3_RUN8_RF  apis_PA3_RUN8_XGBOOST apis_PA3_RUN9_GBM apis_PA3_RUN9_RF  apis_PA3_RUN9_XGBOOST apis_PA3_RUN10_GBM apis_PA3_RUN10_RF  apis_PA3_RUN10_XGBOOST apis_PA3_RUN11_GBM apis_PA3_RUN11_RF  apis_PA3_RUN11_XGBOOST apis_PA3_RUN12_GBM apis_PA3_RUN12_RF  apis_PA3_RUN12_XGBOOST apis_PA3_RUN13_GBM apis_PA3_RUN13_RF  apis_PA3_RUN13_XGBOOST apis_PA3_RUN14_GBM apis_PA3_RUN14_RF  apis_PA3_RUN14_XGBOOST apis_PA3_RUN15_GBM apis_PA3_RUN15_RF  apis_PA3_RUN15_XGBOOST apis_PA3_RUN16_GBM apis_PA3_RUN16_RF  apis_PA3_RUN16_XGBOOST apis_PA3_RUN17_GBM apis_PA3_RUN17_RF  apis_PA3_RUN17_XGBOOST apis_PA3_RUN18_GBM apis_PA3_RUN18_RF  apis_PA3_RUN18_XGBOOST apis_PA3_RUN19_GBM apis_PA3_RUN19_RF  apis_PA3_RUN19_XGBOOST apis_PA3_RUN20_GBM apis_PA3_RUN20_RF  apis_PA3_RUN20_XGBOOST apis_PA3_allRun_GBM apis_PA3_allRun_RF  apis_PA3_allRun_XGBOOST apis_PA4_RUN1_GBM apis_PA4_RUN1_RF  apis_PA4_RUN1_XGBOOST apis_PA4_RUN2_GBM apis_PA4_RUN2_RF  apis_PA4_RUN2_XGBOOST apis_PA4_RUN3_GBM apis_PA4_RUN3_RF  apis_PA4_RUN3_XGBOOST apis_PA4_RUN4_GBM apis_PA4_RUN4_RF  apis_PA4_RUN4_XGBOOST apis_PA4_RUN5_GBM apis_PA4_RUN5_RF  apis_PA4_RUN5_XGBOOST apis_PA4_RUN6_GBM apis_PA4_RUN6_RF  apis_PA4_RUN6_XGBOOST apis_PA4_RUN7_GBM apis_PA4_RUN7_RF  apis_PA4_RUN7_XGBOOST apis_PA4_RUN8_GBM apis_PA4_RUN8_RF  apis_PA4_RUN8_XGBOOST apis_PA4_RUN9_GBM apis_PA4_RUN9_RF  apis_PA4_RUN9_XGBOOST apis_PA4_RUN10_GBM apis_PA4_RUN10_RF  apis_PA4_RUN10_XGBOOST apis_PA4_RUN11_GBM apis_PA4_RUN11_RF  apis_PA4_RUN11_XGBOOST apis_PA4_RUN12_GBM apis_PA4_RUN12_RF  apis_PA4_RUN12_XGBOOST apis_PA4_RUN13_GBM apis_PA4_RUN13_RF  apis_PA4_RUN13_XGBOOST apis_PA4_RUN14_GBM apis_PA4_RUN14_RF  apis_PA4_RUN14_XGBOOST apis_PA4_RUN15_GBM apis_PA4_RUN15_RF  apis_PA4_RUN15_XGBOOST apis_PA4_RUN16_GBM apis_PA4_RUN16_RF  apis_PA4_RUN16_XGBOOST apis_PA4_RUN17_GBM apis_PA4_RUN17_RF  apis_PA4_RUN17_XGBOOST apis_PA4_RUN18_GBM apis_PA4_RUN18_RF  apis_PA4_RUN18_XGBOOST apis_PA4_RUN19_GBM apis_PA4_RUN19_RF  apis_PA4_RUN19_XGBOOST apis_PA4_RUN20_GBM apis_PA4_RUN20_RF  apis_PA4_RUN20_XGBOOST apis_PA4_allRun_GBM apis_PA4_allRun_RF  apis_PA4_allRun_XGBOOST   Failed Models :  none  -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= >

 
> | >
>

<!--EndFragment-->
</body>
</html>`

**Environment Information**

`` sessionInfo() 
R version 4.4.2 (2024-10-31 ucrt)
Platform: x86_64-w64-mingw32/x64
Running under: Windows 10 x64 (build 19045)

Matrix products: default

locale:
[1] LC_COLLATE=Chinese (Simplified)_China.utf8  LC_CTYPE=Chinese (Simplified)_China.utf8   
[3] LC_MONETARY=Chinese (Simplified)_China.utf8 LC_NUMERIC=C                               
[5] LC_TIME=Chinese (Simplified)_China.utf8    

time zone: Asia/Shanghai
tzcode source: internal

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

other attached packages:
 [1] fuzzySim_4.26        dplyr_1.1.4          ggpubr_0.6.0         maps_3.4.2.1         rgbif_3.8.1         
 [6] spThin_0.2.0         knitr_1.49           fields_16.3          viridisLite_0.4.2    spam_2.11-0         
[11] rasterVis_0.51.6     lattice_0.22-6       raster_3.6-30        sp_2.1-4             gridExtra_2.3       
[16] ggplot2_3.5.1        xgboost_1.7.8.1      randomForest_4.7-1.2 maxnet_0.1.4         earth_5.3.4         
[21] plotmo_3.6.4         plotrix_3.8-4        Formula_1.2-5        gbm_2.2.2            mgcv_1.9-1          
[26] nlme_3.1-166         gam_1.22-5           foreach_1.5.2        mda_0.5-5            class_7.3-22        
[31] rpart_4.1.23         nnet_7.3-19          biomod2_4.2-6-2     

loaded via a namespace (and not attached):
 [1] deldir_2.0-4           pROC_1.18.5            rlang_1.1.4            magrittr_2.0.3         compiler_4.4.2        
 [6] png_0.1-8              vctrs_0.6.5            reshape2_1.4.4         stringr_1.5.1          pkgconfig_2.0.3       
[11] backports_1.5.0        labeling_0.4.3         utf8_1.2.4             purrr_1.0.2            xfun_0.49             
[16] jsonlite_1.8.9         PresenceAbsence_1.1.11 reshape_0.8.9          jpeg_0.1-10            terra_1.7-83          
[21] broom_1.0.7            parallel_4.4.2         R6_2.5.1               stringi_1.8.4          RColorBrewer_1.1-3    
[26] car_3.1-3              lubridate_1.9.3        Rcpp_1.0.13-1          iterators_1.0.14       zoo_1.8-12            
[31] Matrix_1.7-1           timechange_0.3.0       tidyselect_1.2.1       rstudioapi_0.17.1      abind_1.4-8           
[36] timeDate_4041.110      doParallel_1.0.17      codetools_0.2-20       tibble_3.2.1           plyr_1.8.9            
[41] withr_3.0.2            evaluate_1.0.1         survival_3.7-0         xml2_1.3.6             pillar_1.9.0          
[46] carData_3.0-5          whisker_0.4.1          modEvA_3.20            generics_0.1.3         munsell_0.5.1         
[51] scales_1.3.0           glue_1.8.0             lazyeval_0.2.2         tools_4.4.2            interp_1.1-6          
[56] hexbin_1.28.5          data.table_1.16.2      ggsignif_0.6.4         dotCall64_1.2          tidyr_1.3.1           
[61] latticeExtra_0.6-30    colorspace_2.1-1       cli_3.6.3              fansi_1.0.6            gtable_0.3.6          
[66] rstatix_0.7.2          oai_0.4.0              farver_2.1.2           lifecycle_1.0.4        dismo_1.3-14          
[71] httr_1.4.7            `

**Additional information**
If you have any additional information or context you can add it here.
HeleneBlt commented 1 day ago

Hello !

I just sent a commit to correct some issues with the clusters. Could you try with this new version? And if you have the same error, could you try to give us your best traduction : it will be better than an automatic traduction. 🙏

Thanks a lot ! Hélène

chenyongpeng1 commented 1 day ago

hello! I removed and reinstalled the latest version .Unfortunately, this issue still persists, and it occurs during the hyperparameter tuning process.

tuned.gam <- bm_Tuning(model = 'GAM',
+                        tuning.fun = 'gam', ## see in ModelsTable
+                        bm.options = opt.d@options$GAM.binary.mgcv.gam,
+                        do.formula = F,
+                        bm.format = myBiomodData ,
+                        metric.eval = "TSS")

        > Dataset _PA1_allRun
            > Tuning parameters...Error in summary.connection(connection) : 链结无效

        > Dataset _PA2_allRun
            > Tuning parameters...Error in summary.connection(connection) : 链结无效

        > Dataset _PA3_allRun
            > Tuning parameters...Error in summary.connection(connection) : 链结无效

        > Dataset _PA4_allRun
            > Tuning parameters...Error in summary.connection(connection) : 链结无效
错误于{: task 1 failed - "找不到对象'tuned.mod'"

The connection is not valid.


> myBiomodEM <- BIOMOD_EnsembleModeling(bm.mod = myBiomodModelOut,
+                                       models.chosen = 'all',
+                                       em.by = "all",
+                                       metric.select = c('TSS'),
+                                       metric.select.thresh = c(0.8),
+                                       var.import = 3,
+                                       metric.eval = c('TSS'),
+                                       em.algo = c( 'EMcv',  'EMca', 'EMwmean'),
+                                       # em.algo = c('EMca', 'EMwmean'),
+                                       EMci.alpha = 0.05,
+                                       EMwmean.decay = 'proportional')

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= Build Ensemble Models -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

   ! all models available will be included in ensemble.modeling
  ! Ensemble Models will be filtered and/or weighted using validation dataset (if possible). Please use `metric.select.dataset` for alternative options.
   > Evaluation & Weighting methods summary :
      TSS over 0.8

!!! Removed models using the Full dataset as ensemble models cannot merge repetition dataset (RUN1, RUN2, ...) with Full dataset unless em.by = 'PA+run'.

  > mergedData_mergedRun_mergedAlgo ensemble modeling
   ! Additional projection required for ensemble models merging several pseudo-absence dataset...
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= Do Single Models Projection -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= Do Single Models Projection -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= Do Single Models Projection -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= Do Single Models Projection -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
错误于{: 
  task 1 failed - "task 1 failed - "在为函数“get_predictions”选择方法时计算参数“obj”时出错:链结无效""
HeleneBlt commented 1 day ago

Hi again,

For the error with bm_tuning, could you try to run :

env <- foreach:::.foreachGlobals
rm(list=ls(name=env), pos=env)

and try again ? 🙏

Generally, I will advise you to clean everything and to restart with a new session! 🙈 Is it possible you have some conflict with another get_predictions function?

Thanks a lot Hélène

chenyongpeng1 commented 1 day ago

Hi again, please wait a minute! it is restarting with a new session .

chenyongpeng1 commented 21 hours ago

HI again, it works well! great!!! Thanks a lot, chenyongpeng