Can't use raster::predict function with dbart model object

Hi,

I am running two machine-learning models using caret and dbarts packages to train SVM and BART respectively. The goal is to apply these models spatially and produce a raster prediction of a continuous target variable.

The code below was used to train the BART model using parsnip:
bt_reg <-
set_mode("regression") %>%
set_engine("dbarts")

bt_reg <-
parsnip::bart() %>%
set_engine("dbarts") %>%
set_mode("regression")
set.seed(7)
bt_reg_fit <- bt_reg %>% fit(Y ~ X1+X2,
data = train_split)

I've been trying to predict a raster in R using BART and SVM models. raster::predict(rasterstack, SVM_model) work fine. But when I try to predict with BART model using raster::predict(rasterstack, BART_model), I get an error:

Error in rep_len(object$sigma, n.obs * length(object$sigma)) :
invalid 'length.out' value
In addition: Warning messages:
1: In n.obs * length(object$sigma) : NAs produced by integer overflow
2: In n.obs * length(object$sigma) : NAs produced by integer overflow

Any help would be appreciated.
Thank you

Sincerely

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.