package sklearn

  1. Overview
  2. Docs
Legend:
Library
Module
Module type
Parameter
Class
Class type
type tag = [
  1. | `FastICA
]
type t = [ `BaseEstimator | `FastICA | `Object | `TransformerMixin ] Obj.t
val of_pyobject : Py.Object.t -> t
val to_pyobject : [> tag ] Obj.t -> Py.Object.t
val as_transformer : t -> [ `TransformerMixin ] Obj.t
val as_estimator : t -> [ `BaseEstimator ] Obj.t
val create : ?n_components:int -> ?algorithm:[ `Parallel | `Deflation ] -> ?whiten:bool -> ?fun_:[ `S of string | `Callable of Py.Object.t ] -> ?fun_args:Dict.t -> ?max_iter:int -> ?tol:float -> ?w_init:Py.Object.t -> ?random_state:int -> unit -> t

FastICA: a fast algorithm for Independent Component Analysis.

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

Parameters ---------- n_components : int, optional Number of components to use. If none is passed, all are used.

algorithm : 'parallel', 'deflation' Apply parallel or deflational algorithm for FastICA.

whiten : boolean, optional If whiten is false, the data is already considered to be whitened, and no whitening is performed.

fun : string or function, optional. Default: 'logcosh' The functional form of the G function used in the approximation to neg-entropy. Could be either 'logcosh', 'exp', or 'cube'. You can also provide your own function. It should return a tuple containing the value of the function, and of its derivative, in the point. Example:

def my_g(x): return x ** 3, (3 * x ** 2).mean(axis=-1)

fun_args : dictionary, optional Arguments to send to the functional form. If empty and if fun='logcosh', fun_args will take value 'alpha' : 1.0.

max_iter : int, optional Maximum number of iterations during fit.

tol : float, optional Tolerance on update at each iteration.

w_init : None of an (n_components, n_components) ndarray The mixing matrix to be used to initialize the algorithm.

random_state : int, RandomState instance, default=None Used to initialize ``w_init`` when not specified, with a normal distribution. Pass an int, for reproducible results across multiple function calls. See :term:`Glossary <random_state>`.

Attributes ---------- components_ : 2D array, shape (n_components, n_features) The linear operator to apply to the data to get the independent sources. This is equal to the unmixing matrix when ``whiten`` is False, and equal to ``np.dot(unmixing_matrix, self.whitening_)`` when ``whiten`` is True.

mixing_ : array, shape (n_features, n_components) The pseudo-inverse of ``components_``. It is the linear operator that maps independent sources to the data.

mean_ : array, shape(n_features) The mean over features. Only set if `self.whiten` is True.

n_iter_ : int If the algorithm is 'deflation', n_iter is the maximum number of iterations run across all components. Else they are just the number of iterations taken to converge.

whitening_ : array, shape (n_components, n_features) Only set if whiten is 'True'. This is the pre-whitening matrix that projects data onto the first `n_components` principal components.

Examples -------- >>> from sklearn.datasets import load_digits >>> from sklearn.decomposition import FastICA >>> X, _ = load_digits(return_X_y=True) >>> transformer = FastICA(n_components=7, ... random_state=0) >>> X_transformed = transformer.fit_transform(X) >>> X_transformed.shape (1797, 7)

Notes ----- Implementation based on *A. Hyvarinen and E. Oja, Independent Component Analysis: Algorithms and Applications, Neural Networks, 13(4-5), 2000, pp. 411-430*

val fit : ?y:Py.Object.t -> x:[> `ArrayLike ] Np.Obj.t -> [> tag ] Obj.t -> t

Fit the model to X.

Parameters ---------- X : array-like, shape (n_samples, n_features) Training data, where n_samples is the number of samples and n_features is the number of features.

y : Ignored

Returns ------- self

val fit_transform : ?y:Py.Object.t -> x:[> `ArrayLike ] Np.Obj.t -> [> tag ] Obj.t -> [> `ArrayLike ] Np.Obj.t

Fit the model and recover the sources from X.

Parameters ---------- X : array-like, shape (n_samples, n_features) Training data, where n_samples is the number of samples and n_features is the number of features.

y : Ignored

Returns ------- X_new : array-like, shape (n_samples, n_components)

val get_params : ?deep:bool -> [> tag ] Obj.t -> Dict.t

Get parameters for this estimator.

Parameters ---------- deep : bool, default=True 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 inverse_transform : ?copy:bool -> x:[> `ArrayLike ] Np.Obj.t -> [> tag ] Obj.t -> [> `ArrayLike ] Np.Obj.t

Transform the sources back to the mixed data (apply mixing matrix).

Parameters ---------- X : array-like, shape (n_samples, n_components) Sources, where n_samples is the number of samples and n_components is the number of components. copy : bool (optional) If False, data passed to fit are overwritten. Defaults to True.

Returns ------- X_new : array-like, shape (n_samples, n_features)

val set_params : ?params:(string * Py.Object.t) list -> [> tag ] Obj.t -> t

Set the parameters of this estimator.

The method works on simple estimators as well as on nested objects (such as pipelines). The latter have parameters of the form ``<component>__<parameter>`` so that it's possible to update each component of a nested object.

Parameters ---------- **params : dict Estimator parameters.

Returns ------- self : object Estimator instance.

val transform : ?copy:bool -> x:[> `ArrayLike ] Np.Obj.t -> [> tag ] Obj.t -> [> `ArrayLike ] Np.Obj.t

Recover the sources from X (apply the unmixing matrix).

Parameters ---------- X : array-like, shape (n_samples, n_features) Data to transform, where n_samples is the number of samples and n_features is the number of features.

copy : bool (optional) If False, data passed to fit are overwritten. Defaults to True.

Returns ------- X_new : array-like, shape (n_samples, n_components)

val components_ : t -> [> `ArrayLike ] Np.Obj.t

Attribute components_: get value or raise Not_found if None.

val components_opt : t -> [> `ArrayLike ] Np.Obj.t option

Attribute components_: get value as an option.

val mixing_ : t -> [> `ArrayLike ] Np.Obj.t

Attribute mixing_: get value or raise Not_found if None.

val mixing_opt : t -> [> `ArrayLike ] Np.Obj.t option

Attribute mixing_: get value as an option.

val mean_ : t -> [> `ArrayLike ] Np.Obj.t

Attribute mean_: get value or raise Not_found if None.

val mean_opt : t -> [> `ArrayLike ] Np.Obj.t option

Attribute mean_: get value as an option.

val n_iter_ : t -> int

Attribute n_iter_: get value or raise Not_found if None.

val n_iter_opt : t -> int option

Attribute n_iter_: get value as an option.

val whitening_ : t -> [> `ArrayLike ] Np.Obj.t

Attribute whitening_: get value or raise Not_found if None.

val whitening_opt : t -> [> `ArrayLike ] Np.Obj.t option

Attribute whitening_: get value as an option.

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.