5.0

5.0 | 1 rating Rate this file 38 Downloads (last 30 days) File Size: 2.72 KB File ID: #38109
image thumbnail

Nonnegative Matrix and Tensor Factorization (NMF, NTF) with any beta-divergence

by

 

10 Sep 2012 (Updated )

very simple to use implementation of the NMF/NTF model

| Watch this File

File Information
Description

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
%
% It is possible to weight the cost function by a weight factor P of
% the same size as V.
%
%
% inputs :
% * V : FxTxI non-negative data to approximate
% * K : number of NTF components
%
% * Optional arguments include :
% - W : FxK spectral basis
% - H : TxK temporal activations
% - Q : IxK loading factors
% - P : FxTxI weighting matrix, permits to weight the cost function
% to optimize element-wise
% - fixedW : do not learn W, default=0
% - fixedH : do not learn H, default=0
% - fixedQ : do not learn Q, 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
%
% Examples :
% 1°) compute a simple NTF model of 10 components for V, which is FxTxI,
% use default Itakura-Saito divergence (beta=0)
% [W,H,Q, Vhat] = betaNTF(V,10)
%
% 2°) Same with Euclidean distance (beta=2)
% [W,H,Q, Vhat] = betaNTF(V,10,'beta',2)
%
% 3°) Use a fixed W, which is known beforehand as variable myW
% [W,H,Q, Vhat] = betaNTF(V,'W',myW,'fixedW',1)
%
% To reconstruct the approximation of your data, use :
% for i = 1:I, Vhat(:,:,i) = W * diag(Q(i,:)) * H'; end
%--------------------------------------------------------------------------
% Antoine Liutkus, Telecom ParisTech, 2012

MATLAB release MATLAB 7.8 (R2009a)
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (1)
29 May 2014 Lucas Nogueira

Thanks for sharing it!

Updates
11 Sep 2012

modified slightly description to add some important details

12 Nov 2012

Modified a function description.

Contact us