8.5.7. sklearn.decomposition.FastICA¶
- class sklearn.decomposition.FastICA(n_components=None, algorithm='parallel', whiten=True, fun='logcosh', fun_prime='', fun_args=None, max_iter=200, tol=0.0001, w_init=None, random_state=None)¶
FastICA; a fast algorithm for Independent Component Analysis
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
Supplying the derivative through the fun_prime attribute is still supported, but deprecated.
fun_prime : empty string (‘’) or function, optional, deprecated.
See fun.
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 or RandomState :
Pseudo number generator state used for random sampling.
Notes
Implementation based on A. Hyvarinen and E. Oja, Independent Component Analysis: Algorithms and Applications, Neural Networks, 13(4-5), 2000, pp. 411-430
Attributes
components_ 2D array, [n_components, n_features] The unmixing matrix sources_: 2D array, [n_samples, n_components] The estimated latent sources of the data. Methods
fit(X[, y]) fit_transform(X[, y]) Fit to data, then transform it get_mixing_matrix() Compute the mixing matrix get_params([deep]) Get parameters for the estimator set_params(**params) Set the parameters of the estimator. transform(X[, y]) Apply un-mixing matrix “W” to X to recover the sources - __init__(n_components=None, algorithm='parallel', whiten=True, fun='logcosh', fun_prime='', fun_args=None, max_iter=200, tol=0.0001, w_init=None, random_state=None)¶
- fit_transform(X, y=None, **fit_params)¶
Fit to data, then transform it
Fits transformer to X and y with optional parameters fit_params and returns a transformed version of X.
Parameters : X : numpy array of shape [n_samples, n_features]
Training set.
y : numpy array of shape [n_samples]
Target values.
Returns : X_new : numpy array of shape [n_samples, n_features_new]
Transformed array.
- get_mixing_matrix()¶
Compute the mixing matrix
- get_params(deep=True)¶
Get parameters for the estimator
Parameters : deep: boolean, optional :
If True, will return the parameters for this estimator and contained subobjects that are estimators.
- set_params(**params)¶
Set the parameters of the estimator.
The method works on simple estimators as well as on nested objects (such as pipelines). The former have parameters of the form <component>__<parameter> so that it’s possible to update each component of a nested object.
Returns : self :
- transform(X, y=None)¶
Apply un-mixing matrix “W” to X to recover the sources
S = X * W.T
- unmixing_matrix_¶
DEPRECATED: Renamed to components_. This will be removed in 0.14.