1
$\begingroup$

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.

$\endgroup$
  • $\begingroup$ 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? $\endgroup$ – Atul Ingle Feb 27 '17 at 21:51
  • $\begingroup$ I am using 150 components. Is normalizing the spectrogram common practice for the NMF? $\endgroup$ – Sergey Feb 27 '17 at 22:13
  • $\begingroup$ 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$? $\endgroup$ – Atul Ingle Feb 27 '17 at 22:15
  • $\begingroup$ I will do the computation as soon as I get home. Intuitively, what is it we are looking for in this normalization? $\endgroup$ – Sergey Feb 27 '17 at 22:26
  • $\begingroup$ Also, do you think the row dimension of ~33k is way too large for 150 components and I should reduce the sampling frequency? $\endgroup$ – Sergey Feb 27 '17 at 22:29
0
$\begingroup$

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$.

The error "in thousands" could mean one of two things:

  1. It's practically "zero" if you normalize it by the Frobenius norm of the spectrogram $X$, in which case all is well, or,
  2. Perhaps your sound signal is too rich to be completely representable by 150 components and you should experiment by increasing that number.

It is also worth noting that squared error is often not a good measure for audio perception. Two signals with a large squared difference may sound almost the same.

$\endgroup$
  • $\begingroup$ By the way, the relative error is 0.087 $\endgroup$ – Sergey Feb 28 '17 at 0:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.