[R] Implement new save raw in R. (#7571)

This commit is contained in:
Jiaming Yuan
2022-01-22 20:55:47 +08:00
committed by GitHub
parent ef4dae4c0e
commit d262503781
7 changed files with 90 additions and 24 deletions

View File

@@ -63,7 +63,7 @@ print(paste("sum(abs(pred2-pred))=", sum(abs(pred2 - pred))))
# save model to R's raw vector
raw <- xgb.save.raw(bst)
# load binary model to R
bst3 <- xgb.load(raw)
bst3 <- xgb.load.raw(raw)
pred3 <- predict(bst3, test$data)
# pred3 should be identical to pred
print(paste("sum(abs(pred3-pred))=", sum(abs(pred3 - pred))))