You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, I built an SL model and saved it to disk. However, it contains a BART learner, so I get this error when trying to do anything with it:
Error in check_serialization(object) :
This bartMachine object was loaded from an R image but was not serialized.
Please build bartMachine using the option "serialize = TRUE" next time.
What would be the best way to fix this? Is there a way to pass options to individual commands via SuperLearner?
The text was updated successfully, but these errors were encountered:
Hi, you might need to modify the SL.bartMachine wrapper to add the serialize = TRUE argument and retrain the SL model. Here is an example new wrapper (and then use SL.mybartMachine in the SL.library):
SL.mybartMachine <- function(Y, X, newX, family, obsWeights, id, num_trees = 50,
num_burn_in = 250, verbose = FALSE, alpha = 0.95, beta = 2, k = 2,
q = 0.9, nu = 3, num_iterations_after_burn_in = 1000, ...)
{
require("bartMachine")
model = bartMachine::bartMachine(X = X,
y = Y,
num_trees = num_trees,
num_burn_in = num_burn_in,
verbose = verbose,
alpha = alpha,
beta = beta,
k = k,
q = q,
nu = nu,
num_iterations_after_burn_in = num_iterations_after_burn_in,
serialize = TRUE)
pred <- predict(model, newX)
fit <- list(object = model)
class(fit) <- c("SL.bartMachine")
out <- list(pred = pred, fit = fit)
return(out)
}
Hi, I built an SL model and saved it to disk. However, it contains a BART learner, so I get this error when trying to do anything with it:
What would be the best way to fix this? Is there a way to pass options to individual commands via SuperLearner?
The text was updated successfully, but these errors were encountered: