This function modifies the Hmsc:::predict.Hmsc
function.
Usage
Predict_Hmsc(
Path_Model,
Loff = NULL,
XData = NULL,
X = NULL,
XRRRData = NULL,
XRRR = NULL,
Gradient = NULL,
Yc = NULL,
mcmcStep = 1L,
expected = TRUE,
NCores = 8L,
Model_Name = "Train",
Temp_Dir = "TEMP_Pred",
Temp_Cleanup = TRUE,
RC = NULL,
UseTF = TRUE,
TF_Environ = NULL,
TF_use_single = FALSE,
LF_OutFile = NULL,
LF_Return = FALSE,
LF_InputFile = NULL,
LF_Only = FALSE,
LF_NCores = NCores,
LF_Check = FALSE,
LF_Temp_Cleanup = TRUE,
LF_Commands_Only = FALSE,
Pred_Dir = NULL,
Pred_PA = NULL,
Pred_XY = NULL,
Evaluate = FALSE,
Eval_Name = NULL,
Eval_Dir = "Evaluation",
Verbose = TRUE
)
Arguments
- Path_Model
Character. Path to the saved model object.
- Loff
See Hmsc::predict.Hmsc for more details.
- XData
data.frame
. The unpreprocessed covariates for the predictions to be made. Works only if theXFormula
argument was specified in the Hmsc::Hmsc model constructor call. Requirements are similar to those in theHmsc
model constructor.- X
matrix
. Covariates for the predictions to be made. Only one ofXData
andX
arguments may be provided.- XRRRData
data.frame
. Covariates for reduced-rank regression.- XRRR
matrix
. Covariates for reduced-rank regression.- Gradient
An object returned by Hmsc::constructGradient. Providing
Gradient
is an alternative for providingXData
,studyDesign
andranLevels
. Cannot be used together withYc
.- Yc
matrix
. Outcomes that are assumed to be known for conditional predictions. Cannot be used together withGradient
.- mcmcStep
Integer. Number of extra
mcmc
steps used for updating the random effects. Defaults to 1L.- expected
Logical. Whether to return the location parameter of the observation models or sample the values from those. Defaults to
TRUE
.- NCores
Integer. Number of CPU cores to use for parallel processing. Default: 8.
- Model_Name
Character. Prefix for temporary file names. Defaults to
NULL
, in which case no prefix is used.- Temp_Dir
Character. Path for temporary storage of intermediate files.
- Temp_Cleanup
Logical. Whether to clean up temporary files. Defaults to
TRUE
.- RC
Character. Type of predictions to be made. If
NULL
(default), predictions are made for the latent factors. Ifc
, predictions are made for response curves at mean coordinates. Ifi
, predictions are made for response curves at infinite coordinates.- UseTF
Logical. Whether to use TensorFlow for calculations. Defaults to
TRUE
.- TF_Environ
Character. Path to the Python environment. This argument is required if
UseTF
isTRUE
under Windows. Defaults toNULL
.- TF_use_single
Logical. Whether to use single precision for the TensorFlow calculations. Defaults to
FALSE
.- LF_OutFile
Character. Path to save the outputs. If
NULL
(default), the predicted latent factors are not saved to a file. This should end with either*.qs2
or*.RData
.- LF_Return
Logical. Whether the output should be returned. Defaults to
FALSE
. IfLF_OutFile
isNULL
, this parameter cannot be set toFALSE
because the function needs to return the result if it is not saved to a file.- LF_InputFile
Character. File name where the latent factor predictions are saved. If
NULL
(default), latent factor predictions will be computed. If specified, latent factor predictions are read from this path. This allows to predicting the latent factors for new sites only once.- LF_Only
Logical. Whether to return the latent factor predictions only. Defaults to
FALSE
. This helps in predicting to new sites, allowing to predicting the latent factors only once, then the output can be loaded in other predictions when needed.- LF_NCores
Integer. Number of cores to use for parallel processing of latent factor prediction. Defaults to 8L.
- LF_Check
Logical. If
TRUE
, the function checks if the output files are already created and valid. IfFALSE
, the function will only check if the files exist without checking their integrity. Default isFALSE
.- LF_Temp_Cleanup
Logical. Whether to delete temporary files in the
Temp_Dir
directory after finishing the LF predictions.- LF_Commands_Only
Logical. If
TRUE
, returns the command to run the Python script. Default isFALSE
.- Pred_Dir
Character. Directory path indicating where the predictions will be saved. Defaults to
NULL
, which saves model predictions to "Model_Prediction
" folder of the current working directory.- Pred_PA
matrix
. Presence-absence data for evaluation. IfNULL
(default), the presence-absence data from the model object is used. This argument is used only whenEvaluate
isTRUE
.- Pred_XY
matrix
. Coordinates to be added to predicted values. IfNULL
(default), the coordinates from the model object is used.- Evaluate
Logical. Whether to evaluate the model predictions. Defaults to
FALSE
.- Eval_Name
Character. Name of the evaluation results. If
NULL
, the default name is used (Eval_[Model_Name].qs2
).- Eval_Dir
Character. Directory where the evaluation results will be saved. Defaults to
Evaluation
.- Verbose
Logical. Whether to print a message upon successful saving of files. Defaults to
FALSE
.