TELF.factorization.decompositions package#

Subpackages#

Submodules#

TELF.factorization.decompositions.nmf_fro_admm module#

TELF.factorization.decompositions.nmf_fro_admm.H_update(X, W, H, opts=None, dual=None, use_gpu=True)[source]#

ADMM algorithm for the right factor, \(H\), in a nonnegative optimization with Frobenius norm loss function.

\[\begin{split}\underset{H}{\operatorname{minimize}} &= \frac{1}{2} \Vert X - W H \Vert_F^2 \\ \text{subject to} & \quad H \geq 0\end{split}\]
Parameters:
  • X (ndarray, sparse matrix) – Nonnegative m by n matrix to decompose.

  • W (ndarray) – Nonnegative m by k left factor of X.

  • H (ndarray) – Nonnegative k by n initialization of right factor of X.

  • opts (dict) –

    Dictionary or optional arguments.

    ’hist’ (list): list to append the objective function to.

    ’niter’ (int): number of iterations.

    ’rho’ (double): convergence parameter.

Returns:

Nonnegative k by n right factor of X.

Return type:

H (ndarray)

TELF.factorization.decompositions.nmf_fro_admm.W_update(X, W, H, opts=None, dual=None, use_gpu=True)[source]#

ADMM algorithm for the left factor, \(W\), in a nonnegative optimization with Frobenius norm loss function.

\[\begin{split}\underset{W}{\operatorname{minimize}} &= \frac{1}{2} \Vert X - W H \Vert_F^2 \\ \text{subject to} & \quad W \geq 0\end{split}\]
Parameters:
  • X (ndarray, sparse matrix) – Nonnegative m by n matrix to decompose.

  • W (ndarray) – Nonnegative m by k initialization of left factor of X.

  • H (ndarray) – Nonnegative k by n right factor of X.

  • opts (dict) –

    Dictionary or optional arguments.

    ’hist’ (list): list to append the objective function to.

    ’niter’ (int): number of iterations.

    ’rho’ (double): convergence parameter.

Returns:

Nonnegative k by n right factor of X.

Return type:

W (ndarray)

TELF.factorization.decompositions.nmf_fro_admm.nmf(X, W, H, use_gpu=True, opts=None)[source]#

ADMM algorithm for a nonnegative optimization with Frobenius norm loss function.

\[\begin{split}\underset{W,H}{\operatorname{minimize}} &= \frac{1}{2} \Vert X - W H \Vert_F^2 \\ \text{subject to} & \quad W \geq 0 \\ & \quad H \geq 0\end{split}\]
Parameters:
  • X (ndarray, sparse matrix) – Nonnegative m by n matrix to decompose.

  • W (ndarray) – Nonnegative m by k initialization of left factor of X.

  • H (ndarray) – Nonnegative k by n initialization of right factor of X.

  • opts (dict) –

    Dictionary or optional arguments.

    ’hist’ (list): list to append the objective function to.

    ’niter’ (int): number of iterations.

    ’W_opts’ (dict): options dictionary for W_update().

    ’H_opts’ (dict): options dictionary for H_update().

Returns:

Nonnegative m by k left factor of X.

H (ndarray): Nonnegative k by n right factor of X.

Return type:

W (ndarray)

TELF.factorization.decompositions.nmf_fro_mu module#

TELF.factorization.decompositions.nmf_fro_mu.H_update(X, W, H, opts=None, use_gpu=True, mask=None)[source]#

Multiplicative update algorithm for the right factor, \(H\), in a nonnegative optimization with Frobenius norm loss function.

\[\begin{split}\underset{H}{\operatorname{minimize}} &= \frac{1}{2} \Vert X - W H \Vert_F^2 \\ \text{subject to} & \quad H \geq 0\end{split}\]
Parameters:
  • X (ndarray, sparse matrix) – Nonnegative m by n matrix to decompose.

  • W (ndarray) – Nonnegative m by k left factor of X.

  • H (ndarray) – Nonnegative k by n initialization of right factor of X.

  • opts (dict) –

    Dictionary or optional arguments.

    ’hist’ (list): list to append the objective function to.

    ’niter’ (int): number of iterations.

