Home > manopt > manifolds > multinomial > multinomialfactory.m

multinomialfactory

PURPOSE ^

Manifold of n-by-m column-stochastic matrices with positive entries.

SYNOPSIS ^

function M = multinomialfactory(n, m)

DESCRIPTION ^

 Manifold of n-by-m column-stochastic matrices with positive entries.

 function M = multinomialfactory(n, m)

 The returned structure M is a Manopt manifold structure to optimize over
 the set of n-by-m matrices with (strictly) positive entries and such that
 the entries of each column sum to one.

 The metric imposed on the manifold is the Fisher metric such that 
 the set of n-by-m column-stochastic matrices (aka the multinomial manifold)
 is a Riemannian submanifold of the space of n-by-m matrices. Also it
 should be noted that the retraction operation that we define 
 is first order and as such the checkhessian tool cannot verify 
 the slope correctly.
             
 The file is based on developments in the research paper
 Y. Sun, J. Gao, X. Hong, B. Mishra, and B. Yin,
 "Heterogeneous tensor decomposition for clustering via manifold
 optimization", arXiv:1504.01777, 2015.

 Link to the paper: http://arxiv.org/abs/1504.01777.

 Please cite the Manopt paper as well as the research paper:
     @Techreport{sun2014multinomial,
       Title   = {Heterogeneous tensor decomposition for clustering via manifold optimization},
       Author  = {Sun, Y. and Gao, J. and Hong, X. and Mishra, B. and Yin, B.},
       Journal = {Arxiv preprint arXiv:1504.01777},
       Year    = {2014}
     }

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SUBFUNCTIONS ^

SOURCE CODE ^

