Beta process sparse NMF
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.

Beta Process Sparse NMF (BP-NMF)

A Bayesian nonparametric extension of Nonnegative Matrix Factorization (NMF) as described in the paper: Beta Process Sparse Nonnegative Matrix Factorization for Music.

Note: BP-NMF uses L-BFGS-B solver from scipy.optimize to jointly optimize multiple univariate functions, which may lead to numerically-unstable result. For more stable result (but much slower), one can replace L-BFGS-B with a univariate solver on each nonconjugate variable.

Note of Note: Since for all the nonconjugate variables update, we are essentially solving an numerical optimization problem with L-BFGS (and haven't figured out a way to do multiplicative-type of update yet), BP-NMF can take quite a while if the input matrix is large (> 2 minutes of 22.05 kHz signals with 1024-point DFT and 50% overlap). Try not to process a huge recording.

What's included:


Contains the code for inference, utils, the experiments. Note: All the files with the extension .ipynb are meant to run with IPython Notebook. Also, librosa is required for all the signal processing components in the experiments sciprts.

There is also a Python translation of the gamma process NMF (GaP-NMF) where the original MATLAB code is developed by Matt Hoffman.

Update (2014/12/02) ssmf/ directory contains code for inference with stochastic structured mean-field and collapsed Gibbs sampler. This should work no worse than the original inference and probably faster.


A detailed derivation of the full variational inference.


  • numpy
  • scipy
  • librosa (for signal processing components in the experiments)
  • python-midi (for blind source separation experiments)