This function prepares cross-validated Hmsc models for fitting using HPC. It handles data preparation, model initialisation, and generation of SLURM commands.
Usage
mod_CV_fit(
path_model = NULL,
CV_name = c("CV_Dist", "CV_Large"),
Partitions = NULL,
env_file = ".env",
init_par = NULL,
job_name = "CV_Models",
updater = list(Gamma2 = FALSE, GammaEta = FALSE),
align_posterior = TRUE,
to_JSON = FALSE,
SLURM_prepare = TRUE,
memory_per_cpu = NULL,
job_runtime = NULL,
path_Hmsc = NULL,
precision = 64,
...
)
Arguments
- path_model
Character. Path to a saved model file (
*.qs2
).- CV_name
Character vector. Column name(s) in the model input data to be used to cross-validate the models (see mod_prepare_data and mod_CV_prepare). 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 theCV_name
argument. If thePartitions
vector is provided, the label used in the output files will beCV_Custom
.- env_file
Character. Path to the environment file containing paths to data sources. Defaults to
.env
.- init_par
a named list of parameter values used for initialisation of MCMC states. See Hmsc::computePredictedValues for more information. Default:
NULL
.- job_name
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'
.- align_posterior
Logical. Whether the posterior of each chains should be aligned. See Hmsc::computePredictedValues for more information. Default:
TRUE
.- to_JSON
Logical. Whether to convert unfitted models to JSON before saving to RDS file. Default:
FALSE
.- SLURM_prepare
Logical. Whether to prepare SLURM command files. If
TRUE
(default), the SLURM commands will be saved to disk using the mod_SLURM function.- memory_per_cpu
Character. Memory allocation per CPU core. Example: "32G" for 32 gigabytes. Defaults to "64G".
- job_runtime
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.