Returns:

Nonnegative k by n right factor of X.

Return type:

H (ndarray)

TELF.factorization.decompositions.nmf_fro_mu.W_update(X, W, H, opts=None, use_gpu=True, mask=None)[source]#

Multiplicative update algorithm for the left factor, \(W\), in a nonnegative optimization with Frobenius norm loss function.

\[\begin{split}\underset{W}{\operatorname{minimize}} &= \frac{1}{2} \Vert X - W H \Vert_F^2 \\ \text{subject to} & \quad W \geq 0\end{split}\]
Parameters:
  • X (ndarray, sparse matrix) – Nonnegative m by n matrix to decompose.

  • W (ndarray) – Nonnegative m by k initialization of left factor of X.

  • H (ndarray) – Nonnegative k by n right factor of X.

  • opts (dict) –

    Dictionary or optional arguments.

    ’hist’ (list): list to append the objective function to.

    ’niter’ (int): number of iterations.

Returns:

Nonnegative m by k right factor of X.

Return type:

W (ndarray)

TELF.factorization.decompositions.nmf_fro_mu.nmf(X, W, H, niter=1000, hist=None, W_opts={'hist': None, 'niter': 1}, H_opts={'hist': None, 'niter': 1}, use_gpu=True, nmf_verbose=True, mask=None, use_consensus_stopping=0)[source]#

Multiplicative update algorithm for a nonnegative optimization with Frobenius norm loss function.

\[\begin{split}\underset{W,H}{\operatorname{minimize}} &= \frac{1}{2} \Vert X - W H \Vert_F^2 \\ \text{subject to} & \quad W \geq 0 \\ & \quad H \geq 0\end{split}\]
Parameters:
  • X (ndarray, sparse matrix) – Nonnegative m by n matrix to decompose.

  • W (ndarray) – Nonnegative m by k initialization of left factor of X.

  • H (ndarray) – Nonnegative k by n initialization of right factor of X.

  • opts (dict) –

    Dictionary or optional arguments.

    ’hist’ (list): list to append the objective function to.

    ’niter’ (int): number of iterations.

    ’W_opts’ (dict): options dictionary for W_update().

    ’H_opts’ (dict): options dictionary for H_update().

Returns:

Nonnegative m by k left factor of X.

H (ndarray): Nonnegative k by n right factor of X.

Return type:

W (ndarray)

TELF.factorization.decompositions.nmf_kl_admm module#

TELF.factorization.decompositions.nmf_kl_admm.H_update(X, W, H, opts=None, use_gpu=True)[source]#

ADMM algorithm for the right factor, \(H\), in a nonnegative optimization with Kullback–Leibler divergence loss function.

\[\begin{split}\underset{H}{\operatorname{minimize}} &= \operatorname{D}_{KL}(X, W H) = \sum_{i,j} X_{i,j} \log \frac{X_{i,j}}{(WH)_{i,j}} - X_{i,j} + (WH)_{i,j} \\ \text{subject to} & \quad H \geq 0\end{split}\]
Parameters:
  • X (ndarray, sparse matrix) – Nonnegative m by n matrix to decompose.

  • W (ndarray) – Nonnegative m by k left factor of X.

  • H (ndarray) – Nonnegative k by n initialization of right factor of X.

  • opts (dict) –

    Dictionary or optional arguments.

    ’hist’ (list): list to append the objective function to.

    ’niter’ (int): number of iterations.

    ’rho’ (double): convergence parameter.

Returns:

Nonnegative k by n right factor of X.

Return type:

H (ndarray)

TELF.factorization.decompositions.nmf_kl_admm.W_update(X, W, H, opts=None, use_gpu=True)[source]#

ADMM algorithm for the left factor, \(W\), in a nonnegative optimization with Kullback–Leibler divergence loss function.

