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

Question Regarding Background Points Count in MAXENT Model Tuning #527

Open chenyongpeng1 opened 3 weeks ago

chenyongpeng1 commented 3 weeks ago

Dear biomod2 Team,

I hope this message finds you well. I would like to express my gratitude for the development and maintenance of the biomod2 package, which has been incredibly helpful for researchers like myself engaged in ecological modeling and species distribution predictions.

I am currently working on optimizing the parameters for the MAXENT model using the following code:


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

After running this code, I noticed that the background_data_dir parameter in the output was set to default:

$`_PA2_allRun`$background_data_dir 
[1] "default"

I am unsure how to specify the number of background points in the biomod2 package for the MAXENT model. I would appreciate it if you could provide guidance on the following questions:

Is it possible to set the number of background points for MAXENT in the biomod2 package? If so, could you provide relevant configuration parameters or example code to achieve this? Thank you for your assistance! I appreciate your hard work on the biomod2 package and look forward to any future enhancements and expansions.

Best regards, chen

MayaGueguen commented 3 weeks ago

Hello Chenyongpeng,

Thank you for posting, this is a good question as it can be understood from two angles 👀

  1. You would like to define and use the background_data_dir parameter when calling the BIOMOD_Modeling function.
  2. You would like to define and use the background_data_dir parameter when calling the bm_Tuning function.

The first case is quite easy, and here is an example of how to set it up :

## Let's say you tuned MAXENT with the bm_Tuning function and obtained the tuned.maxent object

## See which datasets have been tuned
print(names(tuned.maxent))

## For each dataset, change the value of the background_data_dir parameter
for (nam in names(tuned.maxent)) {
  tuned.maxent[[nam]]$background_data_dir = "yournewvalue"
}

user.val <- list(MAXENT.binary.MAXENT.MAXENT = tuned.maxent)

The second one is more complex as MAXENT tuning is done through the ENMevaluate function from the ENMeval package. I'm not 100% familiar with the parameters of this function, but I don't see any that seems to match with the background_data_dir parameter, but please tell me if I'm wrong.

Hope it helps, Maya