Skip to content

Commit 5be8083

Browse files
authored
[R] Update serialization docs (#11059)
1 parent 172de1e commit 5be8083

File tree

2 files changed

+18
-16
lines changed

2 files changed

+18
-16
lines changed

R-package/R/utils.R

+9-8
Original file line numberDiff line numberDiff line change
@@ -423,7 +423,7 @@ NULL
423423
#'
424424
#' @description
425425
#' When it comes to serializing XGBoost models, it's possible to use R serializers such as
426-
#' [save()] or [saveRDS()] to serialize an XGBoost R model, but XGBoost also provides
426+
#' [save()] or [saveRDS()] to serialize an XGBoost model object, but XGBoost also provides
427427
#' its own serializers with better compatibility guarantees, which allow loading
428428
#' said models in other language bindings of XGBoost.
429429
#'
@@ -451,23 +451,24 @@ NULL
451451
#' not used for prediction / importance / plotting / etc.
452452
#' These R attributes are only preserved when using R's serializers.
453453
#'
454-
#' In addition to the regular `xgb.Booster` objects producted by [xgb.train()], the
455-
#' function [xgboost()] produces a different subclass `xgboost`, which keeps other
456-
#' additional metadata as R attributes such as class names in classification problems,
457-
#' and which has a dedicated `predict` method that uses different defaults. XGBoost's
454+
#' In addition to the regular `xgb.Booster` objects produced by [xgb.train()], the
455+
#' function [xgboost()] produces objects with a different subclass `xgboost` (which
456+
#' inherits from `xgb.Booster`), which keeps other additional metadata as R attributes
457+
#' such as class names in classification problems, and which has a dedicated `predict`
458+
#' method that uses different defaults and takes different argument names. XGBoost's
458459
#' own serializers can work with this `xgboost` class, but as they do not keep R
459460
#' attributes, the resulting object, when deserialized, is downcasted to the regular
460461
#' `xgb.Booster` class (i.e. it loses the metadata, and the resulting object will use
461-
#' `predict.xgb.Booster` instead of `predict.xgboost`) - for these `xgboost` objects,
462+
#' [predict.xgb.Booster()] instead of [predict.xgboost()]) - for these `xgboost` objects,
462463
#' `saveRDS` might thus be a better option if the extra functionalities are needed.
463464
#'
464465
#' Note that XGBoost models in R starting from version `2.1.0` and onwards, and
465466
#' XGBoost models before version `2.1.0`; have a very different R object structure and
466467
#' are incompatible with each other. Hence, models that were saved with R serializers
467468
#' like [saveRDS()] or [save()] before version `2.1.0` will not work with latter
468469
#' `xgboost` versions and vice versa. Be aware that the structure of R model objects
469-
#' could in theory change again in the future, so XGBoost's serializers
470-
#' should be preferred for long-term storage.
470+
#' could in theory change again in the future, so XGBoost's serializers should be
471+
#' preferred for long-term storage.
471472
#'
472473
#' Furthermore, note that using the package `qs` for serialization will require
473474
#' version 0.26 or higher of said package, and will have the same compatibility

R-package/man/a-compatibility-note-for-saveRDS-save.Rd

+9-8
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)