|
68 | 68 | from ..utils.extmath import safe_sparse_dot |
69 | 69 | from ..utils.multiclass import check_classification_targets |
70 | 70 | from ..utils.validation import check_is_fitted, check_array |
| 71 | +from ..utils.validation import _deprecate_positional_args |
71 | 72 | from ..exceptions import ConvergenceWarning |
72 | 73 |
|
73 | 74 |
|
@@ -105,7 +106,8 @@ class BaseLabelPropagation(ClassifierMixin, BaseEstimator, metaclass=ABCMeta): |
105 | 106 | for more details. |
106 | 107 | """ |
107 | 108 |
|
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, |
109 | 111 | alpha=1, max_iter=30, tol=1e-3, n_jobs=None): |
110 | 112 |
|
111 | 113 | self.max_iter = max_iter |
@@ -378,7 +380,8 @@ class LabelPropagation(BaseLabelPropagation): |
378 | 380 |
|
379 | 381 | _variant = 'propagation' |
380 | 382 |
|
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, |
382 | 385 | max_iter=1000, tol=1e-3, n_jobs=None): |
383 | 386 | super().__init__(kernel=kernel, gamma=gamma, |
384 | 387 | n_neighbors=n_neighbors, max_iter=max_iter, |
@@ -491,7 +494,8 @@ class LabelSpreading(BaseLabelPropagation): |
491 | 494 |
|
492 | 495 | _variant = 'spreading' |
493 | 496 |
|
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, |
495 | 499 | max_iter=30, tol=1e-3, n_jobs=None): |
496 | 500 |
|
497 | 501 | # this one has different base parameters |
|
0 commit comments