Description Usage Arguments Details Value Author(s) See Also Examples
Function to tune biomod single models parameters
1 2 3 4 5 6 7 8 9 10 11 12  | BIOMOD_tuning(data, models = c("GLM", "GBM", "GAM", "CTA", "ANN", "FDA",
  "MARS", "RF", "MAXENT.Phillips"), models.options = BIOMOD_ModelingOptions(),
  method.ANN = "avNNet", method.RF = "rf", method.MARS = "earth",
  method.GAM = "gam", method.GLM = "glmStepAIC", trControl = NULL,
  metric = "ROC", ctrl.CTA = NULL, ctrl.RF = NULL, ctrl.ANN = NULL,
  ctrl.MARS = NULL, ctrl.FDA = NULL, ctrl.GAM = NULL, ctrl.GBM = NULL,
  ctrl.GLM = NULL, tuneLength = 30, decay.tune.ANN = c(0.001, 0.01, 0.05,
  0.1), size.tune.ANN = c(2, 4, 6, 8), maxit.ANN = 500, MaxNWts.ANN = 10 *
  (ncol(data@data.env.var) + 1) + 10 + 1, type.GLM = "simple",
  cvmethod.ME = "randomkfold", overlap.ME = FALSE, bin.output.ME = TRUE,
  kfolds.ME = 10, n.bg.ME = 10000, env.ME = NULL, metric.ME = "ROC",
  clamp.ME = T)
 | 
data | 
 BIOMOD.formated.data object returned by BIOMOD_FormatingData  | 
models | 
 vector of models names choosen among 'GLM', 'GBM', 'GAM', 'CTA', 'ANN', 'FDA', 'MARS', 'RF' and 'MAXENT.Phillips'  | 
models.options | 
 BIOMOD.models.options object returned by BIOMOD_ModelingOptions. Default: BIOMOD_ModelingOptions()  | 
method.ANN | 
 which classification or regression model to use for artificial neural networks (default: "avNNet"). see http://topepo.github.io/caret/Neural_Network.html  | 
method.RF | 
 which classification or regression model to use for randomForest (default: "rf"). see http://topepo.github.io/caret/Random_Forest.html  | 
method.MARS | 
 which classification or regression model to use for mars (default: "earth"). see http://topepo.github.io/caret/Multivariate_Adaptive_Regression_Splines.html  | 
method.GAM | 
 which classification or regression model to use for GAM (default: "gam"). see http://topepo.github.io/caret/Generalized_Additive_Model.html  | 
method.GLM | 
 which classification or regression model to use for GLM: (default: 'glmStepAIC'). see http://topepo.github.io/caret/Generalized_Linear_Model.html  | 
trControl | 
 global control parameters for runing (default trainControl(method="cv",summaryFunction=twoClassSummary,classProbs=T),returnData = FALSE). for details see trainControl  | 
metric | 
 metric to select the optimal model (Default ROC). TSS (maximizing Sensitivity and Specificity) is also possible. see ?train  | 
ctrl.CTA | 
 specify control parameters only for CTA (default trControl)  | 
ctrl.RF | 
 specify control parameters only for RF (default trControl)  | 
ctrl.ANN | 
 specify control parameters only for ANN (default trControl)  | 
ctrl.MARS | 
 specify control parameters only for MARS (default trControl)  | 
ctrl.FDA | 
 specify control parameters only for FDA (default trControl)  | 
ctrl.GAM | 
 specify control parameters only for GAM (default trControl)  | 
ctrl.GBM | 
 specify control parameters only for GBM (default trControl)  | 
ctrl.GLM | 
 specify control parameters only for GLM (default trControl)  | 
tuneLength | 
 see ?train (default 30)  | 
decay.tune.ANN | 
 weight decay parameters used for tuning for ANN (default: c(0.001, 0.01, 0.05, 0.1)) Will be optimised by method specified in ctrl.ANN (if not available trControl).  | 
size.tune.ANN | 
 size parameters (number of units in the hidden layer) for ANN used for tuning (default: c(2,4,6,8)). Will be optimised using the method specified in ctrl.ANN (if not available trControl).  | 
