Skip to content

Commit

Permalink
Remove kwargs to avoid error overhead.
Browse files Browse the repository at this point in the history
  • Loading branch information
yu9824 committed May 6, 2023
1 parent 7c53ae8 commit d2db632
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions kennard_stone/kennard_stone.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ def __init__(
*,
metric: str = "euclidean",
n_jobs: Optional[int] = None,
**kwargs,
random_state: None = None,
shuffle: None = None,
) -> None:
"""K-Folds cross-validator using the Kennard-Stone algorithm.
Expand Down Expand Up @@ -78,15 +79,15 @@ def __init__(
self.metric = metric
self.n_jobs = n_jobs

if "shuffle" in kwargs:
if shuffle is not None:
warnings.warn(
"`shuffle` is unnecessary because it is always shuffled"
" in this algorithm.",
UserWarning,
)
del self.shuffle

if "random_state" in kwargs:
if random_state is not None:
warnings.warn(
"`random_state` is unnecessary since it is uniquely determined"
" in this algorithm.",
Expand Down Expand Up @@ -166,7 +167,8 @@ def train_test_split(
train_size: Optional[Union[float, int]] = None,
metric: str = "euclidean",
n_jobs: Optional[int] = None,
**kwargs,
random_state: None = None,
shuffle: None = None,
) -> list:
"""Split arrays or matrices into train and test subsets using the
Kennard-Stone algorithm.
Expand Down Expand Up @@ -223,14 +225,14 @@ def train_test_split(
------
ValueError
"""
if "shuffle" in kwargs:
if shuffle is not None:
warnings.warn(
"`shuffle` is unnecessary because it is always shuffled"
" in this algorithm.",
UserWarning,
)

if "random_state" in kwargs:
if random_state is not None:
warnings.warn(
"`random_state` is unnecessary since it is uniquely determined"
" in this algorithm.",
Expand Down

0 comments on commit d2db632

Please sign in to comment.