package sklearn

  1. Overview
  2. Docs
Legend:
Library
Module
Module type
Parameter
Class
Class type
type t
val of_pyobject : Py.Object.t -> t
val to_pyobject : t -> Py.Object.t
val create : ?n_jobs:[ `Int of int | `None ] -> ?transformer_weights:Py.Object.t -> ?verbose:bool -> transformer_list:(string * Py.Object.t) list -> unit -> t

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'.

Read more in the :ref:`User Guide <feature_union>`.

.. versionadded:: 0.13

Parameters ---------- transformer_list : list of (string, transformer) tuples List of transformer objects to be applied to the data. The first half of each tuple is the name of the transformer.

.. versionchanged:: 0.22 Deprecated `None` as a transformer in favor of 'drop'.

n_jobs : int or None, optional (default=None) Number of jobs to run in parallel. ``None`` means 1 unless in a :obj:`joblib.parallel_backend` context. ``-1`` means using all processors. See :term:`Glossary <n_jobs>` for more details.

transformer_weights : dict, optional Multiplicative weights for features per transformer. Keys are transformer names, values the weights.

verbose : boolean, optional(default=False) If True, the time elapsed while fitting each transformer will be printed as it is completed.

See Also -------- sklearn.pipeline.make_union : Convenience function for simplified feature union construction.

Examples -------- >>> 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...])

val fit : ?y:Ndarray.t -> ?fit_params:(string * Py.Object.t) list -> x:[ `Ndarray of Ndarray.t | `PyObject of Py.Object.t ] -> t -> t

Fit all transformers using X.

Parameters ---------- X : iterable or array-like, depending on transformers Input data, used to fit transformers.

y : array-like, shape (n_samples, ...), optional Targets for supervised learning.

Returns ------- self : FeatureUnion This estimator

val fit_transform : ?y:Ndarray.t -> ?fit_params:(string * Py.Object.t) list -> x:[ `Ndarray of Ndarray.t | `PyObject of Py.Object.t ] -> t -> Ndarray.t

Fit all transformers, transform the data and concatenate results.

Parameters ---------- X : iterable or array-like, depending on transformers Input data to be transformed.

y : array-like, shape (n_samples, ...), optional Targets for supervised learning.

Returns ------- X_t : array-like or sparse matrix, shape (n_samples, sum_n_components) hstack of results of transformers. sum_n_components is the sum of n_components (output dimension) over transformers.

val get_feature_names : t -> string list

Get feature names from all transformers.

Returns ------- feature_names : list of strings Names of the features produced by transform.

val get_params : ?deep:bool -> t -> Py.Object.t

Get parameters for this estimator.

Parameters ---------- deep : boolean, optional If True, will return the parameters for this estimator and contained subobjects that are estimators.

Returns ------- params : mapping of string to any Parameter names mapped to their values.

val set_params : ?kwargs:(string * Py.Object.t) list -> t -> t

Set the parameters of this estimator.

Valid parameter keys can be listed with ``get_params()``.

Returns ------- self

val transform : x:[ `Ndarray of Ndarray.t | `PyObject of Py.Object.t ] -> t -> Ndarray.t

Transform X separately by each transformer, concatenate results.

Parameters ---------- X : iterable or array-like, depending on transformers Input data to be transformed.

Returns ------- X_t : array-like or sparse matrix, shape (n_samples, sum_n_components) hstack of results of transformers. sum_n_components is the sum of n_components (output dimension) over transformers.

val to_string : t -> string

Print the object to a human-readable representation.

val show : t -> string

Print the object to a human-readable representation.

val pp : Stdlib.Format.formatter -> t -> unit

Pretty-print the object to a formatter.

OCaml

Innovation. Community. Security.