Practical NMF/NTF with beta divergence
You should prefer the file
http://fr.mathworks.com/matlabcentral/fileexchange/38109-simple-to-use-nmf-ntf-with-beta-divergence
for a practical NMF/NTF implementation. I leave this submission because of its use in some other scripts.
----------------------------------
Class name : NMF
----------------------------------
Implements NMF with any beta divergence, works on data with arbitrary number of channels.
It can work alone, but can also be practical when used with the Signal class (other submission)
Features include :
* Any beta-divergence for cost function. Particular cases of interest are :
beta=2 => Euclidean distance
beta=1 => Generalized KL divergence
beta=0 => Itakura Saito distance
* Any number of components
* Any number of channels (DOA model)
* simulated annealing : it is allowed to provide a cooling scheme for the optimization, through a starting and ending beta for the beta-divergence. This is done by setting beta as a two-elements vector.See A TEMPERING APPROACH FOR ITAKURA-SAITO NON-NEGATIVE MATRIX FACTORIZATION. WITH APPLICATION TO MUSIC TRANSCRIPTION, by Nancy Bertin ICASSP2009
* Divergence weighting : it is possible to take the divergence into account differently, depending of the time-frequency bin. Such an approch was introduced in "Combining Pitch-Based Inference and Non-Negative Spectrogram Factorization in Separating Vocals from Polyphonic Music" by Virtanen, SAPA 2008
* Correlation penalization between rows of H, columns of W, or non-correlation penalization between columns of H. This is done setting the corrHTemporal, corrW and corrHPattern to
positive values. This is inspired from unpublished work by Romain Hennequin.
* Implements exponent stepsize convergence for non convex beta-divergences
* Simple rendering functions, designed to work with the class Signal. Can also work directly on matrices
Typical usage is:
* Along with Signal (for wavfiles manipulations):
s = Signal('linktomy.wav');
n = NMF(s);
* Using matrices directly, let V be a FxTxC matrix
n = NMF(V);
[optional] Now the number of components can be changed:
n.nComponents = 20;
[optional]The beta divergence can be changed:
n.beta = 0; %itakura saito, adequate for spectra
n.beta = 1; % Kullback Leibler, adequate for histograms
n.beta = 2; % Euclidean, adequate for data with gaussian noise
%or, for tempering as suggested by Bertin:
n.beta = [1 0]; %switching from KL to IS during optimization
[optional] If a matrix of weights to apply on the divergence is available, say P (same size as the data):
n.divergenceWeights = P;
[optional] A penalizing factor can be set to the correlations between
* the rows of H:
n.corrHTemporal = 1.5
* the columns of H:
n.corrHPattern = 1.5
* the columns of W:
n.corrW = 1
[optional] The current model can be displayed at each iteration
n.display = 1;
now, performing optimization with, say, 100 iterations:
n.optim(100);
now, n.W, n.H and n.Q are the NMF parameters. For convienence, functions are available to get the model for a given set of components:
model1=n.getModel(1:10); %for components 1:10
totalModel = n.getModel(); %for all components
Cite As
Antoine Liutkus (2024). Practical NMF/NTF with beta divergence (https://www.mathworks.com/matlabcentral/fileexchange/33452-practical-nmf-ntf-with-beta-divergence), MATLAB Central File Exchange. Retrieved .
MATLAB Release Compatibility
Platform Compatibility
Windows macOS LinuxCategories
Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!Discover Live Editor
Create scripts with code, output, and formatted text in a single executable document.
Version | Published | Release Notes | |
---|---|---|---|
1.2.0.0 | Made clear that support for this contribution is discontinued and replaced by
|
||
1.1.0.0 | changed picture ! |
||
1.0.0.0 |