Unverified Commit ecbb0e99 authored by James Lamb's avatar James Lamb Committed by GitHub
Browse files

[python] fix dangerous default for eval_at in LGBMRanker (#3377)



* [python] fix dangerous default for eval_at in LGBMRanker

* use a tuple

* five

* Update python-package/lightgbm/sklearn.py
Co-authored-by: default avatarNikita Titov <nekit94-08@mail.ru>
Co-authored-by: default avatarNikita Titov <nekit94-08@mail.ru>
parent c600e844
...@@ -945,7 +945,7 @@ class LGBMRanker(LGBMModel): ...@@ -945,7 +945,7 @@ class LGBMRanker(LGBMModel):
sample_weight=None, init_score=None, group=None, sample_weight=None, init_score=None, group=None,
eval_set=None, eval_names=None, eval_sample_weight=None, eval_set=None, eval_names=None, eval_sample_weight=None,
eval_init_score=None, eval_group=None, eval_metric=None, eval_init_score=None, eval_group=None, eval_metric=None,
eval_at=[1, 2, 3, 4, 5], early_stopping_rounds=None, verbose=True, eval_at=(1, 2, 3, 4, 5), early_stopping_rounds=None, verbose=True,
feature_name='auto', categorical_feature='auto', feature_name='auto', categorical_feature='auto',
callbacks=None, init_model=None): callbacks=None, init_model=None):
"""Docstring is inherited from the LGBMModel.""" """Docstring is inherited from the LGBMModel."""
...@@ -984,6 +984,6 @@ class LGBMRanker(LGBMModel): ...@@ -984,6 +984,6 @@ class LGBMRanker(LGBMModel):
_base_doc = fit.__doc__ _base_doc = fit.__doc__
_before_early_stop, _early_stop, _after_early_stop = _base_doc.partition('early_stopping_rounds :') _before_early_stop, _early_stop, _after_early_stop = _base_doc.partition('early_stopping_rounds :')
fit.__doc__ = (_before_early_stop fit.__doc__ = (_before_early_stop
+ 'eval_at : list of int, optional (default=[1, 2, 3, 4, 5])\n' + 'eval_at : iterable of int, optional (default=(1, 2, 3, 4, 5))\n'
+ ' ' * 12 + 'The evaluation positions of the specified metric.\n' + ' ' * 12 + 'The evaluation positions of the specified metric.\n'
+ ' ' * 8 + _early_stop + _after_early_stop) + ' ' * 8 + _early_stop + _after_early_stop)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment