class sklearn.pipeline.FeatureUnion(transformer_list, n_jobs=None, transformer_weights=None) [source]
Concatenates results of multiple transformer objects.
This estimator applies a list of transformer objects in parallel to the input data, then concatenates the results. This is useful to combine several feature extraction mechanisms into a single transformer.
Parameters of the transformers may be set using its name and the parameter name separated by a ‘__’. A transformer may be replaced entirely by setting the parameter with its name to another transformer, or removed by setting to ‘drop’ or None.
Read more in the User Guide.
| Parameters: |
|
|---|
See also
sklearn.pipeline.make_union
>>> from sklearn.pipeline import FeatureUnion
>>> from sklearn.decomposition import PCA, TruncatedSVD
>>> union = FeatureUnion([("pca", PCA(n_components=1)),
... ("svd", TruncatedSVD(n_components=2))])
>>> X = [[0., 1., 3], [2., 2., 5]]
>>> union.fit_transform(X)
array([[ 1.5 , 3.0..., 0.8...],
[-1.5 , 5.7..., -0.4...]])
fit(X[, y]) | Fit all transformers using X. |
fit_transform(X[, y]) | Fit all transformers, transform the data and concatenate results. |
get_feature_names() | Get feature names from all transformers. |
get_params([deep]) | Get parameters for this estimator. |
set_params(**kwargs) | Set the parameters of this estimator. |
transform(X) | Transform X separately by each transformer, concatenate results. |
__init__(transformer_list, n_jobs=None, transformer_weights=None) [source]
fit(X, y=None) [source]
Fit all transformers using X.
| Parameters: |
|
|---|---|
| Returns: |
|
fit_transform(X, y=None, **fit_params) [source]
Fit all transformers, transform the data and concatenate results.
| Parameters: |
|
|---|---|
| Returns: |
|
get_feature_names() [source]
Get feature names from all transformers.
| Returns: |
|
|---|
get_params(deep=True) [source]
Get parameters for this estimator.
| Parameters: |
|
|---|---|
| Returns: |
|
set_params(**kwargs) [source]
Set the parameters of this estimator.
Valid parameter keys can be listed with get_params().
| Returns: |
|
|---|
transform(X) [source]
Transform X separately by each transformer, concatenate results.
| Parameters: |
|
|---|---|
| Returns: |
|
sklearn.pipeline.FeatureUnion
© 2007–2018 The scikit-learn developers
Licensed under the 3-clause BSD License.
http://scikit-learn.org/stable/modules/generated/sklearn.pipeline.FeatureUnion.html