maxit.ANN | 
 maximum number of iterations for ANN (default 500)  | 
MaxNWts.ANN | 
 The maximum allowable number of weights for ANN (default 10 * (ncol(myBiomodData'at'data.env.var) + 1) + 10 + 1).  | 
type.GLM | 
 either 'simple', 'quadratic', 'polynomial' or 's_smoother' defining the type of formula you want to build with GLM  | 
cvmethod.ME | 
 method used for data partitioning for MAXENT.Phillips (default: 'randomkfold')  | 
overlap.ME | 
 logical; Calculates pairwise metric of niche overlap if TRUE (Default: FALSE). (see ?calc.niche.overlap)  | 
bin.output.ME | 
 logical; If TRUE, appends evaluations metrics for each evaluation bin to results table (i.e., in addition to the average values across bins).  | 
kfolds.ME | 
 number of bins to use for k-fold cross-validation used for MAXENT.Phillips (Default: 10).  | 
n.bg.ME | 
 Number of Background points used to run MAXENT.Phillips (Default: 10000)  | 
env.ME | 
 RasterStack of model predictor variables  | 
metric.ME | 
 metric to select the optimal model for Maxent (Default: ROC). One out of Mean.AUC (or ROC), delta.AICc, Mean.AUC.DIFF. see ?ENMevaluate  | 
clamp.ME | 
 logical; If TRUE (Default) "Features are constrained to remain within the range of values in the training data" (Elith et al. 2011)  | 
Tuning ANN: if no parameters are specified for ANN, they are tuned internally in BIOMOD_Modelling using cross-validation. ANN parameters are therefore tuned in every case either within ecospat.BIOMOD.tunning or BIOMOD_Modelling
BIOMOD.models.options object with optimized parameters
Frank Breiner
BIOMOD_ModelingOptions(), train
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63  | ## Not run: 
# species occurrences
DataSpecies <- read.csv(system.file("external/species/mammals_table.csv",
                                    package="biomod2"))
head(DataSpecies)
# the name of studied species
myRespName <- 'GuloGulo'
# the presence/absences data for our species 
myResp <- as.numeric(DataSpecies[,myRespName])
# the XY coordinates of species data
myRespXY <- DataSpecies[,c("X_WGS84","Y_WGS84")]
# Environmental variables extracted from BIOCLIM (bio_3, bio_4, bio_7, bio_11 & bio_12)
myExpl = stack( system.file( "external/bioclim/current/bio3.grd", 
                             package="biomod2"),
                system.file( "external/bioclim/current/bio4.grd", 
                             package="biomod2"), 
                system.file( "external/bioclim/current/bio7.grd", 
                             package="biomod2"),  
                system.file( "external/bioclim/current/bio11.grd", 
                             package="biomod2"), 
                system.file( "external/bioclim/current/bio12.grd", 
                             package="biomod2"))
# 1. Formatting Data
myBiomodData <- BIOMOD_FormatingData(resp.var = myResp,
                                     expl.var = myExpl,
                                     resp.xy = myRespXY,
                                     resp.name = myRespName)
# 2. Defining Models Options using default options.
### 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
#library(doParallel);cl<-makeCluster(8);registerDoParallel(cl) 
time.seq<-system.time(Biomod.tuning <- BIOMOD_tuning(myBiomodData,
                                                             env.ME = myExpl,
                                                             n.bg.ME = ncell(myExpl)))
#stopCluster(cl)
myBiomodModelOut <- BIOMOD_Modeling( myBiomodData, 
                                     models = c('RF','CTA'), 
                                     models.options = Biomod.tuning$models.options, 
                                     NbRunEval=1, 
                                     DataSplit=100, 
                                     VarImport=0, 
                                     models.eval.meth = c('ROC'),
                                     do.full.models=FALSE,
                                     modeling.id="test")
#  eval.plot(Biomod.tuning$tune.MAXENT.Phillips at results)
par(mfrow=c(1,3))
plot(Biomod.tuning$tune.CTA.rpart)
plot(Biomod.tuning$tune.CTA.rpart2)
plot(Biomod.tuning$tune.RF)
## End(Not run)
 | 
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.