[doc] update doc for dumping model to be json or ubj for jvm packages (#7955)

This commit is contained in:
Bobby Wang
2022-05-31 14:43:13 +08:00
committed by GitHub
parent 80339c3427
commit 5a7dc41351
2 changed files with 17 additions and 0 deletions

View File

@@ -44,6 +44,7 @@ with normal model IO operation. Currently, memory snapshot is used in the follow
* Python package: when the ``Booster`` object is pickled with the built-in ``pickle`` module.
* R package: when the ``xgb.Booster`` object is persisted with the built-in functions ``saveRDS``
or ``save``.
* JVM packages: when the ``Booster`` object is serialized with the built-in functions ``saveModel``.
Other language bindings are still working in progress.
@@ -68,6 +69,12 @@ a filename with ``.json`` or ``.ubj`` as file extension, the latter is the exten
xgb.save(bst, 'model_file_name.json')
.. code-block:: Scala
:caption: Scala
val format = "json" // or val format = "ubj"
model.write.option("format", format).save("model_directory_path")
.. note::
Only load models from JSON files that were produced by XGBoost. Attempting to load