\[\begin{split}\underset{W}{\operatorname{minimize}} &= \operatorname{D}_{KL}(X, W H) = \sum_{i,j} X_{i,j} \log \frac{X_{i,j}}{(WH)_{i,j}} - X_{i,j} + (WH)_{i,j} \\ \text{subject to} & \quad W \geq 0\end{split}\]
Parameters:
  • X (ndarray, sparse matrix) – Nonnegative m by n matrix to decompose.

  • W (ndarray) – Nonnegative m by k initialization of left factor of X.

  • H (ndarray) – Nonnegative k by n right factor of X.

  • opts (dict) –

    Dictionary or optional arguments.

    ’hist’ (list): list to append the objective function to.

    ’niter’ (int): number of iterations.

    ’rho’ (double): convergence parameter.

  • nz_rows (ndarray) – If X is sparse, nz_rows is a 1d array of the row indices when X is in csr format. Useful when calling this function multiple times with the same sparse matrix X.

  • nz_cols (ndarray) – If X is sparse, nz_cols is a 1d array of the col indices when X is in csr format. Useful when calling this function multiple times with the same sparse matrix X.

Returns:

Nonnegative m by k left factor of X.

Return type:

W (ndarray)

TELF.factorization.decompositions.nmf_kl_admm.nmf(X, W, H, opts=None, use_gpu=True)[source]#

ADMM algorithm for a nonnegative optimization with Kullback–Leibler divergence loss function.

\[\begin{split}\underset{W,H}{\operatorname{minimize}} &= \operatorname{D}_{KL}(X, W H) = \sum_{i,j} X_{i,j} \log \frac{X_{i,j}}{(WH)_{i,j}} - X_{i,j} + (WH)_{i,j} \\ \text{subject to} & \quad W \geq 0 \\ & \quad H \geq 0\end{split}\]
Parameters:
  • X (ndarray, sparse matrix) – Nonnegative m by n matrix to decompose.

  • W (ndarray) – Nonnegative m by k initialization of left factor of X.

  • H (ndarray) – Nonnegative k by n initialization of right factor of X.

  • opts (dict) –

    Dictionary or optional arguments.

    ’hist’ (list): list to append the objective function to.

    ’niter’ (int): number of iterations.

    ’pruned’ (bool): indicator if the input matrix needs to be pruned of zeros.

    ’rho’ (double): convergence parameter.

Returns:

Nonnegative m by k left factor of X.

H (ndarray): Nonnegative k by n right factor of X.

Return type:

W (ndarray)

TELF.factorization.decompositions.nmf_kl_mu module#

TELF.factorization.decompositions.nmf_kl_mu.H_update(X, W, H, opts=None, nz_rows=None, nz_cols=None, use_gpu=True, mask=None)[source]#

Multiplicative update algorithm for the right factor, \(H\), in a nonnegative optimization with Kullback–Leibler divergence loss function.

\[\begin{split}\underset{H}{\operatorname{minimize}} &= \operatorname{D}_{KL}(X, W H) = \sum_{i,j} X_{i,j} \log \frac{X_{i,j}}{(WH)_{i,j}} - X_{i,j} + (WH)_{i,j} \\ \text{subject to} & \quad H \geq 0\end{split}\]
Parameters:
  • X (ndarray, sparse matrix) – Nonnegative m by n matrix to decompose.

  • W (ndarray) – Nonnegative m by k left factor of X.

  • H (ndarray) – Nonnegative k by n initialization of right factor of X.

  • opts (dict) –

    Dictionary or optional arguments.

    ’hist’ (list): list to append the objective function to.

    ’niter’ (int): number of iterations.

  • nz_rows (ndarray) – If X is sparse, nz_rows is a 1d array of the row indices when X is in csc format. Useful when calling this function multiple times with the same sparse matrix X.

  • nz_cols (ndarray) – If X is sparse, nz_cols is a 1d array of the col indices when X is in csc format. Useful when calling this function multiple times with the same sparse matrix X.

Returns:

Nonnegative k by n right factor of X.

Return type:

H (ndarray)

TELF.factorization.decompositions.nmf_kl_mu.W_update(X, W, H, opts=None, nz_rows=None, nz_cols=None, use_gpu=True, mask=None)[source]#

Multiplicative update algorithm for the left factor, \(W\), in a nonnegative optimization with Kullback–Leibler divergence loss function.

