Skip to content

Commit 6717c6a

Browse files
authored
API Deprecate positional arguments in semi_supervised module (scikit-learn#16974)
* API Keyword only for semi_supervised * CLN Address comments
1 parent 79df406 commit 6717c6a

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

sklearn/semi_supervised/_label_propagation.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@
6868
from ..utils.extmath import safe_sparse_dot
6969
from ..utils.multiclass import check_classification_targets
7070
from ..utils.validation import check_is_fitted, check_array
71+
from ..utils.validation import _deprecate_positional_args
7172
from ..exceptions import ConvergenceWarning
7273

7374

@@ -105,7 +106,8 @@ class BaseLabelPropagation(ClassifierMixin, BaseEstimator, metaclass=ABCMeta):
105106
for more details.
106107
"""
107108

108-
def __init__(self, kernel='rbf', gamma=20, n_neighbors=7,
109+
@_deprecate_positional_args
110+
def __init__(self, kernel='rbf', *, gamma=20, n_neighbors=7,
109111
alpha=1, max_iter=30, tol=1e-3, n_jobs=None):
110112

111113
self.max_iter = max_iter
@@ -378,7 +380,8 @@ class LabelPropagation(BaseLabelPropagation):
378380

379381
_variant = 'propagation'
380382

381-
def __init__(self, kernel='rbf', gamma=20, n_neighbors=7,
383+
@_deprecate_positional_args
384+
def __init__(self, kernel='rbf', *, gamma=20, n_neighbors=7,
382385
max_iter=1000, tol=1e-3, n_jobs=None):
383386
super().__init__(kernel=kernel, gamma=gamma,
384387
n_neighbors=n_neighbors, max_iter=max_iter,
@@ -491,7 +494,8 @@ class LabelSpreading(BaseLabelPropagation):
491494

492495
_variant = 'spreading'
493496

494-
def __init__(self, kernel='rbf', gamma=20, n_neighbors=7, alpha=0.2,
497+
@_deprecate_positional_args
498+
def __init__(self, kernel='rbf', *, gamma=20, n_neighbors=7, alpha=0.2,
495499
max_iter=30, tol=1e-3, n_jobs=None):
496500

497501
# this one has different base parameters

0 commit comments

Comments
 (0)