# Extremely large reconstruction errors in NMF

First time in this stack... I am doing some audio analysis. I have a spectrogram ($N\approx 33000, M=1024$) and I need to run an NMF algorithm on it. I am using the Scikit learn implementation. And the code on Github.

• Immediately, what strikes me strange, is if you look at the fit_transform functions, the returned signal representation is called W, which makes me believe that the dictionary learned is our H. Aren't the naming conventions for these two components the opposite?

• Second, my reconstruction error is in the thousands. Any suggestions on what I may be doing wrong?

My spectrogram is non negative, as required.

• Depending on how your spectrogram is scaled, "thousands" may not be as bad as you think it is. What's the error, if normalized by the total energy in your spectrogram? How many components did you choose when decomposing? – Atul Ingle Feb 27 '17 at 21:51
• I am using 150 components. Is normalizing the spectrogram common practice for the NMF? – Sergey Feb 27 '17 at 22:13
• Perhaps, your audio signal is very "rich" and isn't well represented by 150 components. How does the error of "thousands" compare to the total energy in your spectrogram? i.e. what is $||X-WH||^2/||X||^2$? – Atul Ingle Feb 27 '17 at 22:15
• I will do the computation as soon as I get home. Intuitively, what is it we are looking for in this normalization? – Sergey Feb 27 '17 at 22:26
• Also, do you think the row dimension of ~33k is way too large for 150 components and I should reduce the sampling frequency? – Sergey Feb 27 '17 at 22:29

When you decompose $X \approx WH$, the columns of $W$ form the dictionary and the columns of $H$ are the time varying weights. In your example, if you choose 150 components, then $W$ should be $33k \times 150$ and $H$ should be $150 \times 1024$.
1. It's practically "zero" if you normalize it by the Frobenius norm of the spectrogram $X$, in which case all is well, or,