\[\begin{split}\underset{W}{\operatorname{minimize}} &= \operatorname{D}_{KL}(X, W H) = \sum_{i,j} X_{i,j} \log \frac{X_{i,j}}{(WH)_{i,j}} - X_{i,j} + (WH)_{i,j} \\ \text{subject to} & \quad W \geq 0\end{split}\]
Parameters:
  • X (ndarray, sparse matrix) – Nonnegative m by n matrix to decompose.

  • W (ndarray) – Nonnegative m by k initialization of left factor of X.

  • H (ndarray) – Nonnegative k by n right factor of X.

  • opts (dict) –

    Dictionary or optional arguments.

    ’hist’ (list): list to append the objective function to.

    ’niter’ (int): number of iterations.

  • nz_rows (ndarray) – If X is sparse, nz_rows is a 1d array of the row indices when X is in csr format. Useful when calling this function multiple times with the same sparse matrix X.

  • nz_cols (ndarray) – If X is sparse, nz_cols is a 1d array of the col indices when X is in csr format. Useful when calling this function multiple times with the same sparse matrix X.

Returns:

Nonnegative m by k left factor of X.

Return type:

W (ndarray)

TELF.factorization.decompositions.nmf_kl_mu.nmf(X, W, H, niter=1000, hist=None, W_opts={'hist': None, 'niter': 1}, H_opts={'hist': None, 'niter': 1}, use_gpu=True, nmf_verbose=True, mask=None, use_consensus_stopping=0)[source]#

Multiplicative update algorithm for a nonnegative optimization with Kullback–Leibler divergence loss function.

\[\begin{split}\underset{W,H}{\operatorname{minimize}} &= \operatorname{D}_{KL}(X, W H) = \sum_{i,j} X_{i,j} \log \frac{X_{i,j}}{(WH)_{i,j}} - X_{i,j} + (WH)_{i,j} \\ \text{subject to} & \quad W \geq 0 \\ & \quad H \geq 0\end{split}\]
Parameters:
  • X (ndarray, sparse matrix) – Nonnegative m by n matrix to decompose.

  • W (ndarray) – Nonnegative m by k initialization of left factor of X.

  • H (ndarray) – Nonnegative k by n initialization of right factor of X.

  • opts (dict) –

    Dictionary or optional arguments.

    ’hist’ (list): list to append the objective function to.

    ’niter’ (int): number of iterations.

    ’W_opts’ (dict): options dictionary for W_update().

    ’H_opts’ (dict): options dictionary for H_update().

Returns:

Nonnegative m by k left factor of X.

H (ndarray): Nonnegative k by n right factor of X.

Return type:

W (ndarray)

TELF.factorization.decompositions.nmf_mc_fro_mu module#

TELF.factorization.decompositions.nmf_mc_fro_mu.H_update_ADMM(X, W, H, opts=None, dual=None, use_gpu=True)[source]#

ADMM algorithm for the right factor in a nonnegative optimization with Frobenius norm loss function. ||X-WH||_F^2

Parameters:
  • X (ndarray, sparse matrix) – Nonnegative m by n matrix to decompose.

  • W (ndarray) – Nonnegative m by k left factor of X.

  • H (ndarray) – Nonnegative k by n initialization of right factor of X.

  • opts (dict) – Dictionary or optional arguments. ‘hist’ (list): list to append the objective function to. ‘niter’ (int): number of iterations. ‘rho’ (double): convergence parameter.

Returns:

Nonnegative k by n right factor of X.

Return type:

H (ndarray)

TELF.factorization.decompositions.nmf_mc_fro_mu.H_update_MU(X, W, H, opts=None, use_gpu=True)[source]#

Multiplicative update algorithm for the right factor in a nonnegative optimization with Frobenius norm loss function. ||X-WH||_F^2

Parameters:
  • X (ndarray, sparse matrix) – Nonnegative m by n matrix to decompose.

  • W (ndarray) – Nonnegative m by k left factor of X.

  • H (ndarray) – Nonnegative k by n initialization of right factor of X.

  • opts (dict) – Dictionary or optional arguments. ‘hist’ (list): list to append the objective function to. ‘niter’ (int): number of iterations.

Returns:

