hmsc-r / hmsc-hpc

13 stars 4 forks source link

Error in cross validation: missing value where TRUE/FALSE needed #14

Open niming2 opened 4 months ago

niming2 commented 4 months ago

Hello,

I used the HMSC-hpc fit the model and then try cross validation: preds = computePredictedValues (hM =fitSepTF, nParallel = nChains, partition = single_partition)

But I always get an error: ### Cross-validation, fold 1 out of 5 setting updater$GammaEta=FALSE due to absence of random effects included to the model Error in checkForRemoteErrors(val) : 4 nodes produced errors; first error: missing value where TRUE/FALSE needed

Do you have any idea what happens here?

Thanks, Ming

gtikhonov commented 3 months ago

This issue is quite cryptic for me. But currently the computePredictedValues(...) method with behaviour set to execute CV with multiple folds does not use the posterior of the model. Thus, it is expected to be ignorant to whether the model was fitted with Hmsc-HPC or whether it was fitted at all. Have you tried the CV with unfitted model?

niming2 commented 1 month ago

@gtikhonov Thanks for your response! I am a little confused that CV doesn't use the posterior model - in the function computePredictedValues (), hM requires to to a 'a fitted Hmsc model object'. When I try the unfitted model, it gives the erro: Error in postList[[i]] : subscript out of bounds