Class: FeatureUnion
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, removed by setting to ‘drop’ or disabled by setting to ‘passthrough’ (features are passed without transformation).
Read more in the User Guide.
Constructors
new FeatureUnion()
new FeatureUnion(
opts
?):FeatureUnion
Parameters
Parameter | Type | Description |
---|---|---|
opts ? | object | - |
opts.n_jobs ? | number | Number of jobs to run in parallel. undefined means 1 unless in a joblib.parallel_backend context. \-1 means using all processors. See Glossary for more details. |
opts.transformer_list ? | any | List of transformer objects to be applied to the data. The first half of each tuple is the name of the transformer. The transformer can be ‘drop’ for it to be ignored or can be ‘passthrough’ for features to be passed unchanged. |
opts.transformer_weights ? | any | Multiplicative weights for features per transformer. Keys are transformer names, values the weights. Raises ValueError if key not present in transformer_list . |
opts.verbose ? | boolean | If true , the time elapsed while fitting each transformer will be printed as it is completed. |
opts.verbose_feature_names_out ? | boolean | If true , get_feature_names_out will prefix all feature names with the name of the transformer that generated that feature. If false , get_feature_names_out will not prefix any feature names and will error if feature names are not unique. |
Returns FeatureUnion
Defined in generated/pipeline/FeatureUnion.ts:27
Properties
Property | Type | Default value | Defined in |
---|---|---|---|
_isDisposed | boolean | false | generated/pipeline/FeatureUnion.ts:25 |
_isInitialized | boolean | false | generated/pipeline/FeatureUnion.ts:24 |
_py | PythonBridge | undefined | generated/pipeline/FeatureUnion.ts:23 |
id | string | undefined | generated/pipeline/FeatureUnion.ts:20 |
opts | any | undefined | generated/pipeline/FeatureUnion.ts:21 |
Accessors
named_transformers
Get Signature
get named_transformers():
Promise
<any
>
Dictionary-like object, with the following attributes. Read-only attribute to access any transformer parameter by user given name. Keys are transformer names and values are transformer parameters.
Returns Promise
<any
>
Defined in generated/pipeline/FeatureUnion.ts:355
py
Get Signature
get py():
PythonBridge
Returns PythonBridge
Set Signature
set py(
pythonBridge
):void
Parameters
Parameter | Type |
---|---|
pythonBridge | PythonBridge |
Returns void
Defined in generated/pipeline/FeatureUnion.ts:61
Methods
dispose()
dispose():
Promise
<void
>
Disposes of the underlying Python resources.
Once dispose()
is called, the instance is no longer usable.
Returns Promise
<void
>
Defined in generated/pipeline/FeatureUnion.ts:113
fit()
fit(
opts
):Promise
<any
>
Fit all transformers using X.
Parameters
Parameter | Type | Description |
---|---|---|
opts | object | - |
opts.fit_params ? | any | If enable_metadata_routing=False (default): Parameters directly passed to the fit methods of the sub-transformers. |
opts.X ? | ArrayLike | Input data, used to fit transformers. |
opts.y ? | ArrayLike [] | Targets for supervised learning. |
Returns Promise
<any
>
Defined in generated/pipeline/FeatureUnion.ts:130
fit_transform()
fit_transform(
opts
):Promise
<ArrayLike
>
Fit all transformers, transform the data and concatenate results.
Parameters
Parameter | Type | Description |
---|---|---|
opts | object | - |
opts.params ? | any | If enable_metadata_routing=False (default): Parameters directly passed to the fit methods of the sub-transformers. |
opts.X ? | ArrayLike | Input data to be transformed. |
opts.y ? | ArrayLike [] | Targets for supervised learning. |
Returns Promise
<ArrayLike
>
Defined in generated/pipeline/FeatureUnion.ts:172
get_feature_names_out()
get_feature_names_out(
opts
):Promise
<any
>
Get output feature names for transformation.
Parameters
Parameter | Type | Description |
---|---|---|
opts | object | - |
opts.input_features ? | any | Input features. |
Returns Promise
<any
>
Defined in generated/pipeline/FeatureUnion.ts:214
get_metadata_routing()
get_metadata_routing(
opts
):Promise
<any
>
Get metadata routing of this object.
Please check User Guide on how the routing mechanism works.
Parameters
Parameter | Type | Description |
---|---|---|
opts | object | - |
opts.routing ? | any | A MetadataRouter encapsulating routing information. |
Returns Promise
<any
>
Defined in generated/pipeline/FeatureUnion.ts:250
init()
init(
py
):Promise
<void
>
Initializes the underlying Python resources.
This instance is not usable until the Promise
returned by init()
resolves.
Parameters
Parameter | Type |
---|---|
py | PythonBridge |
Returns Promise
<void
>
Defined in generated/pipeline/FeatureUnion.ts:74
set_output()
set_output(
opts
):Promise
<any
>
Set the output container when "transform"
and "fit_transform"
are called.
set_output
will set the output of all estimators in transformer_list
.
Parameters
Parameter | Type | Description |
---|---|---|
opts | object | - |
opts.transform ? | "default" | "pandas" | "polars" | Configure output of transform and fit_transform . |
Returns Promise
<any
>
Defined in generated/pipeline/FeatureUnion.ts:286
transform()
transform(
opts
):Promise
<ArrayLike
>
Transform X separately by each transformer, concatenate results.
Parameters
Parameter | Type | Description |
---|---|---|
opts | object | - |
opts.params ? | any | Parameters routed to the transform method of the sub-transformers via the metadata routing API. See Metadata Routing User Guide for more details. |
opts.X ? | ArrayLike | Input data to be transformed. |
Returns Promise
<ArrayLike
>
Defined in generated/pipeline/FeatureUnion.ts:318