Nonnegative k by n right factor of X.

Return type:

H (ndarray)

TELF.factorization.decompositions.nmf_mc_fro_mu.W_update_ADMM(X, W, H, opts=None, dual=None, use_gpu=True)[source]#

ADMM algorithm for the left factor in a nonnegative optimization with Frobenius norm loss function. ||X-WH||_F^2

Parameters:
  • X (ndarray, sparse matrix) – Nonnegative m by n matrix to decompose.

  • W (ndarray) – Nonnegative m by k initialization of left factor of X.

  • H (ndarray) – Nonnegative k by n right factor of X.

  • opts (dict) – Dictionary or optional arguments. ‘hist’ (list): list to append the objective function to. ‘niter’ (int): number of iterations. ‘rho’ (double): convergence parameter.

Returns:

Nonnegative m by k left factor of X.

Return type:

W (ndarray)

TELF.factorization.decompositions.nmf_mc_fro_mu.W_update_MU(X, W, H, opts=None, use_gpu=True)[source]#

Multiplicative update algorithm for the left factor in a nonnegative optimization with Frobenius norm loss function. ||X-WH||_F^2

Parameters:
  • X (ndarray, sparse matrix) – Nonnegative m by n matrix to decompose.

  • W (ndarray) – Nonnegative m by k initialization of left factor of X.

  • H (ndarray) – Nonnegative k by n right factor of X.

  • opts (dict) – Dictionary or optional arguments. ‘hist’ (list): list to append the objective function to. ‘niter’ (int): number of iterations.

Returns:

Nonnegative m by k left factor of X.

Return type:

W (ndarray)

TELF.factorization.decompositions.nmf_mc_fro_mu.coord_desc_thresh(X, W, H, wt=None, ht=None, max_iter=100)[source]#
TELF.factorization.decompositions.nmf_mc_fro_mu.coord_desc_thresh_onefactor(X, W, H, max_iter=100)[source]#
TELF.factorization.decompositions.nmf_mc_fro_mu.find_thres_WH(X, Wn, Hn, output='best', npoint=None)[source]#
TELF.factorization.decompositions.nmf_mc_fro_mu.nmf(X, W, H, lowerthres=1, upperthres=None, opts=None, Mask=None)[source]#

penalized nmf with adaptive alpha

TELF.factorization.decompositions.nmf_mc_fro_mu.nmf_with_ADMM(X, W, H, lowerthres=1, upperthres=None, opts=None, use_gpu=True)[source]#

Multiplicative update algorithm for NMF with Frobenius norm loss function. ||X-WH||_F^2

Parameters:
  • X (ndarray, sparse matrix) – Nonnegative m by n matrix to decompose.

  • W (ndarray) – Nonnegative m by k initialization of left factor of X.

  • H (ndarray) – Nonnegative k by n initialization of right factor of X.

  • opts (dict) – Dictionary or optional arguments. ‘hist’ (list): list to append the objective function to. ‘niter’ (int): number of iterations. ‘pruned’ (bool): indicator if the input matrix needs to be pruned of zeros. ‘W_opts’ (dict): options dictionary for W update ‘H_opts’ (dict): options dictionary for H update

Returns:

Nonnegative m by k left factor of X. H (ndarray): Nonnegative k by n right factor of X.

Return type:

W (ndarray)

TELF.factorization.decompositions.nmf_mc_fro_mu.old_find_thres_WH(X, Wn, Hn, method='grid_search', output='best', npoint=100)[source]#
TELF.factorization.decompositions.nmf_mc_fro_mu.old_nmf(X, W, H, lowerthres=1, upperthres=None, opts=None)[source]#

Multiplicative update algorithm for NMF with Frobenius norm loss function. ||X-WH||_F^2

Parameters:
  • X (ndarray, sparse matrix) – Nonnegative m by n matrix to decompose.

  • W (ndarray) – Nonnegative m by k initialization of left factor of X.

  • H (ndarray) – Nonnegative k by n initialization of right factor of X.

  • opts (dict) – Dictionary or optional arguments. ‘hist’ (list): list to append the objective function to. ‘niter’ (int): number of iterations. ‘pruned’ (bool): indicator if the input matrix needs to be pruned of zeros. ‘W_opts’ (dict): options dictionary for W update ‘H_opts’ (dict): options dictionary for H update

