Code covered by the BSD License  

Highlights from
Statistical Learning Toolbox

from Statistical Learning Toolbox by Dahua Lin
Functions for statistical learning, pattern recognition and computer vision, covering many topics.

Description of sllle_wg
Home > sltoolbox > manifold > sllle_wg.m

sllle_wg

PURPOSE ^

SLLLE_WG Solves the Locally Linear Embedding from weight graph

SYNOPSIS ^

function [Y, spectrum] = sllle_wg(G, d)

DESCRIPTION ^

SLLLE_WG Solves the Locally Linear Embedding from weight graph

 $ Syntax $
   - Y = sllle_wg(G, d)
   - [Y, spectrum] = sllle_wg(G, d)

 $ Arguments $
   - G:        The weights graph
   - d:        The dimension of the embedding
   - Y:        The sample coordinates in the embedded space
   - spectrum: The spectrum of the embeded space dimensions

 $ Description $
   - Y = sllle_wg(G, d) solves the locally linear embedding from
     a given weight graph. G should be a graph of n nodes, where
     the edge value from i-th node to j-th node, means the weights
     on the i-th sample in constructing the j-th sample, (or the
     construction of i-th sample to the j-th sample). 
     Y is solved by taking the eigenvectors of (I - W)(I - W)^T, 
     corresponding to the (d+1) smallest eigenvalues, and discarding 
     the smallest one.  In our output, the dimension is sorted in the 
     ascending order of eigenvalues.

   - [Y, spectrum] = sllle_wg(G, d) also returns the spectrum of the
     corresponding dimensions, a column vector of the corresponding
     eigenvalues.

 $ Remarks $
   - The dimension d should be strictly less than n.

 $ History $
   - Created by Dahua Lin, on Sep 11st, 2006

CROSS-REFERENCE INFORMATION ^

This function calls:
  • slsymeig SLSYMEIG Compute the eigenvalues and eigenvectors for symmetric matrix
  • sladjmat SLADJMAT Constructs the adjacency matrix representation of a graph
  • slgraphinfo SLGRAPHINFO Extracts basic information of a given graph representation
  • raise_lackinput RAISE_LACKINPUT Raises an error indicating lack of input argument
This function is called by:
  • sllle SLLLE Performs Locally Linear Embedding

SOURCE CODE ^

0001 function [Y, spectrum] = sllle_wg(G, d)
0002 %SLLLE_WG Solves the Locally Linear Embedding from weight graph
0003 %
0004 % $ Syntax $
0005 %   - Y = sllle_wg(G, d)
0006 %   - [Y, spectrum] = sllle_wg(G, d)
0007 %
0008 % $ Arguments $
0009 %   - G:        The weights graph
0010 %   - d:        The dimension of the embedding
0011 %   - Y:        The sample coordinates in the embedded space
0012 %   - spectrum: The spectrum of the embeded space dimensions
0013 %
0014 % $ Description $
0015 %   - Y = sllle_wg(G, d) solves the locally linear embedding from
0016 %     a given weight graph. G should be a graph of n nodes, where
0017 %     the edge value from i-th node to j-th node, means the weights
0018 %     on the i-th sample in constructing the j-th sample, (or the
0019 %     construction of i-th sample to the j-th sample).
0020 %     Y is solved by taking the eigenvectors of (I - W)(I - W)^T,
0021 %     corresponding to the (d+1) smallest eigenvalues, and discarding
0022 %     the smallest one.  In our output, the dimension is sorted in the
0023 %     ascending order of eigenvalues.
0024 %
0025 %   - [Y, spectrum] = sllle_wg(G, d) also returns the spectrum of the
0026 %     corresponding dimensions, a column vector of the corresponding
0027 %     eigenvalues.
0028 %
0029 % $ Remarks $
0030 %   - The dimension d should be strictly less than n.
0031 %
0032 % $ History $
0033 %   - Created by Dahua Lin, on Sep 11st, 2006
0034 %
0035 
0036 %% parse and verify input
0037 
0038 if nargin < 2
0039     raise_lackinput('sllle_wg', 2);
0040 end
0041 
0042 gi = slgraphinfo(G, {'square'});
0043 if ~gi.valued
0044     error('sltoolbox:invalidarg', 'The graph G should be a valued graph');
0045 end
0046 if isnumeric(G)
0047     W = G;
0048 else
0049     W = sladjmat(G, 'sparse', true);
0050 end
0051 
0052 n = gi.n;
0053 if d >= n
0054     error('sltoolbox:invalidarg', 'd should be strictly less than n');
0055 end
0056 
0057 %% compute
0058 
0059 if issparse(W)
0060     M = speye(n) - W;
0061 else
0062     M = eye(n) - W;
0063 end
0064 clear W;
0065 M = M * M';
0066 
0067 [spectrum, Y] = slsymeig(M, d+1, 'ascend');
0068 clear M;
0069 spectrum = spectrum(2:d+1);
0070 Y = Y(:, 2:d+1);
0071 Y = Y';
0072 
0073

Generated on Wed 20-Sep-2006 12:43:11 by m2html © 2003

Contact us at files@mathworks.com