From c90119eb67f09d3f722c428f08d1cde6359b635b Mon Sep 17 00:00:00 2001 From: Jiaming Yuan Date: Tue, 14 Apr 2020 16:25:20 +0800 Subject: [PATCH] Update Python doc. [skip ci] (#5517) * Update doc for copying booster. [skip ci] The issue is resolved in #5312 . * Add version for new APIs. [skip ci] --- python-package/xgboost/core.py | 23 ++++++++++++++++------- python-package/xgboost/dask.py | 8 ++++++++ 2 files changed, 24 insertions(+), 7 deletions(-) diff --git a/python-package/xgboost/core.py b/python-package/xgboost/core.py index 688904ce1f34..5d78ab036d0f 100644 --- a/python-package/xgboost/core.py +++ b/python-package/xgboost/core.py @@ -1048,6 +1048,9 @@ class DeviceQuantileDMatrix(DMatrix): quantisation. You can construct DeviceQuantileDMatrix from cupy/cudf/dlpack. + + .. versionadded:: 1.1.0 + """ def __init__(self, data, label=None, weight=None, base_margin=None, @@ -1197,7 +1200,10 @@ def __setstate__(self, state): def save_config(self): '''Output internal parameter configuration of Booster as a JSON - string.''' + string. + + .. versionadded:: 1.0.0 + ''' json_string = ctypes.c_char_p() length = c_bst_ulong() _check_call(_LIB.XGBoosterSaveJsonConfig( @@ -1208,7 +1214,10 @@ def save_config(self): return json_string def load_config(self, config): - '''Load configuration returned by `save_config`.''' + '''Load configuration returned by `save_config`. + + .. versionadded:: 1.0.0 + ''' assert isinstance(config, str) _check_call(_LIB.XGBoosterLoadJsonConfig( self.handle, @@ -1218,11 +1227,7 @@ def __copy__(self): return self.__deepcopy__(None) def __deepcopy__(self, _): - '''Return a copy of booster. Caches for DMatrix are not copied so continue - training on copied booster will result in lower performance and - slightly different result. - - ''' + '''Return a copy of booster.''' return Booster(model_file=self) def copy(self): @@ -1517,6 +1522,8 @@ def predict(self, Whether the prediction value is used for training. This can effect `dart` booster, which performs dropouts during training iterations. + .. versionadded:: 1.0.0 + .. note:: Using ``predict()`` with DART booster If the booster object is DART type, ``predict()`` will not perform @@ -1601,6 +1608,8 @@ def inplace_predict(self, data, iteration_range=(0, 0), booster.set_param({'predictor': 'cpu_predictor}) booster.inplace_predict(numpy_array) + .. versionadded:: 1.1.0 + Parameters ---------- data : numpy.ndarray/scipy.sparse.csr_matrix/cupy.ndarray/ diff --git a/python-package/xgboost/dask.py b/python-package/xgboost/dask.py index fa20605c3a18..6d05be5d54dc 100644 --- a/python-package/xgboost/dask.py +++ b/python-package/xgboost/dask.py @@ -126,6 +126,8 @@ class DaskDMatrix: the input data explicitly if you want to see actual computation of constructing `DaskDMatrix`. + .. versionadded:: 1.0.0 + Parameters ---------- client: dask.distributed.Client @@ -368,6 +370,8 @@ def _get_rabit_args(worker_map, client): def train(client, params, dtrain, *args, evals=(), **kwargs): '''Train XGBoost model. + .. versionadded:: 1.0.0 + Parameters ---------- client: dask.distributed.Client @@ -459,6 +463,8 @@ def predict(client, model, data, *args, missing=numpy.nan): Only default prediction mode is supported right now. + .. versionadded:: 1.0.0 + Parameters ---------- client: dask.distributed.Client @@ -582,6 +588,8 @@ def inplace_predict(client, model, data, missing=numpy.nan): '''Inplace prediction. + .. versionadded:: 1.1.0 + Parameters ---------- client: dask.distributed.Client