Skip to content

numpy.linalg.linalg.LinAlgError: Singular matrix #5

Description

@nabidam

hello, I'm using NMF_ANLS_BLOCKPIVOT algorithm on a 200x990 matrix with this code
W1, H1, info1 = NMF_ANLS_BLOCKPIVOT().run(X1, 56, max_iter=500, verbose=1)
but after running for about 15 minutes, it shows an error for singular matrix:

File "nnmf.py", line 120, in
W1, H1, info1 = nmf().run(X1, rank, max_iter=500, verbose=1)
File "/home/navid/anaconda3/envs/fr/lib/python3.6/site-packages/nonnegfac/nmf.py", line 97, in run
(W, H) = self.iter_solver(A, W, H, k, i)
File "/home/navid/anaconda3/envs/fr/lib/python3.6/site-packages/nonnegfac/nmf.py", line 195, in iter_solver
Sol, info = nnlsm_blockpivot(W, A, init=H.T)
File "/home/navid/anaconda3/envs/fr/lib/python3.6/site-packages/nonnegfac/nnls.py", line 120, in nnlsm_blockpivot
AtA, AtB[:, not_opt_cols], PassSet[:, not_opt_cols])
File "/home/navid/anaconda3/envs/fr/lib/python3.6/site-packages/nonnegfac/nnls.py", line 322, in normal_eq_comb
Z[ix1] = nla.solve(AtA[ix2], AtB[ix1])
File "/home/navid/anaconda3/envs/fr/lib/python3.6/site-packages/numpy/linalg/linalg.py", line 394, in solve
r = gufunc(a, b, signature=signature, extobj=extobj)
File "/home/navid/anaconda3/envs/fr/lib/python3.6/site-packages/numpy/linalg/linalg.py", line 89, in _raise_linalgerror_singular
raise LinAlgError("Singular matrix")
numpy.linalg.linalg.LinAlgError: Singular matrix

I searched the singular matrix error and I got this error happens if a numpy matrix isn't invertible.
now what should I do?
sorry for my bad english and I thank you.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions