add auto_class_weights into python-package frontend
@@ -1025,8 +1025,8 @@ def _process_synonyms(params):
if 'scale_pos_weight' in params:
if 'loss_function' in params and params['loss_function'] != 'Logloss':
raise CatBoostError('scale_pos_weight is supported only for binary classification Logloss loss')
- if 'class_weights' in params:
- raise CatBoostError('only one of the parameters scale_pos_weight, class_weights should be initialized.')
+ if 'class_weights' in params or 'auto_class_weights' in params:
+ raise CatBoostError('only one of the parameters scale_pos_weight, class_weights, auto_class_weights should be initialized.')
params['class_weights'] = [1.0, params['scale_pos_weight']]
del params['scale_pos_weight']
@@ -3674,6 +3674,10 @@ class CatBoostClassifier(CatBoost):
text_processing : dict,
Text processging description.
+
+ auto_class_weights : bool [default=False]
+ Enables automatic class weights calculation as follows:
+ weight = max_class_count / class_count, statistics determined from train pool
"""
def __init__(
self,
@@ -3784,7 +3788,8 @@ class CatBoostClassifier(CatBoost):
tokenizers=None,
dictionaries=None,
feature_calcers=None,
- text_processing=None
+ text_processing=None,
+ auto_class_weights=None
):
params = {}
not_params = ["not_params", "self", "params", "__class__"]
