From 44316d7c1cad635b26a281456c7c9ac84d626882 Mon Sep 17 00:00:00 2001 From: Claudio Salvatore Arcidiacono <22871978+ClaudioSalvatoreArcidiacono@users.noreply.github.com> Date: Wed, 18 Dec 2024 13:57:18 +0100 Subject: [PATCH] make new early stopping parameters keyword-only --- python-package/lightgbm/dask.py | 9 ++++++--- python-package/lightgbm/sklearn.py | 3 ++- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/python-package/lightgbm/dask.py b/python-package/lightgbm/dask.py index c462f06f7801..43b4b1854967 100644 --- a/python-package/lightgbm/dask.py +++ b/python-package/lightgbm/dask.py @@ -1134,10 +1134,11 @@ def __init__( random_state: Optional[Union[int, np.random.RandomState, "np.random.Generator"]] = None, n_jobs: Optional[int] = None, importance_type: str = "split", + client: Optional[Client] = None, + *, early_stopping: bool = False, n_iter_no_change: int = 10, validation_fraction: Optional[float] = 0.1, - client: Optional[Client] = None, **kwargs: Any, ): """Docstring is inherited from the lightgbm.LGBMClassifier.__init__.""" @@ -1340,10 +1341,11 @@ def __init__( random_state: Optional[Union[int, np.random.RandomState, "np.random.Generator"]] = None, n_jobs: Optional[int] = None, importance_type: str = "split", + client: Optional[Client] = None, + *, early_stopping: bool = False, n_iter_no_change: int = 10, validation_fraction: Optional[float] = 0.1, - client: Optional[Client] = None, **kwargs: Any, ): """Docstring is inherited from the lightgbm.LGBMRegressor.__init__.""" @@ -1510,10 +1512,11 @@ def __init__( random_state: Optional[Union[int, np.random.RandomState, "np.random.Generator"]] = None, n_jobs: Optional[int] = None, importance_type: str = "split", + client: Optional[Client] = None, + *, early_stopping: bool = False, n_iter_no_change: int = 10, validation_fraction: Optional[float] = 0.1, - client: Optional[Client] = None, **kwargs: Any, ): """Docstring is inherited from the lightgbm.LGBMRanker.__init__.""" diff --git a/python-package/lightgbm/sklearn.py b/python-package/lightgbm/sklearn.py index 1f9c4850a747..8d7f0f71c206 100644 --- a/python-package/lightgbm/sklearn.py +++ b/python-package/lightgbm/sklearn.py @@ -507,10 +507,11 @@ def __init__( random_state: Optional[Union[int, np.random.RandomState, np.random.Generator]] = None, n_jobs: Optional[int] = None, importance_type: str = "split", + *, early_stopping: bool = False, n_iter_no_change: int = 10, validation_fraction: Optional[float] = 0.1, - **kwargs, + **kwargs: Any, ): r"""Construct a gradient boosting model.