From e8884c4637da1439614ed48e06a2dee98548be3d Mon Sep 17 00:00:00 2001 From: Jiaming Yuan Date: Thu, 29 Oct 2020 04:42:13 +0800 Subject: [PATCH] Document tree method for feature weights. (#6312) --- doc/parameter.rst | 7 ++++--- python-package/xgboost/sklearn.py | 14 ++++++++------ 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/doc/parameter.rst b/doc/parameter.rst index e6ea145c1..d1398f920 100644 --- a/doc/parameter.rst +++ b/doc/parameter.rst @@ -108,9 +108,10 @@ Parameters for Tree Booster 'colsample_bynode':0.5}`` with 64 features will leave 8 features to choose from at each split. - On Python interface, one can set the ``feature_weights`` for DMatrix to define the - probability of each feature being selected when using column sampling. There's a - similar parameter for ``fit`` method in sklearn interface. + On Python interface, when using ``hist``, ``gpu_hist`` or ``exact`` tree method, one + can set the ``feature_weights`` for DMatrix to define the probability of each feature + being selected when using column sampling. There's a similar parameter for ``fit`` + method in sklearn interface. * ``lambda`` [default=1, alias: ``reg_lambda``] diff --git a/python-package/xgboost/sklearn.py b/python-package/xgboost/sklearn.py index db6295c5f..b199ff2d6 100644 --- a/python-package/xgboost/sklearn.py +++ b/python-package/xgboost/sklearn.py @@ -499,9 +499,10 @@ class XGBModel(XGBModelBase): A list of the form [L_1, L_2, ..., L_n], where each L_i is a list of instance weights on the i-th validation set. feature_weights: array_like - Weight for each feature, defines the probability of each feature - being selected when colsample is being used. All values must be - greater than 0, otherwise a `ValueError` is thrown. + Weight for each feature, defines the probability of each feature being + selected when colsample is being used. All values must be greater than 0, + otherwise a `ValueError` is thrown. Only available for `hist`, `gpu_hist` and + `exact` tree methods. callbacks : list of callback functions List of callback functions that are applied at end of each iteration. It is possible to use predefined callbacks by using :ref:`callback_api`. @@ -1237,9 +1238,10 @@ class XGBRanker(XGBModel): file name of stored XGBoost model or 'Booster' instance XGBoost model to be loaded before training (allows training continuation). feature_weights: array_like - Weight for each feature, defines the probability of each feature - being selected when colsample is being used. All values must be - greater than 0, otherwise a `ValueError` is thrown. + Weight for each feature, defines the probability of each feature being + selected when colsample is being used. All values must be greater than 0, + otherwise a `ValueError` is thrown. Only available for `hist`, `gpu_hist` and + `exact` tree methods. callbacks : list of callback functions List of callback functions that are applied at end of each iteration. It is possible to use predefined callbacks by using