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)
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. By default, m = 1, which
corresponds to the relative interior of the simplex (discrete probability
distributions with nonzero probabilities.)

The metric imposed on the manifold is the Fisher metric such that
the set of n-by-m column-stochastic matrices (a.k.a. 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 at non-critical points.

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.

Please cite the Manopt paper as well as the research paper:
@Article{sun2015multinomial,
author  = {Y. Sun and J. Gao and X. Hong and B. Mishra and B. Yin},
title   = {Heterogeneous Tensor Decomposition for Clustering via Manifold Optimization},
journal = {IEEE Transactions on Pattern Analysis and Machine Intelligence},
year    = {2016},
volume  = {38},
number  = {3},
pages   = {476--489},
doi     = {10.1109/TPAMI.2015.2465901}
}```

## CROSS-REFERENCE INFORMATION This function calls:
• hashmd5 Computes the MD5 hash of input data.
• matrixlincomb Linear combination function for tangent vectors represented as matrices.
This function is called by:

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

Generated on Mon 10-Sep-2018 11:48:06 by m2html © 2005