BIOMOD_Tuning {biomod2} | R Documentation |
Tune models parameters
Description
Function to tune biomod2 single models parameters
Usage
BIOMOD_Tuning(
bm.format,
bm.options = BIOMOD_ModelingOptions(),
models = c("GLM", "GBM", "GAM", "CTA", "ANN", "SRE", "FDA", "MARS", "RF", "MAXENT"),
metric.eval = "ROC",
ctrl.train = NULL,
ctrl.train.tuneLength = 30,
ctrl.ANN = NULL,
ctrl.CTA = NULL,
ctrl.FDA = NULL,
ctrl.GAM = NULL,
ctrl.GBM = NULL,
ctrl.GLM = NULL,
ctrl.MARS = NULL,
ctrl.RF = NULL,
ANN.method = "avNNet",
ANN.decay.tune = c(0.001, 0.01, 0.05, 0.1),
ANN.size.tune = c(2, 4, 6, 8),
ANN.maxit = 500,
ANN.MaxNWts = 10 * (ncol(bm.format@data.env.var) + 1) + 10 + 1,
MARS.method = "earth",
GAM.method = "gam",
GLM.method = "glmStepAIC",
GLM.type = c("simple", "quadratic", "polynomial", "s_smoother"),
GLM.interaction = c(0, 1),
ME.cvmethod = "randomkfold",
ME.overlap = FALSE,
ME.kfolds = 10,
ME.n.bg = 10000,
ME.env = NULL,
ME.metric = "ROC",
ME.clamp = TRUE,
ME.parallel = FALSE,
ME.numCores = NULL,
RF.method = "rf",
weights = NULL
)
Arguments
bm.format |
a |
bm.options |
a |
models |
a |
metric.eval |
a |
ctrl.train |
global control parameters that can be obtained from the
|
ctrl.train.tuneLength |
(see |
ctrl.ANN |
control parameters for |
ctrl.CTA |
control parameters for |
ctrl.FDA |
control parameters for |
ctrl.GAM |
control parameters for |
ctrl.GBM |
control parameters for |
ctrl.GLM |
control parameters for |
ctrl.MARS |
control parameters for |
ctrl.RF |
control parameters for |
ANN.method |
a |
ANN.decay.tune |
a |
ANN.size.tune |
a |
ANN.maxit |
an |
ANN.MaxNWts |
an |
MARS.method |
a |
GAM.method |
a |
GLM.method |
a |
GLM.type |
a |
GLM.interaction |
a |
ME.cvmethod |
a |
ME.overlap |
(optional, default |
ME.kfolds |
an |
ME.n.bg |
an |
ME.env |
a |
ME.metric |
a |
ME.clamp |
(optional, default |
ME.parallel |
(optional, default |
ME.numCores |
an |
RF.method |
a |
weights |
a |
Details
-
ctrl.train
parameter is set by default to :
caret::trainControl(method = 'cv', summaryFunction = caret::twoClassSummary,
classProbs = TRUE, returnData = FALSE)
. All control parameters for other models are set to
ctrl.train
if unspecified.For more details on
MAXENT
tuning, please refer toENMevaluate
.For more details on other models tuning, please refer to
train
.
Value
A BIOMOD.models.options
object (see BIOMOD_ModelingOptions
) with
optimized parameters
Author(s)
Frank Breiner
References
Kuhn, Max. 2008. Building predictive models in R using the caret package. Journal of Statistical Software 28, 1-26.
Kuhn, Max, and Kjell Johnson. 2013. Applied predictive modeling. New York: Springer.
Muscarella, Robert, et al. 2014. ENMeval: An R package for conducting spatially independent evaluations and estimating optimal model complexity for Maxent ecological niche models. Methods in Ecology and Evolution, 5, 1198-1205.
See Also
trainControl
, train
,
calc.niche.overlap
, ENMevaluate
,
BIOMOD_ModelingOptions
, BIOMOD_Modeling
Other Main functions:
BIOMOD_EnsembleForecasting()
,
BIOMOD_EnsembleModeling()
,
BIOMOD_FormatingData()
,
BIOMOD_LoadModels()
,
BIOMOD_ModelingOptions()
,
BIOMOD_Modeling()
,
BIOMOD_PresenceOnly()
,
BIOMOD_Projection()
,
BIOMOD_RangeSize()
Examples
library(terra)
# Load species occurrences (6 species available)
data(DataSpecies)
head(DataSpecies)
# Select the name of the studied species
myRespName <- 'GuloGulo'
# Get corresponding presence/absence data
myResp <- as.numeric(DataSpecies[, myRespName])
# Get corresponding XY coordinates
myRespXY <- DataSpecies[, c('X_WGS84', 'Y_WGS84')]
# Load environmental variables extracted from BIOCLIM (bio_3, bio_4, bio_7, bio_11 & bio_12)
data(bioclim_current)
myExpl <- terra::rast(bioclim_current)
# --------------------------------------------------------------- #
# Format Data with true absences
myBiomodData <- BIOMOD_FormatingData(resp.var = myResp,
expl.var = myExpl,
resp.xy = myRespXY,
resp.name = myRespName)
# --------------------------------------------------------------- #
### Duration for turing all models sequential with default settings
### on 3.4 GHz processor: approx. 45 min tuning all models in parallel
### (on 8 cores) using foreach loops runs much faster: approx. 14 min
## Not run:
# library(doParallel)
# cl <- makeCluster(8)
# doParallel::registerDoParallel(cl)
time.seq <- system.time(
bm.tuning <- BIOMOD_Tuning(bm.format = myBiomodData, ME.env = myExpl, ME.n.bg = ncell(myExpl))
)
# stopCluster(cl)
plot(bm.tuning$tune.CTA.rpart)
plot(bm.tuning$tune.CTA.rpart2)
plot(bm.tuning$tune.RF)
plot(bm.tuning$tune.ANN)
plot(bm.tuning$tune.MARS)
plot(bm.tuning$tune.FDA)
plot(bm.tuning$tune.GBM)
plot(bm.tuning$tune.GAM)
# Get tuned modeling options
myBiomodOptions <- bm.tuning$models.options
## End(Not run)