Save DMatrix to an XGBoost buffer. Saved binary can be later loaded by providing the path to :py:func:`xgboost.DMatrix` as input. Parameters ---------- fname : string or os.PathLike Name of the output buffer file. silent : bool (optional; default
(self, fname: PathLike, silent: bool = True)
| 975 | dispatch_meta_backend(self, data, field, "uint32") |
| 976 | |
| 977 | def save_binary(self, fname: PathLike, silent: bool = True) -> None: |
| 978 | """Save DMatrix to an XGBoost buffer. Saved binary can be later loaded |
| 979 | by providing the path to :py:func:`xgboost.DMatrix` as input. |
| 980 | |
| 981 | Parameters |
| 982 | ---------- |
| 983 | fname : string or os.PathLike |
| 984 | Name of the output buffer file. |
| 985 | silent : bool (optional; default: True) |
| 986 | If set, the output is suppressed. |
| 987 | """ |
| 988 | fname = os.fspath(os.path.expanduser(fname)) |
| 989 | _check_call( |
| 990 | _LIB.XGDMatrixSaveBinary(self.handle, c_str(fname), ctypes.c_int(silent)) |
| 991 | ) |
| 992 | |
| 993 | def set_label(self, label: ArrayLike) -> None: |
| 994 | """Set label of dmatrix |