0001 function M = multinomialfactory(n, m)
0002 % Manifold of n-by-m column-stochastic matrices with positive entries.
0003 %
0004 % function M = multinomialfactory(n, m)
0005 %
0006 % The returned structure M is a Manopt manifold structure to optimize over
0007 % the set of n-by-m matrices with (strictly) positive entries and such that
0008 % the entries of each column sum to one.
0009 %
0010 % The metric imposed on the manifold is the Fisher metric such that
0011 % the set of n-by-m column-stochastic matrices (aka the multinomial manifold)
0012 % is a Riemannian submanifold of the space of n-by-m matrices. Also it
0013 % should be noted that the retraction operation that we define
0014 % is first order and as such the checkhessian tool cannot verify
0015 % the slope correctly.
0016 %
0017 % The file is based on developments in the research paper
0018 % Y. Sun, J. Gao, X. Hong, B. Mishra, and B. Yin,
0019 % "Heterogeneous tensor decomposition for clustering via manifold
0020 % optimization", arXiv:1504.01777, 2015.
0021 %
0022 % Link to the paper: http://arxiv.org/abs/1504.01777.
0023 %
0024 % Please cite the Manopt paper as well as the research paper:
0025 %     @Techreport{sun2014multinomial,
0026 %       Title   = {Heterogeneous tensor decomposition for clustering via manifold optimization},
0027 %       Author  = {Sun, Y. and Gao, J. and Hong, X. and Mishra, B. and Yin, B.},
0028 %       Journal = {Arxiv preprint arXiv:1504.01777},
0029 %       Year    = {2014}
0030 %     }
0031 
0032 % This file is part of Manopt: www.manopt.org.
0033 % Original author: Bamdev Mishra, April 06, 2015.
0034 % Contributors:
0035 % Change log:
0036     
0037     M.name = @() sprintf('%dx%d column-stochastic matrices with positive entries', n, m);
0038     
0039     M.dim = @() (n-1)*m;
0040     
0041     % We impose the Fisher metric.
0042     M.inner = @iproduct;
0043     function ip = iproduct(X, eta, zeta)
0044         ip = sum((eta(:).*zeta(:))./X(:));
0045     end
0046     
0047     M.norm = @(X, eta) sqrt(M.inner(X, eta, eta));
0048     
0049     M.dist = @(X, Y) error('multinomialfactory.dist not implemented yet.');
0050     
0051     M.typicaldist = @() m*pi/2; % This is an approximation.
0052     
0053     % Column vector of ones of length n.
0054     e = ones(n, 1);
0055     
0056     M.egrad2rgrad = @egrad2rgrad;
0057     function rgrad = egrad2rgrad(X, egrad)
0058         lambda = -sum(X.*egrad, 1); % Row vector of length m.
0059         rgrad = X.*egrad + (e*lambda).*X; % This is in the tangent space.
0060     end
0061     
0062     M.ehess2rhess = @ehess2rhess;
0063     function rhess = ehess2rhess(X, egrad, ehess, eta)
0064         
0065         % Riemannian gradient computation.
0066         % lambda is a row vector of length m.
0067         lambda = - sum(X.*egrad, 1);
0068         rgrad =  X.*egrad + (e*lambda).*X;
0069         
0070         % Directional derivative of the Riemannian gradient.
0071         % lambdadot is a row vector of length m.
0072         lambdadot = -sum(eta.*egrad, 1) - sum(X.*ehess, 1); 
0073         rgraddot = eta.*egrad + X.*ehess + (e*lambdadot).*X + (e*lambda).*eta;
0074         
0075         % Correction term because of the non-constant metric that we
0076         % impose. The computation of the correction term follows the use of
0077         % Koszul formula.
0078         correction_term = - 0.5*(eta.*rgrad)./X;
0079         rhess = rgraddot + correction_term;
0080         
0081         % Finally, projection onto the tangent space.
0082         rhess = M.proj(X, rhess);
0083     end
0084     
0085     % Projection of the vector eta in the ambeint space onto the tangent
0086     % space.
0087     M.proj = @projection;
0088     function etaproj = projection(X, eta)
0089         alpha = sum(eta, 1); % Row vector of length m.
0090         etaproj = eta - (e*alpha).*X;
0091     end
0092     
0093     M.tangent = M.proj;
0094     M.tangent2ambient = @(X, eta) eta;
0095     
0096     M.retr = @retraction;
0097     function Y = retraction(X, eta, t)
0098         if nargin < 3
0099             t = 1.0;
0100         end
0101         % A first-order retraction.
0102         Y = X.*exp(t*(eta./X)); % Based on mapping for positive scalars.
0103         Y = Y./(e*(sum(Y, 1))); % Projection onto the constraint set.
0104         % For numerical reasons, so that we avoid entries going to zero:
0105         Y = max(Y, eps);
0106     end
0107     
0108     M.exp = @exponential;
0109     function Y = exponential(X, eta, t)
0110         if nargin < 3
0111             t = 1.0;
0112         end
0113         Y = retraction(X, eta, t);
0114         warning('manopt:multinomialfactory:exp', ...
0115             ['Exponential for the Multinomial manifold' ...
0116             'manifold not implemented yet. Used retraction instead.']);
0117     end
0118     
0119     M.hash = @(X) ['z' hashmd5(X(:))];
0120     
0121     M.rand = @random;
0122     function X = random()
0123         % A random point in the ambient space.
0124         X = rand(n, m); %
0125         X = X./(e*(sum(X, 1)));
0126     end
0127     
0128     M.randvec = @randomvec;
0129     function eta = randomvec(X)
0130         % A random vector in the tangent space
0131         eta = randn(n, m);
0132         eta = M.proj(X, eta); % Projection onto the tangent space.
0133         nrm = M.norm(X, eta);
0134         eta = eta / nrm;
0135     end
0136     
0137     M.lincomb = @matrixlincomb;
0138     
0139     M.zerovec = @(X) zeros(n, m);
0140     
0141     M.transp = @(X1, X2, d) projection(X2, d);
0142     
0143     % vec and mat are not isometries, because of the scaled metric.
0144     M.vec = @(X, U) U(:);
0145     M.mat = @(X, u) reshape(u, n, m);
0146     M.vecmatareisometries = @() false;
0147 end

Generated on Sat 12-Nov-2016 14:11:22 by m2html © 2005