0

I am writing the following script:

#options(java.parameters = "-Xmx50000m")
library(bartMachine)
library(tidyverse)

data <- data.frame(x=rnorm(100, 5, 2), 
                   z=rnorm(100, 1, 0.5), 
                   y=as.factor(rep(c("a", "b"), 100)))

model <-  bartMachine(X= data[,c("x", "z")],
                           y= data$y, seed = 999,
                           serialize = T)

test <- data.frame(x=rnorm(1000, 5, 2.5), 
                   z=rnorm(1000, 1, 0.7))

pred <- predict(model, test)

On my real world example, I get the following message when calling predict:

Error in validObject(.Object) : invalid class “jobjRef” object: invalid object for slot "jobj" in class "jobjRef": got class "NULL", should be or extend class "externalptr"

Has anyone seen this error before? I haven't been able to find much online. Apologies for not being able to replicate the issue.

@Sean posted about a similar error message.

UseR10085
  • 7,120
  • 3
  • 24
  • 54
EML
  • 615
  • 4
  • 14
  • I am not getting this error. I am using `R version 4.2.3 (2023-03-15 ucrt) Platform: x86_64-w64-mingw32/x64 (64-bit) Running under: Windows 10 x64 (build 19044) [1] bartMachine_1.3.3.1 missForest_1.5 randomForest_4.7-1.1 bartMachineJARs_1.2.1 [5] rJava_1.0-6`. What is your R and bartMachine version? – UseR10085 May 04 '23 at 03:41
  • `R version 4.2.1 (2022-06-23) Platform: x86_64-apple-darwin17.0 (64-bit) Running under: macOS Catalina 10.15.7` – EML May 04 '23 at 13:22

1 Answers1

0

Increasing memory allocation resolved the issue:

options(java.parameters = "-Xmx500000m")
EML
  • 615
  • 4
  • 14