Skip to content

Commit

Permalink
TST update make_column_transformer test + add comment (#12156)
Browse files Browse the repository at this point in the history
Follow-up on #12152
And added comment why transformer_weights is not passed through, see
#11183 (review)
for more discussion
  • Loading branch information
jorisvandenbossche authored and jnothman committed Oct 14, 2018
1 parent bac89c2 commit 4a6b5b8
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 2 additions & 0 deletions sklearn/compose/_column_transformer.py
Expand Up @@ -751,6 +751,8 @@ def make_column_transformer(*transformers, **kwargs):
['categorical_column'])])
"""
# transformer_weights keyword is not passed through because the user
# would need to know the automatically generated names of the transformers
n_jobs = kwargs.pop('n_jobs', None)
remainder = kwargs.pop('remainder', 'drop')
sparse_threshold = kwargs.pop('sparse_threshold', 0.3)
Expand Down
4 changes: 2 additions & 2 deletions sklearn/compose/tests/test_column_transformer.py
Expand Up @@ -499,12 +499,12 @@ def test_make_column_transformer_kwargs():
norm = Normalizer()
ct = make_column_transformer(('first', scaler), (['second'], norm),
n_jobs=3, remainder='drop',
sparse_threshold=0.3)
sparse_threshold=0.5)
assert_equal(ct.transformers, make_column_transformer(
('first', scaler), (['second'], norm)).transformers)
assert_equal(ct.n_jobs, 3)
assert_equal(ct.remainder, 'drop')
assert_equal(ct.sparse_threshold, 0.3)
assert_equal(ct.sparse_threshold, 0.5)
# invalid keyword parameters should raise an error message
assert_raise_message(
TypeError,
Expand Down

0 comments on commit 4a6b5b8

Please sign in to comment.