8000 CLN Address comments · scikit-learn/scikit-learn@9b9d534 · GitHub
[go: up one dir, main page]

Skip to content

Commit 9b9d534

Browse files
committed
CLN Address comments
1 parent 5f2c5df commit 9b9d534

File tree

2 files changed

+6
-10
lines changed

2 files changed

+6
-10
lines changed

sklearn/ensemble/_voting.py

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
from abc import abstractmethod
1717

1818
import numbers
19-
from itertools import chain
2019
import numpy as np
2120

2221
from joblib import Parallel
@@ -475,13 +474,10 @@ def get_feature_names_out(self, input_features=None):
475474

476475
# voting == "soft"
477476
n_classes = len(self.classes_)
478-
names_out = chain.from_iterable(
479-
[
480-
[f"{class_name}_{name}{i}" for i in range(n_classes)]
481-
for name in active_names
482-
]
483-
)
484-
return np.asarray(list(names_out), dtype=object)
477+
names_out = [
478+
f"{class_name}_{name}{i}" for name in active_names for i in range(n_classes)
479+
]
480+
return np.asarray(names_out, dtype=object)
485481

486482

487483
class VotingRegressor(RegressorMixin, _BaseVoting):

sklearn/ensemble/tests/test_voting.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -629,7 +629,7 @@ def test_voting_verbose(estimator, capsys):
629629

630630

631631
def test_get_features_names_out_regressor():
632-
"""Check that get_feature_names_out output for regressor."""
632+
"""Check get_feature_names_out output for regressor."""
633633

634634
X = [[1, 2], [3, 4], [5, 6]]
635635
y = [0, 1, 2]
@@ -666,7 +666,7 @@ def test_get_features_names_out_regressor():
666666
],
667667
)
668668
def test_get_features_names_out_classifier(kwargs, expected_names):
669-
"""Check get_feature_names_out for different settings."""
669+
"""Check get_feature_names_out for classifier for different settings."""
670670
X = [[1, 2], [3, 4], [5, 6], [1, 1.2]]
671671
y = [0, 1, 2, 0]
672672

0 commit comments

Comments
 (0)
0