Returns:

Nonnegative m by k left factor of X. H (ndarray): Nonnegative k by n right factor of X.

Return type:

W (ndarray)

TELF.factorization.decompositions.nmf_mc_fro_mu.roc_W_H(X, W, H)[source]#
TELF.factorization.decompositions.nmf_mc_fro_mu.thres_norm(W, H)[source]#

TELF.factorization.decompositions.rescal_fro_mu module#

TELF.factorization.decompositions.rescal_fro_mu.A_update(X, A, R, opts=None, use_gpu=True)[source]#

Multiplicative update algorithm for the A factor in a nonnegative optimization with Frobenius norm loss function.

\[\begin{split}\underset{A}{\operatorname{minimize}} &= \sum \frac{1}{2} \Vert X_i - A R_i A^\top \Vert_F^2 \\ \text{subject to} & \quad A \geq 0\end{split}\]
Parameters:
  • X (list of ndarray, sparse matrix) – List of nonnegative m by m matrices to decompose.

  • A (ndarray) – Nonnegative m by k initialization of the A factor.

  • R (list of ndarray) – List of nonnegative k by k matrices in the decomposition so X[k] is paired with R[k].

  • opts (dict) –

    Dictionary or optional arguments.

    ’hist’ (list): list to append the objective function to.

    ’niter’ (int): number of iterations.

Returns:

Nonnegative m by k factor in the decomposition.

Return type:

A (ndarray)

TELF.factorization.decompositions.rescal_fro_mu.R_update(X, A, R, opts=None, use_gpu=True)[source]#

Multiplicative update algorithm for the R factor in a nonnegative optimization with Frobenius norm loss function.

\[\begin{split}\underset{R}{\operatorname{minimize}} &= \sum \frac{1}{2} \Vert X_i - A R_i A^\top \Vert_F^2 \\ \text{subject to} & \quad R \geq 0\end{split}\]
Parameters:
  • X (list of ndarray, sparse matrix) – List of nonnegative m by m matrices to decompose.

  • A (ndarray) – Nonnegative m by k matrix in the decomposition.

  • R (list of ndarray) – List of nonnegative k by k initilizations for the decomposition so X[k] is paired with R[k].

  • opts (dict) –

    Dictionary or optional arguments.

    ’hist’ (list): list to append the objective function to.

    ’niter’ (int): number of iterations.

Returns:

List of nonnegative k by k factors in the decomposition.

Return type:

R (list of ndarray)

TELF.factorization.decompositions.rescal_fro_mu.rescal(X, A, R, niter=1000, hist=None, A_opts={'hist': None, 'niter': 1}, R_opts={'hist': None, 'niter': 1}, use_gpu=True, rescal_verbose=True)[source]#

Multiplicative update algorithm for the R factor in a nonnegative optimization with Frobenius norm loss function.

\[\begin{split}\underset{R}{\operatorname{minimize}} &= \sum \frac{1}{2} \Vert X_i - A R_i A^\top \Vert_F^2 \\ \text{subject to} & \quad R \geq 0\end{split}\]
Parameters:
  • X (list of ndarray, sparse matrix) – List of nonnegative m by m matrices to decompose.

  • A (ndarray) – Nonnegative m by k initialization of the A factor.

  • R (list of ndarray) – List of nonnegative k by k initilizations for the decomposition so X[k] is paired with R[k].

  • opts (dict) –

    Dictionary or optional arguments.

    ’hist’ (list): list to append the objective function to.

    ’niter’ (int): number of iterations.

Returns:

Nonnegative m by k factor in the decomposition.

R (list of ndarray): List of nonnegative k by k factors in the decomposition.

Return type:

A (ndarray)

TELF.factorization.decompositions.tri_nmf_fro_mu module#

TELF.factorization.decompositions.tri_nmf_fro_mu.H_update(X, W, H, opts=None, use_gpu=True, mask=None, alpha_h=1.0)[source]#

