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
Home > sltoolbox > manifold > sllle.m

sllle

PURPOSE ^

SLLLE Performs Locally Linear Embedding

SYNOPSIS ^

function [Y, spectrum, WG] = sllle(X, G, d, rwparams)

DESCRIPTION ^

SLLLE Performs Locally Linear Embedding

 $ Syntax $
   - Y = sllle(X, G, d)
   - Y = sllle(X, G, d, rwparams)
   - [Y, spectrum, WG] = sllle(X, G, d)

 $ Arguments $
   - X:        The sample matrix (d x n)
   - G:        The neighborhood graph or the cell array of parameters to 
               generate the neighborhood graph. 
               For a graph, G should have n nodes, where n is the number
               of samples in X. The non-zero of the entry (i,j) means 
               the i-th sample is the neighbor of the j-th sample.
               If it is a set of parameters, it is in the form of 
               {method, ...}, which will be input to slfindnn to 
               construct a neighborhood graph. 
   - d:        The dimension of the embeded space. 
   - rwparams: The cell array parameters for solving reconstruction weights
               default = {}
   - Y:        The coordinates of samples in the embeded space
   - WG:       The weight graph computed

 $ Description $
   - Y = sllle(X, G, d) solves the locally linear embedding of X in a 
     d-dimensional linear space. 

   - Y = sllle(X, G, d, rwparams) uses special set of parameters to 
     control the solving of reconstruction parameters.

   - [Y, spectrum, WG] = sllle(X, G, d) additionally returns the spectrum
     and the local construction weight graph.

 $ Remarks $
   - It integrates the functions: 
       - slfindnn and slnngraph: for graph construction
       - slreconweights: for local reconstruction weight solving
       - sllle_wg: solves LLE from constructed weight graph
   - Only the zero/non-zero of G takes effects, it will not make use
     of the values in G.

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

CROSS-REFERENCE INFORMATION ^

This function calls:
  • sladjmat SLADJMAT Constructs the adjacency matrix representation of a graph
  • slgraphinfo SLGRAPHINFO Extracts basic information of a given graph representation
  • slnngraph SLNNGRAPH Constructs a nearest neighborhood based graph
  • sllle_wg SLLLE_WG Solves the Locally Linear Embedding from weight graph
  • slnbreconweights SLNBRECONWEIGHTS Solve the optimal reconstruction weights on given neighbors
  • raise_lackinput RAISE_LACKINPUT Raises an error indicating lack of input argument
This function is called by:

SOURCE CODE ^

0001 function [Y, spectrum, WG] = sllle(X, G, d, rwparams)
0002 %SLLLE Performs Locally Linear Embedding
0003 %
0004 % $ Syntax $
0005 %   - Y = sllle(X, G, d)
0006 %   - Y = sllle(X, G, d, rwparams)
0007 %   - [Y, spectrum, WG] = sllle(X, G, d)
0008 %
0009 % $ Arguments $
0010 %   - X:        The sample matrix (d x n)
0011 %   - G:        The neighborhood graph or the cell array of parameters to
0012 %               generate the neighborhood graph.
0013 %               For a graph, G should have n nodes, where n is the number
0014 %               of samples in X. The non-zero of the entry (i,j) means
0015 %               the i-th sample is the neighbor of the j-th sample.
0016 %               If it is a set of parameters, it is in the form of
0017 %               {method, ...}, which will be input to slfindnn to
0018 %               construct a neighborhood graph.
0019 %   - d:        The dimension of the embeded space.
0020 %   - rwparams: The cell array parameters for solving reconstruction weights
0021 %               default = {}
0022 %   - Y:        The coordinates of samples in the embeded space
0023 %   - WG:       The weight graph computed
0024 %
0025 % $ Description $
0026 %   - Y = sllle(X, G, d) solves the locally linear embedding of X in a
0027 %     d-dimensional linear space.
0028 %
0029 %   - Y = sllle(X, G, d, rwparams) uses special set of parameters to
0030 %     control the solving of reconstruction parameters.
0031 %
0032 %   - [Y, spectrum, WG] = sllle(X, G, d) additionally returns the spectrum
0033 %     and the local construction weight graph.
0034 %
0035 % $ Remarks $
0036 %   - It integrates the functions:
0037 %       - slfindnn and slnngraph: for graph construction
0038 %       - slreconweights: for local reconstruction weight solving
0039 %       - sllle_wg: solves LLE from constructed weight graph
0040 %   - Only the zero/non-zero of G takes effects, it will not make use
0041 %     of the values in G.
0042 %
0043 % $ History $
0044 %   - Created by Dahua Lin, on Sep 11st, 2006
0045 %
0046 
0047 %% parse and verify input arguments
0048 
0049 if nargin < 3
0050     raise_lackinput('sllle', 3);
0051 end
0052 
0053 if ~isnumeric(X) || ndims(X) ~= 2
0054     error('sltoolbox:invalidarg', ...
0055         'X should be a 2D numeric matrix');
0056 end
0057 n = size(X, 2);
0058 
0059 if d >= n
0060     error('sltoolbox:invalidarg', ...
0061         'd should be strictly less than n');
0062 end
0063 
0064 if nargin < 4
0065     rwparams = {};
0066 end
0067 
0068 
0069 %% process the graph
0070 
0071 if iscell(G)
0072     G = slnngraph(X, [], G, 'valtype', 'logical', 'sparse', true);
0073 end
0074 
0075 gi = slgraphinfo(G, {'square'});
0076 if ~strcmp(gi.form, 'adjmat')
0077     G = sladjmat(G, 'valtype', 'logical', 'sparse', true);
0078 end
0079 
0080 %% solve reconstruction weights
0081 
0082 WG = slnbreconweights(X, [], G, rwparams{:});
0083 clear G;
0084 
0085 %% solve the embedding
0086 
0087 [Y, spectrum] = sllle_wg(WG, d);
0088     
0089 
0090     
0091     
0092     
0093     
0094 
0095 
0096 
0097

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

Contact us at files@mathworks.com