Simple to use NMF/NTF with beta divergence
function [W,H,Q, Vhat] = betaNTF(V,K,varargin)
%------------------------------------------------------------------
% simple beta-NTF implementation
%
% Decomposes a tensor V of dimension FxTxI into a NTF model :
% V(f,t,i) = \sum_k W(f,k)H(t,k)Q(i,k)
%
% by minimizing a beta-divergence as a cost-functions.
% particular cases include :
% * beta = 2 : Euclidean cost function
% * beta = 1 : Kullback-Leibler costfunction
% * beta = 0 : Itakura-Saito cost function
%
% caution:
% The third dimension of V ought to be the smallest. permute
% your data to this purpose if needed.
%
%
% It is possible to weight the cost function by a weight factor P of
% the same size as V, and to fix some of the components for W, H,
% and Q
%
% inputs :
% * V : FxTxI non-negative data to approximate
% * K : number of NTF components
%
% * Optional arguments include :
% - W : FxKw spectral basis
% - H : TxKh temporal activations
% - Q : IxKq loading factors
%
% Note the if Kw,Kh or Kq < K, they are completed with random init.
%
% - P : FxTxI weighting matrix, permits to weight the cost function
% to optimize element-wise
% - fixedW : the first fixedW components of W are fixed (default=0)
% - fixedH : the first fixedH components of H are fixed (default=0)
% - fixedQ : the first fixedQ components of Q are fixed (default=0)
% - nIter : number of iterations, default=100
% - beta : beta divergence considered, default=0 (Itakura-Saito)
% - display : display plots during optimization (default=0)
%
%
% outputs
% * W,H,Q : NTF model parameters
% * Vhat : reconstruction
%
% Example :
% [W,H,Q, Vhat] = betaNTF(V,'W',myW,'fixedW',1)
%
% Reconstruct your data using:
% for j = 1:I, Vhat(:,:,j) = W * diag(Q(j,:)) * H'; end
%--------------------------------------------------------------------------
% Antoine Liutkus, Inria, 2015
Cite As
Antoine Liutkus (2024). Simple to use NMF/NTF with beta divergence (https://www.mathworks.com/matlabcentral/fileexchange/38109-simple-to-use-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.5.0.0 | Had mismatched the title of this submission |
||
1.4.0.0 | corrected the description |
||
1.3.0.0 | Added the possibility to fixe only some of the components in W, H or Q |
||
1.2.0.0 | Modified a function description. |
||
1.1.0.0 | modified slightly description to add some important details |
||
1.0.0.0 |