predImportTrainModels: Train SDMs across multiple iterations of a scenario

View source: R/predImportTrainModels.r

predImportTrainModelsR Documentation

Train SDMs across multiple iterations of a scenario

Description

This function trains species distribution models on simulate data. Typical implementation is to use predImportMakeData to create simulated data sets, then predImportTrainModels to train SDMs on those data sets, then predImportEval to evaluate the models.

Usage

predImportTrainModels(
  simDir,
  modelDir,
  vars,
  algos = c("omniscient", "bioclim", "brt", "gam", "glm", "maxent", "maxnet", "rf"),
  type = c("multivariate", "reduced", "univariate"),
  iters = 1:100,
  numBg = NULL,
  fileFlag = NULL,
  overwrite = FALSE,
  tempDir = raster::rasterOptions()$tmpdir,
  verbose = 1,
  ...
)

Arguments

simDir

Character, path name of directory in which scenario data files are saved.

modelDir

Character, path name of directory in which model files are saved. Depending on whether multivariate, reduced, and/or univariate models are trained, inside this folder will be subfolders named "multivariate", "reduced", and/or "univariate" followed by the name of the algorithm (e.g., "multivariate brt").

vars

Character vector, names of variables to use in model training. These should match the names in the geography argument supplied to the predImportMakeData function. See genesis function for more details on geography.

algos

Character list of model algorithms to implement. Options include omniscient, brt (boosted regression trees), gam (generalized additive models), glm (generalized linear models), maxent (Maxent, using version 3.3.3k or before), maxnet (Maxent, version 3.4 or higher), or rf (random forests).

type

Character, type of models to train. Options include multivariate (use all variables in vars, reduced (a series of models, each using all but one variable in vars), and/or univariate (a series of models, one per variable in vars).

iters

Vector of positive integers, data iterations to train models for.

numBg

Positive integer, vector of positive integers, or NULL. This is the number of background sites used to train the model. If this is NULL (default), then the number of background sites will be equal to the number of sites available in the "sim" object created by predImportMakeData. If this is a single integer, then the background sites used for training will be taken from the first numBg sites available in the "sim" object. If this is a vector, then it must be the same length as algos, and each algorithm will then be presented with the respective number of background sites. If the latter, the vector must have names that match the algorithm(s) being used.

fileFlag

Either NULL or a character string. If a character string then this is included in the simulated data file name and each model file name. If NULL (default), nothing is added, so file names will be as "model XXX.RData". If a character string, then the file name will be as "ALGORITHM FLAG model XXX.RData" where "XXX" is the iteration number, "FLAG" the string in fileFlag, and "ALGORITHM" the model algorithm name.

overwrite

Logical, if TRUE then overwrite existing model results files. Default is FALSE.

tempDir

Character, path of temporary directory. Used to store ancillary modeling files generated by Maxent 3.3.3k and earlier. Not used for any other modeling algorithm. Maxent can generate a lot of these files which eventually fill up a disc. By specifying this folder you can have some control over where they are saved and thus if they fill up a hard drive (e.g., send temp files to a fast secondary drive with lots of space).

verbose

Numeric, if 0 then show minimal output, 1 more output, 2 even more, >2 all of it.

...

Other arguments to pass to "train~~~" functions in the enmSdm package.

Value

Nothing (writes models to disc).

See Also

predImportMakeData, predImportEval


adamlilith/enmSdmPredImport documentation built on Dec. 31, 2022, 5:40 p.m.