File Exchange

image thumbnail

Simple to use NMF/NTF with beta divergence

version 1.5 (6.28 KB) by

very simple to use implementation of the NMF/NTF model

13 Downloads

Updated

View License

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

Comments and Ratings (4)

Liutong

Liutong (view profile)

Thanks for sharing it!

Updates

1.5

Had mismatched the title of this submission

1.4

corrected the description

1.3

Added the possibility to fixe only some of the components in W, H or Q

1.2

Modified a function description.

1.1

modified slightly description to add some important details

MATLAB Release
MATLAB 7.8 (R2009a)

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video