Post-processing of fitted models in the IASDT
workflow
involves multiple steps, utilising both CPU and GPU computations to
optimize performance and manage memory constraints effectively.
Step 1: CPU
The mod_postprocess_1_CPU()
function
begins the post-processing phase for each habitat type by automating the
following tasks:
mod_SLURM_refit()
checks for unsuccessful model fits.
mod_merge_chains()
merges MCMC chains and saves the fitted model and coda objects to
.qs2
or .RData
files.
convergence_plot_all()
visualises the convergence of rho
, alpha
,
omega
, and beta
parameters across all model
variants. This function is particularly useful for comparing convergence
across models with different thinning values, with and without
phylogenetic relationships, or varying GPP knot distances. It is
unnecessary when only a single model variant is considered.
convergence_plot()
displays the convergence of rho
, alpha
,
omega
, and beta
parameters for a selected
model, providing a more detailed view compared to
convergence_plot_all()
.
plot_gelman()
visualises the Gelman-Rubin-Brooks diagnostics for the selected model.
mod_summary()
extracts and saves a summary of the model.
mod_heatmap_beta()
generates heatmaps of the beta
parameters.
mod_heatmap_omega()
generates heatmaps of the omega
parameter, which represents
residual species associations.
mod_CV_fit()
prepares the necessary data for fitting cross-validated models.
output files are saved in the Model_Fitting_CV
subdirectory.
the type of cross-validation strategy is controlled by the
CV_name
argument, which defaults to both
CV_Dist
and CV_Large
.
unfitted model objects are saved in the Model_Init
subdirectory.
commands for model fitting are saved as text files, with a separate file
for each cross-validation strategy (e.g.,
Commands2Fit_CV_Dist.txt
,
Commands2Fit_CV_Large.txt
).
model fitting commands are submitted as batch jobs using SLURM scripts,
with a separate script for each strategy (e.g.,
CV_Bash_Fit_Dist.slurm
,
CV_Bash_Fit_Large.slurm
).
Computationally intensive tasks offloaded to GPU
Previous attempts to prepare response curve data, predict at new
sites, and compute variance partitioning using R on CPUs (such as the
UFZ Windows server and LUMI HPC) were limited by memory constraints. As
a result, these tasks are now offloaded to GPU-based computations using
Python
and TensorFlow
. The
mod_postprocess_1_CPU()
function calls the following
sub-functions to generate the necessary commands for GPU execution:
Preparing commands for GPU computations
Predicting latent factors:
Predictions of latent factors for response curves and new sampling
units are performed using a TensorFlow
script located at
inst/crossprod_solve.py .
For these tasks, the corresponding R functions export multiple
.qs2
and .feather
data files to the
TEMP_Pred subdirectory, which are essential for GPU
computations. Additionally, they generate execution commands saved as
LF_RC_Commands_.txt (for response curves) and
LF_NewSites_Commands_.txt (for new sites).
»» Example LF_RC_Commands.txt file
python3 crossprod_solve.py --s1 RC_c_s1.feather --s2 RC_c_s2.feather --post_eta RC_c_postEta_ch001.feather --path_out RC_c_etaPred_ch001.feather --denom 1200000 --chunk_size 1000 --threshold_mb 2000 --solve_chunk_size 50 --verbose >> RC_c_etaPred_ch001.log 2>&1
python3 crossprod_solve.py --s1 RC_c_s1.feather --s2 RC_c_s2.feather --post_eta RC_c_postEta_ch002.feather --path_out RC_c_etaPred_ch002.feather --denom 1188081 --chunk_size 1000 --threshold_mb 2000 --solve_chunk_size 50 --verbose >> RC_c_etaPred_ch002.log 2>&1
python3 crossprod_solve.py --s1 RC_c_s1.feather --s2 RC_c_s2.feather --post_eta RC_c_postEta_ch003.feather --path_out RC_c_etaPred_ch003.feather --denom 1176162 --chunk_size 1000 --threshold_mb 2000 --solve_chunk_size 50 --verbose >> RC_c_etaPred_ch003.log 2>&1
python3 crossprod_solve.py --s1 RC_c_s1.feather --s2 RC_c_s2.feather --post_eta RC_c_postEta_ch004.feather --path_out RC_c_etaPred_ch004.feather --denom 1164242 --chunk_size 1000 --threshold_mb 2000 --solve_chunk_size 50 --verbose >> RC_c_etaPred_ch004.log 2>&1
python3 crossprod_solve.py --s1 RC_c_s1.feather --s2 RC_c_s2.feather --post_eta RC_c_postEta_ch005.feather --path_out RC_c_etaPred_ch005.feather --denom 1200000 --chunk_size 1000 --threshold_mb 2000 --solve_chunk_size 50 --verbose >> RC_c_etaPred_ch005.log 2>&1
python3 crossprod_solve.py --s1 RC_c_s1.feather --s2 RC_c_s2.feather --post_eta RC_c_postEta_ch006.feather --path_out RC_c_etaPred_ch006.feather --denom 413333 --chunk_size 1000 --threshold_mb 2000 --solve_chunk_size 50 --verbose >> RC_c_etaPred_ch006.log 2>&1
python3 crossprod_solve.py --s1 RC_c_s1.feather --s2 RC_c_s2.feather --post_eta RC_c_postEta_ch007.feather --path_out RC_c_etaPred_ch007.feather --denom 1188081 --chunk_size 1000 --threshold_mb 2000 --solve_chunk_size 50 --verbose >> RC_c_etaPred_ch007.log 2>&1
python3 crossprod_solve.py --s1 RC_c_s1.feather --s2 RC_c_s2.feather --post_eta RC_c_postEta_ch008.feather --path_out RC_c_etaPred_ch008.feather --denom 425253 --chunk_size 1000 --threshold_mb 2000 --solve_chunk_size 50 --verbose >> RC_c_etaPred_ch008.log 2>&1
python3 crossprod_solve.py --s1 RC_c_s1.feather --s2 RC_c_s2.feather --post_eta RC_c_postEta_ch009.feather --path_out RC_c_etaPred_ch009.feather --denom 1176162 --chunk_size 1000 --threshold_mb 2000 --solve_chunk_size 50 --verbose >> RC_c_etaPred_ch009.log 2>&1
python3 crossprod_solve.py --s1 RC_c_s1.feather --s2 RC_c_s2.feather --post_eta RC_c_postEta_ch010.feather --path_out RC_c_etaPred_ch010.feather --denom 437172 --chunk_size 1000 --threshold_mb 2000 --solve_chunk_size 50 --verbose >> RC_c_etaPred_ch010.log 2>&1
python3 crossprod_solve.py --s1 RC_c_s1.feather --s2 RC_c_s2.feather --post_eta RC_c_postEta_ch011.feather --path_out RC_c_etaPred_ch011.feather --denom 1200000 --chunk_size 1000 --threshold_mb 2000 --solve_chunk_size 50 --verbose >> RC_c_etaPred_ch011.log 2>&1
python3 crossprod_solve.py --s1 RC_c_s1.feather --s2 RC_c_s2.feather --post_eta RC_c_postEta_ch012.feather --path_out RC_c_etaPred_ch012.feather --denom 401414 --chunk_size 1000 --threshold_mb 2000 --solve_chunk_size 50 --verbose >> RC_c_etaPred_ch012.log 2>&1
python3 crossprod_solve.py --s1 RC_c_s1.feather --s2 RC_c_s2.feather --post_eta RC_c_postEta_ch013.feather --path_out RC_c_etaPred_ch013.feather --denom 1164242 --chunk_size 1000 --threshold_mb 2000 --solve_chunk_size 50 --verbose >> RC_c_etaPred_ch013.log 2>&1
python3 crossprod_solve.py --s1 RC_c_s1.feather --s2 RC_c_s2.feather --post_eta RC_c_postEta_ch014.feather --path_out RC_c_etaPred_ch014.feather --denom 449091 --chunk_size 1000 --threshold_mb 2000 --solve_chunk_size 50 --verbose >> RC_c_etaPred_ch014.log 2>&1
python3 crossprod_solve.py --s1 RC_c_s1.feather --s2 RC_c_s2.feather --post_eta RC_c_postEta_ch015.feather --path_out RC_c_etaPred_ch015.feather --denom 1152323 --chunk_size 1000 --threshold_mb 2000 --solve_chunk_size 50 --verbose >> RC_c_etaPred_ch015.log 2>&1
»» Example LF_NewSites_Commands.txt file
python3 crossprod_solve.py --s1 LF_3_Test_s1.feather --s2 LF_3_Test_s2.feather --post_eta LF_3_Test_postEta_ch001.feather --path_out LF_3_Test_etaPred_ch001.feather --denom 225758 --chunk_size 1000 --threshold_mb 2000 --solve_chunk_size 50 --verbose >> LF_3_Test_etaPred_ch001.log 2>&1
python3 crossprod_solve.py --s1 LF_3_Test_s1.feather --s2 LF_3_Test_s2.feather --post_eta LF_3_Test_postEta_ch002.feather --path_out LF_3_Test_etaPred_ch002.feather --denom 211111 --chunk_size 1000 --threshold_mb 2000 --solve_chunk_size 50 --verbose >> LF_3_Test_etaPred_ch002.log 2>&1
python3 crossprod_solve.py --s1 LF_3_Test_s1.feather --s2 LF_3_Test_s2.feather --post_eta LF_3_Test_postEta_ch003.feather --path_out LF_3_Test_etaPred_ch003.feather --denom 240404 --chunk_size 1000 --threshold_mb 2000 --solve_chunk_size 50 --verbose >> LF_3_Test_etaPred_ch003.log 2>&1
python3 crossprod_solve.py --s1 LF_3_Test_s1.feather --s2 LF_3_Test_s2.feather --post_eta LF_3_Test_postEta_ch004.feather --path_out LF_3_Test_etaPred_ch004.feather --denom 196465 --chunk_size 1000 --threshold_mb 2000 --solve_chunk_size 50 --verbose >> LF_3_Test_etaPred_ch004.log 2>&1
python3 crossprod_solve.py --s1 LF_3_Test_s1.feather --s2 LF_3_Test_s2.feather --post_eta LF_3_Test_postEta_ch005.feather --path_out LF_3_Test_etaPred_ch005.feather --denom 196465 --chunk_size 1000 --threshold_mb 2000 --solve_chunk_size 50 --verbose >> LF_3_Test_etaPred_ch005.log 2>&1
python3 crossprod_solve.py --s1 LF_3_Test_s1.feather --s2 LF_3_Test_s2.feather --post_eta LF_3_Test_postEta_ch006.feather --path_out LF_3_Test_etaPred_ch006.feather --denom 211111 --chunk_size 1000 --threshold_mb 2000 --solve_chunk_size 50 --verbose >> LF_3_Test_etaPred_ch006.log 2>&1
python3 crossprod_solve.py --s1 LF_3_Test_s1.feather --s2 LF_3_Test_s2.feather --post_eta LF_3_Test_postEta_ch007.feather --path_out LF_3_Test_etaPred_ch007.feather --denom 225758 --chunk_size 1000 --threshold_mb 2000 --solve_chunk_size 50 --verbose >> LF_3_Test_etaPred_ch007.log 2>&1
python3 crossprod_solve.py --s1 LF_3_Test_s1.feather --s2 LF_3_Test_s2.feather --post_eta LF_3_Test_postEta_ch008.feather --path_out LF_3_Test_etaPred_ch008.feather --denom 181818 --chunk_size 1000 --threshold_mb 2000 --solve_chunk_size 50 --verbose >> LF_3_Test_etaPred_ch008.log 2>&1
python3 crossprod_solve.py --s1 LF_3_Test_s1.feather --s2 LF_3_Test_s2.feather --post_eta LF_3_Test_postEta_ch009.feather --path_out LF_3_Test_etaPred_ch009.feather --denom 255051 --chunk_size 1000 --threshold_mb 2000 --solve_chunk_size 50 --verbose >> LF_3_Test_etaPred_ch009.log 2>&1
python3 crossprod_solve.py --s1 LF_3_Test_s1.feather --s2 LF_3_Test_s2.feather --post_eta LF_3_Test_postEta_ch010.feather --path_out LF_3_Test_etaPred_ch010.feather --denom 240404 --chunk_size 1000 --threshold_mb 2000 --solve_chunk_size 50 --verbose >> LF_3_Test_etaPred_ch010.log 2>&1
python3 crossprod_solve.py --s1 LF_3_Test_s1.feather --s2 LF_3_Test_s2.feather --post_eta LF_3_Test_postEta_ch011.feather --path_out LF_3_Test_etaPred_ch011.feather --denom 167172 --chunk_size 1000 --threshold_mb 2000 --solve_chunk_size 50 --verbose >> LF_3_Test_etaPred_ch011.log 2>&1
python3 crossprod_solve.py --s1 LF_3_Test_s1.feather --s2 LF_3_Test_s2.feather --post_eta LF_3_Test_postEta_ch012.feather --path_out LF_3_Test_etaPred_ch012.feather --denom 269697 --chunk_size 1000 --threshold_mb 2000 --solve_chunk_size 50 --verbose >> LF_3_Test_etaPred_ch012.log 2>&1
python3 crossprod_solve.py --s1 LF_3_Test_s1.feather --s2 LF_3_Test_s2.feather --post_eta LF_3_Test_postEta_ch013.feather --path_out LF_3_Test_etaPred_ch013.feather --denom 255051 --chunk_size 1000 --threshold_mb 2000 --solve_chunk_size 50 --verbose >> LF_3_Test_etaPred_ch013.log 2>&1
python3 crossprod_solve.py --s1 LF_3_Test_s1.feather --s2 LF_3_Test_s2.feather --post_eta LF_3_Test_postEta_ch014.feather --path_out LF_3_Test_etaPred_ch014.feather --denom 269697 --chunk_size 1000 --threshold_mb 2000 --solve_chunk_size 50 --verbose >> LF_3_Test_etaPred_ch014.log 2>&1
python3 crossprod_solve.py --s1 LF_3_Test_s1.feather --s2 LF_3_Test_s2.feather --post_eta LF_3_Test_postEta_ch015.feather --path_out LF_3_Test_etaPred_ch015.feather --denom 181818 --chunk_size 1000 --threshold_mb 2000 --solve_chunk_size 50 --verbose >> LF_3_Test_etaPred_ch015.log 2>&1
Response curves
Predicting at new sites
predict_maps()
sets up GPU computations for predictions
at new sites when both LF_only = TRUE
and
LF_commands_only = TRUE
.
Computing variance partitioning:
Combining commands for GPU computations
Once mod_postprocess_1_CPU()
has been executed for all
habitat types, the mod_prepare_TF()
function consolidates the batch scripts for GPU computations across all
habitat types:
It aggregates the script files that contain commands for response
curves and latent factor predictions, splitting them into multiple
scripts (TF_Chunk_*.txt ) for batch processing. Additionally, it
generates a SLURM script (LF_SLURM.slurm ) for executing the
latent factor predictions.
»» Example TF_Chunk_*.txt file
#!/bin/bash
# Load TensorFlow module and configure environment
ml use /appl/local/csc/modulefiles
ml tensorflow
export TF_CPP_MIN_LOG_LEVEL=3
export TF_ENABLE_ONEDNN_OPTS=0
# Verify GPU availability
python3 -c "import tensorflow as tf; print(\"Num GPUs Available:\", len(tf.config.list_physical_devices(\"GPU\")))"
# 20 commands to be executed:
python3 crossprod_solve.py --s1 'datasets/processed/model_fitting/Mod_Riv_Hab1/TEMP_Pred/LF_1_Test_s1.feather' --s2 'datasets/processed/model_fitting/Mod_Riv_Hab1/TEMP_Pred/LF_1_Test_s2.feather' --post_eta 'datasets/processed/model_fitting/Mod_Riv_Hab1/TEMP_Pred/LF_1_Test_postEta_ch001.feather' --path_out 'datasets/processed/model_fitting/Mod_Riv_Hab1/TEMP_Pred/LF_1_Test_etaPred_ch001.feather' --denom 50000 --chunk_size 1000 --threshold_mb 2000 --solve_chunk_size 50 --verbose >> datasets/processed/model_fitting/Mod_Riv_Hab1/TEMP_Pred/LF_1_Test_etaPred_ch001.log 2>&1
python3 crossprod_solve.py --s1 'datasets/processed/model_fitting/Mod_Riv_Hab1/TEMP_Pred/LF_1_Test_s1.feather' --s2 'datasets/processed/model_fitting/Mod_Riv_Hab1/TEMP_Pred/LF_1_Test_s2.feather' --post_eta 'datasets/processed/model_fitting/Mod_Riv_Hab1/TEMP_Pred/LF_1_Test_postEta_ch002.feather' --path_out 'datasets/processed/model_fitting/Mod_Riv_Hab1/TEMP_Pred/LF_1_Test_etaPred_ch002.feather' --denom 1470707 --chunk_size 1000 --threshold_mb 2000 --solve_chunk_size 50 --verbose >> datasets/processed/model_fitting/Mod_Riv_Hab1/TEMP_Pred/LF_1_Test_etaPred_ch002.log 2>&1
python3 crossprod_solve.py --s1 'datasets/processed/model_fitting/Mod_Riv_Hab1/TEMP_Pred/LF_1_Test_s1.feather' --s2 'datasets/processed/model_fitting/Mod_Riv_Hab1/TEMP_Pred/LF_1_Test_s2.feather' --post_eta 'datasets/processed/model_fitting/Mod_Riv_Hab1/TEMP_Pred/LF_1_Test_postEta_ch003.feather' --path_out 'datasets/processed/model_fitting/Mod_Riv_Hab1/TEMP_Pred/LF_1_Test_etaPred_ch003.feather' --denom 1485354 --chunk_size 1000 --threshold_mb 2000 --solve_chunk_size 50 --verbose >> datasets/processed/model_fitting/Mod_Riv_Hab1/TEMP_Pred/LF_1_Test_etaPred_ch003.log 2>&1
python3 crossprod_solve.py --s1 'datasets/processed/model_fitting/Mod_Riv_Hab1/TEMP_Pred/LF_1_Test_s1.feather' --s2 'datasets/processed/model_fitting/Mod_Riv_Hab1/TEMP_Pred/LF_1_Test_s2.feather' --post_eta 'datasets/processed/model_fitting/Mod_Riv_Hab1/TEMP_Pred/LF_1_Test_postEta_ch004.feather' --path_out 'datasets/processed/model_fitting/Mod_Riv_Hab1/TEMP_Pred/LF_1_Test_etaPred_ch004.feather' --denom 1456061 --chunk_size 1000 --threshold_mb 2000 --solve_chunk_size 50 --verbose >> datasets/processed/model_fitting/Mod_Riv_Hab1/TEMP_Pred/LF_1_Test_etaPred_ch004.log 2>&1
python3 crossprod_solve.py --s1 'datasets/processed/model_fitting/Mod_Riv_Hab1/TEMP_Pred/LF_1_Test_s1.feather' --s2 'datasets/processed/model_fitting/Mod_Riv_Hab1/TEMP_Pred/LF_1_Test_s2.feather' --post_eta 'datasets/processed/model_fitting/Mod_Riv_Hab1/TEMP_Pred/LF_1_Test_postEta_ch005.feather' --path_out 'datasets/processed/model_fitting/Mod_Riv_Hab1/TEMP_Pred/LF_1_Test_etaPred_ch005.feather' --denom 1500000 --chunk_size 1000 --threshold_mb 2000 --solve_chunk_size 50 --verbose >> datasets/processed/model_fitting/Mod_Riv_Hab1/TEMP_Pred/LF_1_Test_etaPred_ch005.log 2>&1
python3 crossprod_solve.py --s1 'datasets/processed/model_fitting/Mod_Riv_Hab1/TEMP_Pred/LF_1_Test_s1.feather' --s2 'datasets/processed/model_fitting/Mod_Riv_Hab1/TEMP_Pred/LF_1_Test_s2.feather' --post_eta 'datasets/processed/model_fitting/Mod_Riv_Hab1/TEMP_Pred/LF_1_Test_postEta_ch006.feather' --path_out 'datasets/processed/model_fitting/Mod_Riv_Hab1/TEMP_Pred/LF_1_Test_etaPred_ch006.feather' --denom 1500000 --chunk_size 1000 --threshold_mb 2000 --solve_chunk_size 50 --verbose >> datasets/processed/model_fitting/Mod_Riv_Hab1/TEMP_Pred/LF_1_Test_etaPred_ch006.log 2>&1
python3 crossprod_solve.py --s1 'datasets/processed/model_fitting/Mod_Riv_Hab1/TEMP_Pred/LF_1_Test_s1.feather' --s2 'datasets/processed/model_fitting/Mod_Riv_Hab1/TEMP_Pred/LF_1_Test_s2.feather' --post_eta 'datasets/processed/model_fitting/Mod_Riv_Hab1/TEMP_Pred/LF_1_Test_postEta_ch007.feather' --path_out 'datasets/processed/model_fitting/Mod_Riv_Hab1/TEMP_Pred/LF_1_Test_etaPred_ch007.feather' --denom 1426768 --chunk_size 1000 --threshold_mb 2000 --solve_chunk_size 50 --verbose >> datasets/processed/model_fitting/Mod_Riv_Hab1/TEMP_Pred/LF_1_Test_etaPred_ch007.log 2>&1
python3 crossprod_solve.py --s1 'datasets/processed/model_fitting/Mod_Riv_Hab1/TEMP_Pred/LF_1_Test_s1.feather' --s2 'datasets/processed/model_fitting/Mod_Riv_Hab1/TEMP_Pred/LF_1_Test_s2.feather' --post_eta 'datasets/processed/model_fitting/Mod_Riv_Hab1/TEMP_Pred/LF_1_Test_postEta_ch008.feather' --path_out 'datasets/processed/model_fitting/Mod_Riv_Hab1/TEMP_Pred/LF_1_Test_etaPred_ch008.feather' --denom 1470707 --chunk_size 1000 --threshold_mb 2000 --solve_chunk_size 50 --verbose >> datasets/processed/model_fitting/Mod_Riv_Hab1/TEMP_Pred/LF_1_Test_etaPred_ch008.log 2>&1
python3 crossprod_solve.py --s1 'datasets/processed/model_fitting/Mod_Riv_Hab1/TEMP_Pred/LF_1_Test_s1.feather' --s2 'datasets/processed/model_fitting/Mod_Riv_Hab1/TEMP_Pred/LF_1_Test_s2.feather' --post_eta 'datasets/processed/model_fitting/Mod_Riv_Hab1/TEMP_Pred/LF_1_Test_postEta_ch009.feather' --path_out 'datasets/processed/model_fitting/Mod_Riv_Hab1/TEMP_Pred/LF_1_Test_etaPred_ch009.feather' --denom 1485354 --chunk_size 1000 --threshold_mb 2000 --solve_chunk_size 50 --verbose >> datasets/processed/model_fitting/Mod_Riv_Hab1/TEMP_Pred/LF_1_Test_etaPred_ch009.log 2>&1
python3 crossprod_solve.py --s1 'datasets/processed/model_fitting/Mod_Riv_Hab1/TEMP_Pred/LF_1_Test_s1.feather' --s2 'datasets/processed/model_fitting/Mod_Riv_Hab1/TEMP_Pred/LF_1_Test_s2.feather' --post_eta 'datasets/processed/model_fitting/Mod_Riv_Hab1/TEMP_Pred/LF_1_Test_postEta_ch010.feather' --path_out 'datasets/processed/model_fitting/Mod_Riv_Hab1/TEMP_Pred/LF_1_Test_etaPred_ch010.feather' --denom 1456061 --chunk_size 1000 --threshold_mb 2000 --solve_chunk_size 50 --verbose >> datasets/processed/model_fitting/Mod_Riv_Hab1/TEMP_Pred/LF_1_Test_etaPred_ch010.log 2>&1
python3 crossprod_solve.py --s1 'datasets/processed/model_fitting/Mod_Riv_Hab1/TEMP_Pred/LF_1_Test_s1.feather' --s2 'datasets/processed/model_fitting/Mod_Riv_Hab1/TEMP_Pred/LF_1_Test_s2.feather' --post_eta 'datasets/processed/model_fitting/Mod_Riv_Hab1/TEMP_Pred/LF_1_Test_postEta_ch011.feather' --path_out 'datasets/processed/model_fitting/Mod_Riv_Hab1/TEMP_Pred/LF_1_Test_etaPred_ch011.feather' --denom 1470707 --chunk_size 1000 --threshold_mb 2000 --solve_chunk_size 50 --verbose >> datasets/processed/model_fitting/Mod_Riv_Hab1/TEMP_Pred/LF_1_Test_etaPred_ch011.log 2>&1
python3 crossprod_solve.py --s1 'datasets/processed/model_fitting/Mod_Riv_Hab1/TEMP_Pred/LF_1_Test_s1.feather' --s2 'datasets/processed/model_fitting/Mod_Riv_Hab1/TEMP_Pred/LF_1_Test_s2.feather' --post_eta 'datasets/processed/model_fitting/Mod_Riv_Hab1/TEMP_Pred/LF_1_Test_postEta_ch012.feather' --path_out 'datasets/processed/model_fitting/Mod_Riv_Hab1/TEMP_Pred/LF_1_Test_etaPred_ch012.feather' --denom 1412121 --chunk_size 1000 --threshold_mb 2000 --solve_chunk_size 50 --verbose >> datasets/processed/model_fitting/Mod_Riv_Hab1/TEMP_Pred/LF_1_Test_etaPred_ch012.log 2>&1
python3 crossprod_solve.py --s1 'datasets/processed/model_fitting/Mod_Riv_Hab1/TEMP_Pred/LF_1_Test_s1.feather' --s2 'datasets/processed/model_fitting/Mod_Riv_Hab1/TEMP_Pred/LF_1_Test_s2.feather' --post_eta 'datasets/processed/model_fitting/Mod_Riv_Hab1/TEMP_Pred/LF_1_Test_postEta_ch013.feather' --path_out 'datasets/processed/model_fitting/Mod_Riv_Hab1/TEMP_Pred/LF_1_Test_etaPred_ch013.feather' --denom 1426768 --chunk_size 1000 --threshold_mb 2000 --solve_chunk_size 50 --verbose >> datasets/processed/model_fitting/Mod_Riv_Hab1/TEMP_Pred/LF_1_Test_etaPred_ch013.log 2>&1
python3 crossprod_solve.py --s1 'datasets/processed/model_fitting/Mod_Riv_Hab1/TEMP_Pred/LF_1_Test_s1.feather' --s2 'datasets/processed/model_fitting/Mod_Riv_Hab1/TEMP_Pred/LF_1_Test_s2.feather' --post_eta 'datasets/processed/model_fitting/Mod_Riv_Hab1/TEMP_Pred/LF_1_Test_postEta_ch014.feather' --path_out 'datasets/processed/model_fitting/Mod_Riv_Hab1/TEMP_Pred/LF_1_Test_etaPred_ch014.feather' --denom 1426768 --chunk_size 1000 --threshold_mb 2000 --solve_chunk_size 50 --verbose >> datasets/processed/model_fitting/Mod_Riv_Hab1/TEMP_Pred/LF_1_Test_etaPred_ch014.log 2>&1
python3 crossprod_solve.py --s1 'datasets/processed/model_fitting/Mod_Riv_Hab1/TEMP_Pred/LF_1_Test_s1.feather' --s2 'datasets/processed/model_fitting/Mod_Riv_Hab1/TEMP_Pred/LF_1_Test_s2.feather' --post_eta 'datasets/processed/model_fitting/Mod_Riv_Hab1/TEMP_Pred/LF_1_Test_postEta_ch015.feather' --path_out 'datasets/processed/model_fitting/Mod_Riv_Hab1/TEMP_Pred/LF_1_Test_etaPred_ch015.feather' --denom 1441414 --chunk_size 1000 --threshold_mb 2000 --solve_chunk_size 50 --verbose >> datasets/processed/model_fitting/Mod_Riv_Hab1/TEMP_Pred/LF_1_Test_etaPred_ch015.log 2>&1
python3 crossprod_solve.py --s1 'datasets/processed/model_fitting/Mod_Riv_Hab1/TEMP_Pred/LF_1_Test_s1.feather' --s2 'datasets/processed/model_fitting/Mod_Riv_Hab1/TEMP_Pred/LF_1_Test_s2.feather' --post_eta 'datasets/processed/model_fitting/Mod_Riv_Hab1/TEMP_Pred/LF_1_Test_postEta_ch016.feather' --path_out 'datasets/processed/model_fitting/Mod_Riv_Hab1/TEMP_Pred/LF_1_Test_etaPred_ch016.feather' --denom 1456061 --chunk_size 1000 --threshold_mb 2000 --solve_chunk_size 50 --verbose >> datasets/processed/model_fitting/Mod_Riv_Hab1/TEMP_Pred/LF_1_Test_etaPred_ch016.log 2>&1
python3 crossprod_solve.py --s1 'datasets/processed/model_fitting/Mod_Riv_Hab1/TEMP_Pred/LF_1_Test_s1.feather' --s2 'datasets/processed/model_fitting/Mod_Riv_Hab1/TEMP_Pred/LF_1_Test_s2.feather' --post_eta 'datasets/processed/model_fitting/Mod_Riv_Hab1/TEMP_Pred/LF_1_Test_postEta_ch017.feather' --path_out 'datasets/processed/model_fitting/Mod_Riv_Hab1/TEMP_Pred/LF_1_Test_etaPred_ch017.feather' --denom 1441414 --chunk_size 1000 --threshold_mb 2000 --solve_chunk_size 50 --verbose >> datasets/processed/model_fitting/Mod_Riv_Hab1/TEMP_Pred/LF_1_Test_etaPred_ch017.log 2>&1
python3 crossprod_solve.py --s1 'datasets/processed/model_fitting/Mod_Riv_Hab1/TEMP_Pred/LF_1_Test_s1.feather' --s2 'datasets/processed/model_fitting/Mod_Riv_Hab1/TEMP_Pred/LF_1_Test_s2.feather' --post_eta 'datasets/processed/model_fitting/Mod_Riv_Hab1/TEMP_Pred/LF_1_Test_postEta_ch018.feather' --path_out 'datasets/processed/model_fitting/Mod_Riv_Hab1/TEMP_Pred/LF_1_Test_etaPred_ch018.feather' --denom 1382828 --chunk_size 1000 --threshold_mb 2000 --solve_chunk_size 50 --verbose >> datasets/processed/model_fitting/Mod_Riv_Hab1/TEMP_Pred/LF_1_Test_etaPred_ch018.log 2>&1
python3 crossprod_solve.py --s1 'datasets/processed/model_fitting/Mod_Riv_Hab1/TEMP_Pred/LF_1_Test_s1.feather' --s2 'datasets/processed/model_fitting/Mod_Riv_Hab1/TEMP_Pred/LF_1_Test_s2.feather' --post_eta 'datasets/processed/model_fitting/Mod_Riv_Hab1/TEMP_Pred/LF_1_Test_postEta_ch019.feather' --path_out 'datasets/processed/model_fitting/Mod_Riv_Hab1/TEMP_Pred/LF_1_Test_etaPred_ch019.feather' --denom 1485354 --chunk_size 1000 --threshold_mb 2000 --solve_chunk_size 50 --verbose >> datasets/processed/model_fitting/Mod_Riv_Hab1/TEMP_Pred/LF_1_Test_etaPred_ch019.log 2>&1
python3 crossprod_solve.py --s1 'datasets/processed/model_fitting/Mod_Riv_Hab1/TEMP_Pred/LF_1_Test_s1.feather' --s2 'datasets/processed/model_fitting/Mod_Riv_Hab1/TEMP_Pred/LF_1_Test_s2.feather' --post_eta 'datasets/processed/model_fitting/Mod_Riv_Hab1/TEMP_Pred/LF_1_Test_postEta_ch020.feather' --path_out 'datasets/processed/model_fitting/Mod_Riv_Hab1/TEMP_Pred/LF_1_Test_etaPred_ch020.feather' --denom 1368182 --chunk_size 1000 --threshold_mb 2000 --solve_chunk_size 50 --verbose >> datasets/processed/model_fitting/Mod_Riv_Hab1/TEMP_Pred/LF_1_Test_etaPred_ch020.log 2>&1
»» Example LF_SLURM.slurm file
#!/bin/bash
#SBATCH --job-name=PP_LF
#SBATCH --ntasks=1
#SBATCH --ntasks-per-node=1
#SBATCH --account=project_465001588
#SBATCH --cpus-per-task=1
#SBATCH --gpus-per-node=1
#SBATCH --time=01:00:00
#SBATCH --partition=small-g
#SBATCH --output=datasets/processed/model_fitting/TMP/%x-%A-%a.out
#SBATCH --error=datasets/processed/model_fitting/TMP/%x-%A-%a.out
#SBATCH --array=1-186
# Define directories
OutputDir="datasets/processed/model_fitting/TF_BatchFiles"
# Find all the split files and sort them explicitly
SplitFiles=($(find "$OutputDir" -type f -name "TF_Chunk_*.txt" | sort -V))
# Check if files were found
if [ ${#SplitFiles[@]} -eq 0 ]; then
echo "Error: No files matching TF_Chunk_*.txt found in $OutputDir"
exit 1
fi
# Ensure no more than `, NumFiles, ` files are processed
MaxFiles=186
if [ ${#SplitFiles[@]} -gt $MaxFiles ]; then
SplitFiles=("${SplitFiles[@]:0:$MaxFiles}")
echo "More than $MaxFiles files found, limiting to the first $MaxFiles files."
fi
# Get the index of the current task based on SLURM_ARRAY_TASK_ID
TaskIndex=$((SLURM_ARRAY_TASK_ID - 1))
# Validate TaskIndex
if [ $TaskIndex -ge ${#SplitFiles[@]} ] || [ $TaskIndex -lt 0 ]; then
echo "Error: TaskIndex $TaskIndex is out of range. Valid range: 0 to $((${#SplitFiles[@]} - 1))"
exit 1
fi
# Get the specific split file to process based on the job array task ID
SplitFile="${SplitFiles[$TaskIndex]}"
# Verify the selected split file
if [ -z "$SplitFile" ] || [ ! -f "$SplitFile" ]; then
echo "Error: File $SplitFile does not exist or is invalid."
exit 1
fi
# Processing file
echo "Processing file: $SplitFile"
# Run the selected split file
bash "$SplitFile"
echo End of program at `date`
It combines the variance partitioning command files into a single
VP_Commands.txt file and prepares a SLURM script
(VP_SLURM.slurm ) for the variance partitioning
computations.
»» Example VP_Commands.txt file
python3 VP_gemu.py --tr datasets/processed/model_fitting/Mod_Q_Hab1/TEMP_VP/VP_Tr.feather --gamma datasets/processed/model_fitting/Mod_Q_Hab1/TEMP_VP/VP_Gamma.feather --output datasets/processed/model_fitting/Mod_Q_Hab1/TEMP_VP/VP_Mu.feather --ncores 3 --chunk_size 50 >> datasets/processed/model_fitting/Mod_Q_Hab1/TEMP_VP/VP_Mu.log 2>&1
python3 VP_gemu.py --tr datasets/processed/model_fitting/Mod_Q_Hab2/TEMP_VP/VP_Tr.feather --gamma datasets/processed/model_fitting/Mod_Q_Hab2/TEMP_VP/VP_Gamma.feather --output datasets/processed/model_fitting/Mod_Q_Hab2/TEMP_VP/VP_Mu.feather --ncores 3 --chunk_size 50 >> datasets/processed/model_fitting/Mod_Q_Hab2/TEMP_VP/VP_Mu.log 2>&1
python3 VP_gemu.py --tr datasets/processed/model_fitting/Mod_Q_Hab3/TEMP_VP/VP_Tr.feather --gamma datasets/processed/model_fitting/Mod_Q_Hab3/TEMP_VP/VP_Gamma.feather --output datasets/processed/model_fitting/Mod_Q_Hab3/TEMP_VP/VP_Mu.feather --ncores 3 --chunk_size 50 >> datasets/processed/model_fitting/Mod_Q_Hab3/TEMP_VP/VP_Mu.log 2>&1
python3 VP_gemu.py --tr datasets/processed/model_fitting/Mod_Q_Hab4a/TEMP_VP/VP_Tr.feather --gamma datasets/processed/model_fitting/Mod_Q_Hab4a/TEMP_VP/VP_Gamma.feather --output datasets/processed/model_fitting/Mod_Q_Hab4a/TEMP_VP/VP_Mu.feather --ncores 3 --chunk_size 50 >> datasets/processed/model_fitting/Mod_Q_Hab4a/TEMP_VP/VP_Mu.log 2>&1
python3 VP_gemu.py --tr datasets/processed/model_fitting/Mod_Q_Hab4b/TEMP_VP/VP_Tr.feather --gamma datasets/processed/model_fitting/Mod_Q_Hab4b/TEMP_VP/VP_Gamma.feather --output datasets/processed/model_fitting/Mod_Q_Hab4b/TEMP_VP/VP_Mu.feather --ncores 3 --chunk_size 50 >> datasets/processed/model_fitting/Mod_Q_Hab4b/TEMP_VP/VP_Mu.log 2>&1
python3 VP_gemu.py --tr datasets/processed/model_fitting/Mod_Q_Hab10/TEMP_VP/VP_Tr.feather --gamma datasets/processed/model_fitting/Mod_Q_Hab10/TEMP_VP/VP_Gamma.feather --output datasets/processed/model_fitting/Mod_Q_Hab10/TEMP_VP/VP_Mu.feather --ncores 3 --chunk_size 50 >> datasets/processed/model_fitting/Mod_Q_Hab10/TEMP_VP/VP_Mu.log 2>&1
python3 VP_gemu.py --tr datasets/processed/model_fitting/Mod_Q_Hab12a/TEMP_VP/VP_Tr.feather --gamma datasets/processed/model_fitting/Mod_Q_Hab12a/TEMP_VP/VP_Gamma.feather --output datasets/processed/model_fitting/Mod_Q_Hab12a/TEMP_VP/VP_Mu.feather --ncores 3 --chunk_size 50 >> datasets/processed/model_fitting/Mod_Q_Hab12a/TEMP_VP/VP_Mu.log 2>&1
python3 VP_gemu.py --tr datasets/processed/model_fitting/Mod_Q_Hab12b/TEMP_VP/VP_Tr.feather --gamma datasets/processed/model_fitting/Mod_Q_Hab12b/TEMP_VP/VP_Gamma.feather --output datasets/processed/model_fitting/Mod_Q_Hab12b/TEMP_VP/VP_Mu.feather --ncores 3 --chunk_size 50 >> datasets/processed/model_fitting/Mod_Q_Hab12b/TEMP_VP/VP_Mu.log 2>&1
python3 VP_geta.py --tr datasets/processed/model_fitting/Mod_Q_Hab1/TEMP_VP/VP_Tr.feather --x datasets/processed/model_fitting/Mod_Q_Hab1/TEMP_VP/VP_X.feather --gamma datasets/processed/model_fitting/Mod_Q_Hab1/TEMP_VP/VP_Gamma.feather --output datasets/processed/model_fitting/Mod_Q_Hab1/TEMP_VP/VP_A.feather --ncores 3 --chunk_size 50 >> datasets/processed/model_fitting/Mod_Q_Hab1/TEMP_VP/VP_A.log 2>&1
python3 VP_geta.py --tr datasets/processed/model_fitting/Mod_Q_Hab2/TEMP_VP/VP_Tr.feather --x datasets/processed/model_fitting/Mod_Q_Hab2/TEMP_VP/VP_X.feather --gamma datasets/processed/model_fitting/Mod_Q_Hab2/TEMP_VP/VP_Gamma.feather --output datasets/processed/model_fitting/Mod_Q_Hab2/TEMP_VP/VP_A.feather --ncores 3 --chunk_size 50 >> datasets/processed/model_fitting/Mod_Q_Hab2/TEMP_VP/VP_A.log 2>&1
python3 VP_geta.py --tr datasets/processed/model_fitting/Mod_Q_Hab3/TEMP_VP/VP_Tr.feather --x datasets/processed/model_fitting/Mod_Q_Hab3/TEMP_VP/VP_X.feather --gamma datasets/processed/model_fitting/Mod_Q_Hab3/TEMP_VP/VP_Gamma.feather --output datasets/processed/model_fitting/Mod_Q_Hab3/TEMP_VP/VP_A.feather --ncores 3 --chunk_size 50 >> datasets/processed/model_fitting/Mod_Q_Hab3/TEMP_VP/VP_A.log 2>&1
python3 VP_geta.py --tr datasets/processed/model_fitting/Mod_Q_Hab4a/TEMP_VP/VP_Tr.feather --x datasets/processed/model_fitting/Mod_Q_Hab4a/TEMP_VP/VP_X.feather --gamma datasets/processed/model_fitting/Mod_Q_Hab4a/TEMP_VP/VP_Gamma.feather --output datasets/processed/model_fitting/Mod_Q_Hab4a/TEMP_VP/VP_A.feather --ncores 3 --chunk_size 50 >> datasets/processed/model_fitting/Mod_Q_Hab4a/TEMP_VP/VP_A.log 2>&1
python3 VP_geta.py --tr datasets/processed/model_fitting/Mod_Q_Hab4b/TEMP_VP/VP_Tr.feather --x datasets/processed/model_fitting/Mod_Q_Hab4b/TEMP_VP/VP_X.feather --gamma datasets/processed/model_fitting/Mod_Q_Hab4b/TEMP_VP/VP_Gamma.feather --output datasets/processed/model_fitting/Mod_Q_Hab4b/TEMP_VP/VP_A.feather --ncores 3 --chunk_size 50 >> datasets/processed/model_fitting/Mod_Q_Hab4b/TEMP_VP/VP_A.log 2>&1
python3 VP_geta.py --tr datasets/processed/model_fitting/Mod_Q_Hab10/TEMP_VP/VP_Tr.feather --x datasets/processed/model_fitting/Mod_Q_Hab10/TEMP_VP/VP_X.feather --gamma datasets/processed/model_fitting/Mod_Q_Hab10/TEMP_VP/VP_Gamma.feather --output datasets/processed/model_fitting/Mod_Q_Hab10/TEMP_VP/VP_A.feather --ncores 3 --chunk_size 50 >> datasets/processed/model_fitting/Mod_Q_Hab10/TEMP_VP/VP_A.log 2>&1
python3 VP_geta.py --tr datasets/processed/model_fitting/Mod_Q_Hab12a/TEMP_VP/VP_Tr.feather --x datasets/processed/model_fitting/Mod_Q_Hab12a/TEMP_VP/VP_X.feather --gamma datasets/processed/model_fitting/Mod_Q_Hab12a/TEMP_VP/VP_Gamma.feather --output datasets/processed/model_fitting/Mod_Q_Hab12a/TEMP_VP/VP_A.feather --ncores 3 --chunk_size 50 >> datasets/processed/model_fitting/Mod_Q_Hab12a/TEMP_VP/VP_A.log 2>&1
python3 VP_geta.py --tr datasets/processed/model_fitting/Mod_Q_Hab12b/TEMP_VP/VP_Tr.feather --x datasets/processed/model_fitting/Mod_Q_Hab12b/TEMP_VP/VP_X.feather --gamma datasets/processed/model_fitting/Mod_Q_Hab12b/TEMP_VP/VP_Gamma.feather --output datasets/processed/model_fitting/Mod_Q_Hab12b/TEMP_VP/VP_A.feather --ncores 3 --chunk_size 50 >> datasets/processed/model_fitting/Mod_Q_Hab12b/TEMP_VP/VP_A.log 2>&1
python3 VP_getf.py --x datasets/processed/model_fitting/Mod_Q_Hab1/TEMP_VP/VP_X.feather --beta_dir datasets/processed/model_fitting/Mod_Q_Hab1/TEMP_VP --output datasets/processed/model_fitting/Mod_Q_Hab1/TEMP_VP/VP_F.feather --ncores 3 >> datasets/processed/model_fitting/Mod_Q_Hab1/TEMP_VP/VP_F.log 2>&1
python3 VP_getf.py --x datasets/processed/model_fitting/Mod_Q_Hab2/TEMP_VP/VP_X.feather --beta_dir datasets/processed/model_fitting/Mod_Q_Hab2/TEMP_VP --output datasets/processed/model_fitting/Mod_Q_Hab2/TEMP_VP/VP_F.feather --ncores 3 >> datasets/processed/model_fitting/Mod_Q_Hab2/TEMP_VP/VP_F.log 2>&1
python3 VP_getf.py --x datasets/processed/model_fitting/Mod_Q_Hab3/TEMP_VP/VP_X.feather --beta_dir datasets/processed/model_fitting/Mod_Q_Hab3/TEMP_VP --output datasets/processed/model_fitting/Mod_Q_Hab3/TEMP_VP/VP_F.feather --ncores 3 >> datasets/processed/model_fitting/Mod_Q_Hab3/TEMP_VP/VP_F.log 2>&1
python3 VP_getf.py --x datasets/processed/model_fitting/Mod_Q_Hab4a/TEMP_VP/VP_X.feather --beta_dir datasets/processed/model_fitting/Mod_Q_Hab4a/TEMP_VP --output datasets/processed/model_fitting/Mod_Q_Hab4a/TEMP_VP/VP_F.feather --ncores 3 >> datasets/processed/model_fitting/Mod_Q_Hab4a/TEMP_VP/VP_F.log 2>&1
python3 VP_getf.py --x datasets/processed/model_fitting/Mod_Q_Hab4b/TEMP_VP/VP_X.feather --beta_dir datasets/processed/model_fitting/Mod_Q_Hab4b/TEMP_VP --output datasets/processed/model_fitting/Mod_Q_Hab4b/TEMP_VP/VP_F.feather --ncores 3 >> datasets/processed/model_fitting/Mod_Q_Hab4b/TEMP_VP/VP_F.log 2>&1
python3 VP_getf.py --x datasets/processed/model_fitting/Mod_Q_Hab10/TEMP_VP/VP_X.feather --beta_dir datasets/processed/model_fitting/Mod_Q_Hab10/TEMP_VP --output datasets/processed/model_fitting/Mod_Q_Hab10/TEMP_VP/VP_F.feather --ncores 3 >> datasets/processed/model_fitting/Mod_Q_Hab10/TEMP_VP/VP_F.log 2>&1
python3 VP_getf.py --x datasets/processed/model_fitting/Mod_Q_Hab12a/TEMP_VP/VP_X.feather --beta_dir datasets/processed/model_fitting/Mod_Q_Hab12a/TEMP_VP --output datasets/processed/model_fitting/Mod_Q_Hab12a/TEMP_VP/VP_F.feather --ncores 3 >> datasets/processed/model_fitting/Mod_Q_Hab12a/TEMP_VP/VP_F.log 2>&1
python3 VP_getf.py --x datasets/processed/model_fitting/Mod_Q_Hab12b/TEMP_VP/VP_X.feather --beta_dir datasets/processed/model_fitting/Mod_Q_Hab12b/TEMP_VP --output datasets/processed/model_fitting/Mod_Q_Hab12b/TEMP_VP/VP_F.feather --ncores 3 >> datasets/processed/model_fitting/Mod_Q_Hab12b/TEMP_VP/VP_F.log 2>&1
»» Example VP_SLURM.slurm file
#!/bin/bash
#SBATCH --job-name=VP_TF
#SBATCH --ntasks=1
#SBATCH --ntasks-per-node=1
#SBATCH --account=project_465001588
#SBATCH --cpus-per-task=1
#SBATCH --gpus-per-node=1
#SBATCH --time=01:30:00
#SBATCH --partition=small-g
#SBATCH --output=datasets/processed/model_fitting/Mod_Q_Hab_TF/log/%x-%A-%a.out
#SBATCH --error=datasets/processed/model_fitting/Mod_Q_Hab_TF/log/%x-%A-%a.out
#SBATCH --array=1-24
# File containing commands to be executed
File=datasets/processed/model_fitting/Mod_Q_Hab_TF/VP_Commands.txt
# Load TensorFlow module and configure environment
ml use /appl/local/csc/modulefiles
ml tensorflow
export TF_CPP_MIN_LOG_LEVEL=3
export TF_ENABLE_ONEDNN_OPTS=0
# Verify GPU availability
python3 -c "import tensorflow as tf; print(\"Num GPUs Available:\", len(tf.config.list_physical_devices(\"GPU\")))"
# Run array job
head -n $SLURM_ARRAY_TASK_ID $File | tail -n 1 | bash
echo End of program at `date`
Step 2: GPU
In this step, latent factor predictions and variance partitioning are
computed on GPUs. The batch jobs for these computations can be submitted
using the sbatch
command:
# Submit SLURM jobs for variance partitioning and latent factor predictions
sbatch datasets/processed/model_fitting/Mod_Q_Hab_TF/VP_SLURM.slurm
sbatch datasets/processed/model_fitting/Mod_Q_Hab_TF/LF_SLURM.slurm
Additionally, cross-validated models are fitted by submitting the
corresponding SLURM scripts for each cross-validation strategy:
# Submit SLURM jobs for cross-validated model fitting
#
# cross-validation method "CV_Dist"
sbatch datasets/processed/model_fitting/HabX/Model_Fitting_CV/CV_Bash_Fit_Dist.slurm
# cross-validation method "CV_Large"
sbatch datasets/processed/model_fitting/HabX/Model_Fitting_CV/CV_Bash_Fit_Large.slurm
Step 3: CPU
To continue the post-processing of the fitted models on CPUs, two
functions need to be executed:
1. mod_postprocess_1_CPU()
This function progresses the post-processing pipeline for HMSC models
on the CPU by automating the following tasks:
2. mod_postprocess_CV_1_CPU()
This function begins the post-processing of cross-validated models on
the CPU by automating the following tasks:
mod_merge_chains_CV()
merges fitted cross-validated model chains into Hmsc
model
objects and saves them to disk.
predict_maps_CV()
prepares scripts for predicting latent factors for each cross-validation
strategy at new sampling units (evaluation folds). The arguments
LF_only
and LF_commands_only
are set to
TRUE
to prepare only the necessary script files.
Once predict_maps_CV()
has been completed, the function
combines the computation commands into multiple text script files
(TF_Chunk_*.txt ) in each model’s
Model_Fitting_CV/LF_TF_commands subdirectory. These scripts
need to be executed on GPUs using a single batch job submitted via a
SLURM script in the same directory, LF_SLURM.slurm .
Step 4: GPU
In this step, the computation of latent factors for cross-validated
models is performed on GPUs using SLURM scripts.
sbatch datasets/processed/model_fitting/HabX/Model_Fitting_CV/LF_TF_commands/LF_SLURM.slurm
Step 5: CPU
The final step of the post-processing pipeline is carried out on CPUs
using the mod_postprocess_CV_2_CPU()
function. This
function automates the following tasks:
Predicting habitat suitability at the testing cross-validation folds
using the predict_maps_CV()
function.
Computing the model’s predictive power (using spatially independent
testing data) with the same function, based on four metrics: AUC (area
under the ROC curve); RMSE (root mean square error); continuous Boyce
index; and Tjur R2 .
Plotting the model’s evaluation, including:
Predictive power values for each evaluation metric versus the mean
number of testing presences
Explanatory versus predictive power for each evaluation metric
Previous
articles: ↠1.
Overview ↠2.
Processing abiotic data ↠3.
Processing biotic data ↠4. Model
fitting