@@ -249,8 +249,20 @@ def inner(y_score: np.ndarray, dmatrix: DMatrix) -> Tuple[str, float]:
249
249
A threshold for deciding whether XGBoost should use one-hot encoding based split
250
250
for categorical data. When number of categories is lesser than the threshold
251
251
then one-hot encoding is chosen, otherwise the categories will be partitioned
252
- into children nodes. Only relevant for regression and binary classification.
253
- See :doc:`Categorical Data </tutorials/categorical>` for details.
252
+ into children nodes. Also, `enable_categorical` needs to be set to have
253
+ categorical feature support. See :doc:`Categorical Data
254
+ </tutorials/categorical>` and :ref:`cat-param` for details.
255
+
256
+ max_cat_threshold : Optional[int]
257
+
258
+ .. versionadded:: 1.7.0
259
+
260
+ .. note:: This parameter is experimental
261
+
262
+ Maximum number of categories considered for each split. Used only by
263
+ partition-based splits for preventing over-fitting. Also, `enable_categorical`
264
+ needs to be set to have categorical feature support. See :doc:`Categorical Data
265
+ </tutorials/categorical>` and :ref:`cat-param` for details.
254
266
255
267
eval_metric : Optional[Union[str, List[str], Callable]]
256
268
@@ -562,6 +574,7 @@ def __init__(
562
574
enable_categorical : bool = False ,
563
575
feature_types : FeatureTypes = None ,
564
576
max_cat_to_onehot : Optional [int ] = None ,
577
+ max_cat_threshold : Optional [int ] = None ,
565
578
eval_metric : Optional [Union [str , List [str ], Callable ]] = None ,
566
579
early_stopping_rounds : Optional [int ] = None ,
567
580
callbacks : Optional [List [TrainingCallback ]] = None ,
@@ -607,6 +620,7 @@ def __init__(
607
620
self .enable_categorical = enable_categorical
608
621
self .feature_types = feature_types
609
622
self .max_cat_to_onehot = max_cat_to_onehot
623
+ self .max_cat_threshold = max_cat_threshold
610
624
self .eval_metric = eval_metric
611
625
self .early_stopping_rounds = early_stopping_rounds
612
626
self .callbacks = callbacks
0 commit comments