Skip to content

Commit

Permalink
add argument name which is being overwritten in warning message
Browse files Browse the repository at this point in the history
  • Loading branch information
StrikerRUS committed Nov 3, 2021
1 parent 771cb58 commit 2d0392e
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion python-package/lightgbm/sklearn.py
Original file line number Diff line number Diff line change
Expand Up @@ -584,7 +584,7 @@ def fit(self, X, y,
for alias in _ConfigAliases.get('objective'):
if alias in params:
self._objective = params.pop(alias)
_log_warning(f"Found `{alias}` in params. Will use it instead of argument")
_log_warning(f"Found '{alias}' in params. Will use it instead of 'objective' argument")
if self._objective is None:
if isinstance(self, LGBMRegressor):
self._objective = "regression"
Expand Down
2 changes: 1 addition & 1 deletion tests/python_package_test/test_sklearn.py
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ def test_objective_aliases(custom_objective):
for alias in lgb.basic._ConfigAliases.get('objective'):
gbm = lgb.LGBMRegressor(n_estimators=5, **{alias: obj})
if alias != 'objective':
with pytest.warns(UserWarning, match=f"Found `{alias}` in params. Will use it instead of argument"):
with pytest.warns(UserWarning, match=f"Found '{alias}' in params. Will use it instead of 'objective' argument"):
gbm.fit(X_train, y_train, eval_set=[(X_test, y_test)])
else:
gbm.fit(X_train, y_train, eval_set=[(X_test, y_test)])
Expand Down

0 comments on commit 2d0392e

Please sign in to comment.