Multiplicative update algorithm for the right factor, \(H\), in a nonnegative optimization with Frobenius norm loss function.

\[\begin{split}\underset{H}{\operatorname{minimize}} &= \frac{1}{2} \Vert X - W H \Vert_F^2 \\ \text{subject to} & \quad H \geq 0\end{split}\]
Parameters:
  • X (ndarray, sparse matrix) – Nonnegative m by n matrix to decompose.

  • W (ndarray) – Nonnegative m by k left factor of X.

  • H (ndarray) – Nonnegative k by n initialization of right factor of X.

  • opts (dict) –

    Dictionary or optional arguments.

    ’hist’ (list): list to append the objective function to.

    ’niter’ (int): number of iterations.

Returns:

Nonnegative k by n right factor of X.

Return type:

H (ndarray)

TELF.factorization.decompositions.tri_nmf_fro_mu.S_update(X, W, S, H, opts=None, use_gpu=True)[source]#

Multiplicative update algorithm for the R factor in a nonnegative optimization with Frobenius norm loss function.

\[\begin{split}\underset{R}{\operatorname{minimize}} &= \sum \frac{1}{2} \Vert X_i - A R_i A^\top \Vert_F^2 \\ \text{subject to} & \quad R \geq 0\end{split}\]
Parameters:
  • X (list of ndarray, sparse matrix) – List of nonnegative m by m matrices to decompose.

  • A (ndarray) – Nonnegative m by k matrix in the decomposition.

  • R (list of ndarray) – List of nonnegative k by k initilizations for the decomposition so X[k] is paired with R[k].

  • opts (dict) –

    Dictionary or optional arguments.

    ’hist’ (list): list to append the objective function to.

    ’niter’ (int): number of iterations.

Returns:

List of nonnegative k by k factors in the decomposition.

Return type:

R (list of ndarray)

TELF.factorization.decompositions.tri_nmf_fro_mu.W_update(X, W, H, opts=None, use_gpu=True, mask=None, alpha_w=1.0)[source]#

Multiplicative update algorithm for the left factor, \(W\), in a tri - nonnegative optimization with Frobenius norm loss function.

\[\begin{split}\underset{W}{\operatorname{minimize}} &= \frac{1}{2} \Vert X - W H \Vert_F^2 \\ \text{subject to} & \quad W \geq 0\end{split}\]
Parameters:
  • X (ndarray, sparse matrix) – Nonnegative m by n matrix to decompose.

  • W (ndarray) – Nonnegative m by k initialization of left factor of X.

  • H (ndarray) – Nonnegative k by n right factor of X.

  • opts (dict) –

    Dictionary or optional arguments.

    ’hist’ (list): list to append the objective function to.

    ’niter’ (int): number of iterations.

Returns:

Nonnegative m by k right factor of X.

Return type:

W (ndarray)

TELF.factorization.decompositions.tri_nmf_fro_mu.trinmf(X, W, S, H, niter=1000, hist=None, W_opts={'hist': None, 'niter': 1}, H_opts={'hist': None, 'niter': 1}, use_gpu=True, nmf_verbose=True, mask=None, use_consensus_stopping=0, alpha=[1.0, 1.0])[source]#

Multiplicative update algorithm for a nonnegative optimization with Frobenius norm loss function With orthogonality constraints

Parameters:
  • X (ndarray, sparse matrix) – Nonnegative m by n matrix to decompose.

  • W (ndarray) – Nonnegative m by kw initialization of left factor of X.

  • S (ndarray) – Nonnegative kx by kh initialization of the middle factor of X.

  • H (ndarray) – Nonnegative kh by n initialization of right factor of X.

  • opts (dict) –

    Dictionary or optional arguments.

    ’hist’ (list): list to append the objective function to.

    ’niter’ (int): number of iterations.

    ’W_opts’ (dict): options dictionary for W_update().

    ’H_opts’ (dict): options dictionary for H_update().

Returns:

Nonnegative m by kw left factor of X. S (ndarray): Nonnegative kw by kh middle factor of X. H (ndarray): Nonnegative kh by n right factor of X.

Return type:

W (ndarray)

Module contents#