nico_covariations.utils package

Submodules

nico_covariations.utils.pyliger_utilities module

nico_covariations.utils.pyliger_utilities.NMF_obj_eval(Xs, W, Hs, L, Sp, Vs=0)[source]

Evaluates NMF objective function (sparsity, Vs optional).

nico_covariations.utils.pyliger_utilities.column_group_sub(B, i, cols)[source]
nico_covariations.utils.pyliger_utilities.iNMF(X, k, value_lambda=5.0, thresh=1e-06, max_iters=30, nrep=1, H_init=None, W_init=None, V_init=None, rand_seed=1, print_obj=False)[source]
nico_covariations.utils.pyliger_utilities.nnlsm_blockpivot(A, B, is_input_prod=False, init=None)[source]

Nonnegativity-constrained least squares with block principal pivoting method and column grouping Solves min ||AX-B||_2^2 s.t. X >= 0 element-wise. J. Kim and H. Park, Fast nonnegative matrix factorization: An active-set-like method and comparisons, SIAM Journal on Scientific Computing, vol. 33, no. 6, pp. 3261-3281, 2011.

Parameters

A : numpy.array, shape (m,n) B : numpy.array or scipy.sparse matrix, shape (m,k)

Optional Parameters

is_input_prodTrue/False. - If True, the A and B arguments are interpreted as

AtA and AtB, respectively. Default is False.

init: numpy.array, shape (n,k). - If provided, init is used as an initial value for the algorithm.

Default is None.

Returns

X, (success, Y, num_cholesky, num_eq, num_backup) X : numpy.array, shape (n,k) - solution success : True/False - True if the solution is found. False if the algorithm did not terminate due to numerical errors. Y : numpy.array, shape (n,k) - Y = A.T * A * X - A.T * B num_cholesky : int - the number of Cholesky factorizations needed num_eq : int - the number of linear systems of equations needed to be solved num_backup: int - the number of appearances of the back-up rule. See SISC paper for details.

nico_covariations.utils.pyliger_utilities.nonneg(x, eps=1e-16)[source]

Given a input matrix, set all negative values to be zero

nico_covariations.utils.pyliger_utilities.normal_eq_comb(AtA, AtB, PassSet=None)[source]

Solve many systems of linear equations using combinatorial grouping. M. H. Van Benthem and M. R. Keenan, J. Chemometrics 2004; 18: 441-450 Parameters ———- AtA : numpy.array, shape (n,n) AtB : numpy.array, shape (n,k) Returns ——- (Z,num_cholesky,num_eq) Z : numpy.array, shape (n,k) - solution num_cholesky : int - the number of unique cholesky decompositions done num_eq: int - the number of systems of linear equations solved

Module contents