This function prepares cross-validated Hmsc models for fitting using HPC. It handles data preparation, model initialization, and generation of SLURM commands.
Usage
Mod_CV_Fit(
Path_Model = NULL,
CVName = c("CV_Dist", "CV_Large"),
Partitions = NULL,
EnvFile = ".env",
InitPar = NULL,
JobName = "CV_Models",
Updater = list(Gamma2 = FALSE, GammaEta = FALSE),
AlignPost = TRUE,
ToJSON = FALSE,
PrepSLURM = TRUE,
MemPerCpu = NULL,
Time = NULL,
Path_Hmsc = NULL,
Precision = 64,
...
)
Arguments
- Path_Model
Character. Path to a saved model file (
*.qs2
).- CVName
Character vector. Column name(s) in the model input data to be used to cross-validate the models (see Mod_PrepData and Mod_GetCV). The function allows the possibility of using more than one way of assigning grid cells into cross-validation folders. If multiple names are provided, separate cross-validation models will be fitted for each cross-validation type. Currently, there are three cross-validation strategies:
CV_SAC
,CV_Dist
, andCV_Large
. Defaults toc("CV_Dist", "CV_Large")
.- Partitions
A vector for cross-validation created by Hmsc::createPartition or similar. Defaults to
NULL
, which means to use column name(s) provided in theCVName
argument. If thePartitions
vector is provided, the label used in the output files will beCV_Custom
.- EnvFile
Character. Path to the environment file containing paths to data sources. Defaults to
.env
.- InitPar
a named list of parameter values used for initialization of MCMC states. See Hmsc::computePredictedValues for more information. Default:
NULL
.- JobName
Character. Name of the submitted job(s) for SLURM. Default:
CV_Models
.- Updater
named
list
. Which conditional updaters should be omitted? See Hmsc::computePredictedValues for more information. Defaults tolist(Gamma2 = FALSE, GammaEta = FALSE)
to disable the following warnings:setting updater$Gamma2=FALSE due to specified phylogeny matrix
andsetting updater$GammaEta=FALSE: not implemented for spatial methods 'GPP' and 'NNGP'
.- AlignPost
Logical. Whether the posterior of each chains should be aligned. See Hmsc::computePredictedValues for more information. Default:
TRUE
.- ToJSON
Logical. Whether to convert unfitted models to JSON before saving to RDS file. Default:
FALSE
.- PrepSLURM
Logical. Whether to prepare SLURM command files. If
TRUE
(default), the SLURM commands will be saved to disk using the Mod_SLURM function.- MemPerCpu
Character. Memory allocation per CPU core. Example: "32G" for 32 gigabytes. Required — if not provided, the function throws an error.
- Time
Character. Maximum allowed runtime for the job. Example: "01:00:00" for one hour. Required — if not provided, the function throws an error.
- Path_Hmsc
Character. Path to the Hmsc-HPC installation.
- Precision
Integer (either 32 or 64). Defines the floating-point precision mode for
Hmsc-HPC
sampling (–fp 32 or –fp 64). The default is 64, which is the default precision inHmsc-HPC
.- ...
Additional arguments passed to the Mod_SLURM function.
Details
The function copies part of the Hmsc::computePredictedValues function, which currently does not support performing cross-validation using Hmsc-HPC.