@@ -689,6 +689,14 @@ def make_column_transformer(*transformers, **kwargs):
689
689
non-specified columns will use the ``remainder`` estimator. The
690
690
estimator must support `fit` and `transform`.
691
691
692
+ sparse_threshold : float, default = 0.3
693
+ If the transformed output consists of a mix of sparse and dense data,
694
+ it will be stacked as a sparse matrix if the density is lower than this
695
+ value. Use ``sparse_threshold=0`` to always return dense.
696
+ When the transformed output consists of all sparse or all dense data,
697
+ the stacked result will be sparse or dense, respectively, and this
698
+ keyword will be ignored.
699
+
692
700
n_jobs : int or None, optional (default=None)
693
701
Number of jobs to run in parallel.
694
702
``None`` means 1 unless in a :obj:`joblib.parallel_backend` context.
@@ -725,9 +733,11 @@ def make_column_transformer(*transformers, **kwargs):
725
733
"""
726
734
n_jobs = kwargs .pop ('n_jobs' , None )
727
735
remainder = kwargs .pop ('remainder' , 'drop' )
736
+ sparse_threshold = kwargs .pop ('sparse_threshold' , 0.3 )
728
737
if kwargs :
729
738
raise TypeError ('Unknown keyword arguments: "{}"'
730
739
.format (list (kwargs .keys ())[0 ]))
731
740
transformer_list = _get_transformer_list (transformers )
732
741
return ColumnTransformer (transformer_list , n_jobs = n_jobs ,
733
- remainder = remainder )
742
+ remainder = remainder ,
743
+ sparse_threshold = sparse_threshold )
0 commit comments