TheoreticalEcology / s-jSDM

Scalable joint species distribution modeling
https://cran.r-project.org/web/packages/sjSDM/index.html
GNU General Public License v3.0
68 stars 14 forks source link

extrapolating with predict? #150

Open cascadianaturalist opened 1 month ago

cascadianaturalist commented 1 month ago

I have a set of 30 plots of species presence-absence data that have spatial coordinates and i want to extrapolate to the grid the plots are embedded in (255 plots), when i run predict on the new data frame of 255 I get the following warning and do not know how to proceed.

Thanks!

Error in py_call_impl(callable, call_args$unnamed, call_args$named) : IndexError: tuple index out of range Run reticulate::py_last_error() for details. 8. stop(structure(list(message = "IndexError: tuple index out of range\n\033[90mRun \033]8;;rstudio:run:reticulate::py_last_error()\areticulate::py_last_error()\033]8;;\a for details.\033[39m", call = py_call_impl(callable, call_args$unnamed, call_args$named)), class = c("python.builtin.IndexError", "python.builtin.LookupError", "python.builtin.Exception", "python.builtin.BaseException", "python.builtin.object", "error", "condition"), py_object = )) 7. MVP_logLik at dist_mvp.py#155 6. pkg.env$fa$MVP_logLik(cbind(1, Y[, focal]), predictions[, c(K, focal)], reticulate::py_to_r(object$model$get_sigma)[c(K, focal), ], device = object$model$device, individual = TRUE, dtype = object$model$dtype, batch_size = as.integer(object$settings$step_size), ... 5. py_to_r_cpp(x) 4. is_py_object(x <- py_to_r_cpp(x)) 3. reticulate::py_to_r(pkg.env$fa$MVP_logLik(cbind(1, Y[, focal]), predictions[, c(K, focal)], reticulate::py_to_r(object$model$get_sigma)[c(K, focal), ], device = object$model$device, individual = TRUE, dtype = object$model$dtype, batch_size = as.integer(object$settings$step_size), ... 2. predict.sjSDM(model, newdata = NewEnv, SP = NewCoords, Y = NewPA) 1. predict(model, newdata = NewEnv, SP = NewCoords, Y = NewPA)

MaximilianPi commented 1 month ago

Hi @cascadianaturalist,

could you please show your code?