# NOT RUN {
library(cuml)
library(xgboost)
model_path <- file.path(tempdir(), "xgboost.model")
model <- xgboost(
data = as.matrix(mtcars[which(names(mtcars) != "mpg")]),
label = as.matrix(mtcars["mpg"]),
max.depth = 6,
eta = 1,
nthread = 2,
nrounds = 20,
objective = "reg:squarederror"
)
xgb.save(model, model_path)
model <- cuml_fil_load_model(
model_path,
mode = "regression",
model_type = "xgboost"
)
preds <- predict(model, mtcars[which(names(mtcars) != "mpg")])
print(preds)
# }
Run the code above in your browser using DataLab