@@ -2752,7 +2752,9 @@ def save_model(self, fname: PathLike) -> None:
2752
2752
The model is saved in an XGBoost internal format which is universal among the
2753
2753
various XGBoost interfaces. Auxiliary attributes of the Python Booster object
2754
2754
(such as feature_names) are only saved when using JSON or UBJSON (default)
2755
- format. See :doc:`Model IO </tutorials/saving_model>` for more info.
2755
+ format. Also, parameters that are not part of the model (like metrics,
2756
+ `max_depth`, etc) are not saved, see :doc:`Model IO </tutorials/saving_model>`
2757
+ for more info.
2756
2758
2757
2759
.. code-block:: python
2758
2760
@@ -2778,7 +2780,9 @@ def save_raw(self, raw_format: str = "ubj") -> bytearray:
2778
2780
The model is saved in an XGBoost internal format which is universal among the
2779
2781
various XGBoost interfaces. Auxiliary attributes of the Python Booster object
2780
2782
(such as feature_names) are only saved when using JSON or UBJSON (default)
2781
- format. See :doc:`Model IO </tutorials/saving_model>` for more info.
2783
+ format. Also, parameters that are not part of the model (like metrics,
2784
+ `max_depth`, etc) are not saved, see :doc:`Model IO </tutorials/saving_model>`
2785
+ for more info.
2782
2786
2783
2787
Parameters
2784
2788
----------
@@ -2788,6 +2792,7 @@ def save_raw(self, raw_format: str = "ubj") -> bytearray:
2788
2792
Returns
2789
2793
-------
2790
2794
An in memory buffer representation of the model
2795
+
2791
2796
"""
2792
2797
length = c_bst_ulong ()
2793
2798
cptr = ctypes .POINTER (ctypes .c_char )()
@@ -2805,14 +2810,23 @@ def load_model(self, fname: ModelIn) -> None:
2805
2810
The model is saved in an XGBoost internal format which is universal among the
2806
2811
various XGBoost interfaces. Auxiliary attributes of the Python Booster object
2807
2812
(such as feature_names) are only saved when using JSON or UBJSON (default)
2808
- format. See :doc:`Model IO </tutorials/saving_model>` for more info.
2813
+ format. Also, parameters that are not part of the model (like metrics,
2814
+ `max_depth`, etc) are not saved, see :doc:`Model IO </tutorials/saving_model>`
2815
+ for more info.
2809
2816
2810
2817
.. code-block:: python
2811
2818
2819
+ model.save_model("model.json")
2812
2820
model.load_model("model.json")
2821
+
2813
2822
# or
2823
+ model.save_model("model.ubj")
2814
2824
model.load_model("model.ubj")
2815
2825
2826
+ # or
2827
+ buf = model.save_raw()
2828
+ model.load_model(buf)
2829
+
2816
2830
Parameters
2817
2831
----------
2818
2832
fname :
0 commit comments