darfix.decomposition.nica.NICA#
- class darfix.decomposition.nica.NICA(data, num_components, chunksize=None, lr=0.03, indices=None)[source]#
Bases:
Base
Compute the non-negative independent components of the linear generative model x = A * s.
Here, x is a p-dimensional observable random vector and s is the latent random vector of length num_components, whose components are statistically independent and non-negative. The matrix X is assumed to hold n samples of x, stacked in columns (shape(X) = (p, n)). In practice, if shape(X) = (p, n) this function solves X = A * S both for S and A, where A is the so-called mixing matrix, with shape (p, num_components), and S is a (num_components, n) matrix which contains n samples of the latent source vector, stacked in columns.
This function implements the method presented in: Blind Separation of Positive Sources by Globally Convergent Gradient Search (https://core.ac.uk/download/pdf/76988305.pdf)
- Parameters:
data – array of shape (nsamples, nfeatures).
num_components (Union[uint, None]) – Dimension of s. Number of latent random variables.
chunksize (int) – Size of every group of samples to apply PCA to. PCA will be fit with arrays of shape (chunksize, nfeatures), where nfeatures is the number of features per sample.
lr (float) – Learning rate of gradient descent.
max_iter (int) – Maximum number of iterations of gradient descent.
tol (float) – Tolerance on update at each iteration.
- property V#
- property Z#
- property data#
- fit_transform(max_iter=100, error_step=None)[source]#
Fit to data, then transform it
- Parameters:
max_iter (int, optional) – Maximum number of iterations, defaults to 100
error_step (Union[None,int], optional) – If None, error is not computed, defaults to None Else compute error for every error_step iterations.
compute_w (bool, optional) – When False, W is not computed, defaults to True
compute_h (bool, optional) – When False, H is not computed, defaults to True
- frobenius_norm(chunks=200)#
Frobenius norm (||data - WH||) of a data matrix and a low rank approximation given by WH. Minimizing the Fnorm is the most common optimization criterion for matrix factorization methods. Returns: ——- frobenius norm: F = ||data - WH||
- property indices#
- property num_components#
- property num_features#
- property num_samples#
- squared_frobenius_norm(chunks=200)#
Frobenius norm (||data - WH||) of a data matrix and a low rank approximation given by WH. Minimizing the Fnorm is the most common optimization criterion for matrix factorization methods. Returns: ——- frobenius norm: F = ||data - WH||