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.
85 stars 22 forks source link

BIOMOD_ModelingOptions 4.2-5-2 #483

Open eragrostis opened 2 months ago

eragrostis commented 2 months ago

I had to update my R earlier today and I guess I went to biomod 4.2-5-2 from biomod 4.2-4.

Naturally, this broke my entire script. What happened TO BIOMOD_ModelingOptions()? It's entirely disappeared and looks like it's been replaced with bm_ModelingOptions() which accepts entirely different arguments and no info in the documentation about how to update my code to run this new version. I highly recommend doing some reading in to "backwards compatibility". You're really doing a disservice to the reproducibility of science given that most biomod scripts created before whatever version deleted BIOMOD_ModelingOptions() will now fail spectacularly and without any useful error messages. Unless the authors were wise enough to say what version of biomod they developed the script under and the reproducee is wise enough to install from an archived version, it will now be up to the reproducee to refactor the entire script and probably introduce some errors.

Can you PLEASE stop deleting or renaming entire functions? This is like the 3rd time I'm going to have to refactor my entire script because of an update and I'm really quite upset about this. Is it so hard to keep the old functions and route them to the new functions in the background and give a warning("this function is deprecated please move to ")???

How am I supposed to port

BIOMOD_ModelingOptions(RF= list(ntree = 1000, sampsize = round(numPres * .95), replace = T), MAXENT = list(path_to_maxent.jar = "C:/Users/me/Desktop/GISmodelingTooLarge", threshold = F), GAM=list(k=3))

to bm_ModelingOptions ? The documentation gives no example of how the list for user.val is supposed to be structured.

Your code is super useful for ensemble modeling, and I'm thankful for the work you do. But for the love of reproducibility, please make all updates backwards compatible.

HeleneBlt commented 2 months ago

Hi Kevin !

With biomod2 v4.2-5-2, the code will look like this :

You need to indicate which PA or RUN you want to change

user.RF <- list('_PA1_allRun' = list(ntree = 1000, sampsize = round(numPres * .95), replace = T),
                '_PA2_allRun' = list(ntree = 1000, sampsize = round(numPres * .95), replace = T))

user.maxent <- list('_PA1_allRun' = list(path_to_maxent.jar = "C:/Users/me/Desktop/GISmodelingTooLarge", threshold = F),
                    '_PA2_allRun' = list(path_to_maxent.jar = "C:/Users/me/Desktop/GISmodelingTooLarge", threshold = F))

user.gam <- list('_PA1_allRun' = list(k = 3),
                 '_PA2_allRun' = list(k = 3))

After, you can create your user.val and your set of options.

user.val <- list( GAM.binary.mgcv.gam = user.gam, ## see in ModelsTable
                  MAXENT.binary.MAXENT.MAXENT = user.maxent,
                  RF.binary.randomForest.randomForest = user.RF)

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

You can pass your set of options to BIOMOD_Modeling with the argument OPT.user:

myBiomodModelOut <- BIOMOD_Modeling(bm.format = myBiomodData,
                                    modeling.id = 'Example',
                                    models = c('GAM', 'MAXENT', 'RF'),
                                    CV.strategy = 'user.defined',
                                    CV.user.table = myCVtable,
                                    OPT.strategy = "user.defined",
                                    OPT.user = myOpt,
                                    metric.eval = c('TSS','ROC'),
                                    var.import = 2)

If you pass to the version 4.2-6, it will be simpler:

user.RF <- list('for_all_datasets' = list(ntree = 1000, sampsize = round(numPres * .95), replace = T))

user.maxent <- list('for_all_datasets' = list(path_to_maxent.jar = "C:/Users/me/Desktop/GISmodelingTooLarge", threshold = F))

user.gam <- list('for_all_datasets' = list(k = 3))

and the rest will be the same. :tada:

You can find more information : 👀

Of course, if you want to keep your scripts, you can have access to the archives here. 📂

Hope it helps! 😄

Hélène