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.
Python Reference (opens in a new tab)
Constructors
constructor()
Signature
new FeatureUnion(opts?: object): FeatureUnion;
Parameters
Name | Type | Description |
---|---|---|
opts? | object | - |
opts.n_jobs? | number | Number of jobs to run in parallel. undefined means 1 unless in a joblib.parallel\_backend (opens in a new tab) 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. Default Value false |
Returns
Defined in: generated/pipeline/FeatureUnion.ts:27 (opens in a new tab)
Properties
_isDisposed
boolean
=false
Defined in: generated/pipeline/FeatureUnion.ts:25 (opens in a new tab)
_isInitialized
boolean
=false
Defined in: generated/pipeline/FeatureUnion.ts:24 (opens in a new tab)
_py
PythonBridge
Defined in: generated/pipeline/FeatureUnion.ts:23 (opens in a new tab)
id
string
Defined in: generated/pipeline/FeatureUnion.ts:20 (opens in a new tab)
opts
any
Defined in: generated/pipeline/FeatureUnion.ts:21 (opens in a new tab)
Accessors
named_transformers
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.
Signature
named_transformers(): Promise<any>;
Returns
Promise
<any
>
Defined in: generated/pipeline/FeatureUnion.ts:320 (opens in a new tab)
py
Signature
py(): PythonBridge;
Returns
PythonBridge
Defined in: generated/pipeline/FeatureUnion.ts:54 (opens in a new tab)
Signature
py(pythonBridge: PythonBridge): void;
Parameters
Name | Type |
---|---|
pythonBridge | PythonBridge |
Returns
void
Defined in: generated/pipeline/FeatureUnion.ts:58 (opens in a new tab)
Methods
dispose()
Disposes of the underlying Python resources.
Once dispose()
is called, the instance is no longer usable.
Signature
dispose(): Promise<void>;
Returns
Promise
<void
>
Defined in: generated/pipeline/FeatureUnion.ts:109 (opens in a new tab)
fit()
Fit all transformers using X.
Signature
fit(opts: object): Promise<any>;
Parameters
Name | Type | Description |
---|---|---|
opts | object | - |
opts.X? | ArrayLike | Input data, used to fit transformers. |
opts.fit_params? | any | Parameters to pass to the fit method of the estimator. |
opts.y? | ArrayLike [] | Targets for supervised learning. |
Returns
Promise
<any
>
Defined in: generated/pipeline/FeatureUnion.ts:126 (opens in a new tab)
fit_transform()
Fit all transformers, transform the data and concatenate results.
Signature
fit_transform(opts: object): Promise<ArrayLike>;
Parameters
Name | Type | Description |
---|---|---|
opts | object | - |
opts.X? | ArrayLike | Input data to be transformed. |
opts.fit_params? | any | Parameters to pass to the fit method of the estimator. |
opts.y? | ArrayLike [] | Targets for supervised learning. |
Returns
Promise
<ArrayLike
>
Defined in: generated/pipeline/FeatureUnion.ts:171 (opens in a new tab)
get_feature_names_out()
Get output feature names for transformation.
Signature
get_feature_names_out(opts: object): Promise<any>;
Parameters
Name | Type | Description |
---|---|---|
opts | object | - |
opts.input_features? | any | Input features. |
Returns
Promise
<any
>
Defined in: generated/pipeline/FeatureUnion.ts:216 (opens in a new tab)
init()
Initializes the underlying Python resources.
This instance is not usable until the Promise
returned by init()
resolves.
Signature
init(py: PythonBridge): Promise<void>;
Parameters
Name | Type |
---|---|
py | PythonBridge |
Returns
Promise
<void
>
Defined in: generated/pipeline/FeatureUnion.ts:67 (opens in a new tab)
set_output()
Set the output container when "transform"
and "fit\_transform"
are called.
set\_output
will set the output of all estimators in transformer\_list
.
Signature
set_output(opts: object): Promise<any>;
Parameters
Name | Type | Description |
---|---|---|
opts | object | - |
opts.transform? | "default" | "pandas" | Configure output of transform and fit\_transform . |
Returns
Promise
<any
>
Defined in: generated/pipeline/FeatureUnion.ts:254 (opens in a new tab)
transform()
Transform X separately by each transformer, concatenate results.
Signature
transform(opts: object): Promise<ArrayLike>;
Parameters
Name | Type | Description |
---|---|---|
opts | object | - |
opts.X? | ArrayLike | Input data to be transformed. |
Returns
Promise
<ArrayLike
>
Defined in: generated/pipeline/FeatureUnion.ts:287 (opens in a new tab)