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 slparseprops
Home > sltoolbox > utils > slparseprops.m

slparseprops

PURPOSE ^

SLPARSEPROPS Parses input parameters

SYNOPSIS ^

function P = slparseprops(P0, varargin)

DESCRIPTION ^

SLPARSEPROPS Parses input parameters

 $ Syntax $
   - P = slparseprops(P0, property_struct)
   - P = slparseprops(P0, property_name1, property_value1, ...)

 $ Syntax $
   - P = slparseprops(P0, property_struct) parses the properties from a 
     property structure. The structure has multiple entries, with the 
     property names as field names, and the property values are corresponding
     values. 

   - P = slparseprops(P0, property_name1, property_value1, ...) parses
     the properties from property list. The list are a argument list with
     the form of multiple pairs of property names and corresponding values.

 $ Remarks $
   - The P0 specifies the default values of properties. All properties 
     that can be set should appear in P0. If some properties specified in
     following arguments are not included in P0, an error will be raised.

   - Passing arguments in the way of property specification is a convenient
     method when multiple values need to be input. The user can only change
     some properties, while leaving others being in their default values.
     With this function, the function composer can design the function
     interfaces in the following form: func(main_parameters, varargin), and
     use parseprops(P0, varargin{:}) to parse the properties specified in the
     extra arguments.
         
 $ History $
   - Created by Dahua Lin on Dec 19th, 2005
   - Modified by Dahua Lin, on Aug 27, 2006
       - enhance the compatibility with older version of Matlab

CROSS-REFERENCE INFORMATION ^

This function calls:
This function is called by:
  • edl_logerror EDL_LOGERROR Logs an error into logger
  • edl_readexpdefs EDL_READEXPDEFS Reads in an experiment definition from XML file
  • annsearch ANNSEARCH Approximate Nearest Neighbor Search
  • slkmeans SLKMEANS Performs K-Means Clustering on samples
  • slkmeansex SLKMEANSEX Performs Generalized K-means
  • slvechist SLVECHIST Makes the histogram on prototype vectors by voting
  • slvote SLVOTE Builds histogram by voting (or fuzzy voting)
  • sllog SLLOG Constructs a logger
  • slchangefilepart SLCHANGEFILEPART Changes some parts of the file path
  • sladjmat SLADJMAT Constructs the adjacency matrix representation of a graph
  • slaffinitymat SLAFFINITYMAT Constructs an affinity matrix
  • sledges2adjmat SLEDGES2ADJMAT Creates an adjacency matrix from edge set
  • slfindnn SLFINDNN Finds the nearest neighbors using specified strategy
  • slnngraph SLNNGRAPH Constructs a nearest neighborhood based graph
  • slpwgraph SLVALGRAPH Constructs a graph by computing values between nodes pairwisely
  • slpwmetricgraph SLPWMETRICGRAPH Constructs a graph based on pairwise metrics
  • slapplyfilterband SLAPPLYFILTERBAND Applies filter band to filter images in batch
  • slpixneighbors SLPIXNEIGHBORS Extracts the neighborhood of pixels from an image
  • slkernelfea SLKERNELFEA Extracts kernelized mapped features
  • slkfd SLKFD Perform Kernelized Fisher Discriminant Analysis
  • slkpca SLPCA Learns a Kernel PCA model from training samples
  • sliterproc SLITERPROC Runs a general iterative process
  • slproglearn SLPROGLEARN Performs Progressive Learning from sample source
  • slreevallearn SLREEVALLEARN Performs an iterative learning based on re-evaluation
  • slgembed SLGEMBED Solves the general graph-based embedding
  • slnbreconweights SLNBRECONWEIGHTS Solve the optimal reconstruction weights on given neighbors
  • sllinreg SLLINREG Performs Multivariate Linear Regression and Ridge Regression
  • sllogistreg SLLOGISTREG Performs Multivariate Logistic Regression
  • slfmm SLFMM Learns a Finite Mixture Model (FMM)
  • slgausscomb SLGAUSSCOMB Collects the means and variances/covariances to form GS
  • slgaussest SLGAUSSEST Estimates the Gaussian models from samples
  • slgausspdf SLGAUSSPDF Computes the probability density of Gaussian models
  • slgmm SLGMM Learns Gaussian Mixture model from samples
  • slregcov SLREGCOV Regularizes covariance matrices
  • slwhiten_from_samples SLWHITEN_FROM_SAMPLES Compute the whitening matrix from sample matrix
  • slcopca SLCOPCA Performs Coupled PCA Learning
  • sldlda SLDLDA Performs Direct Linear Discriminant Analysis
  • slfld SLFLD Performs Fisher Linear Discriminant Analysis
  • slgbfe SLGBFE Performs Graph-based Feature Extraction Learning
  • sllda SLLDA Trains a Linear Discriminant Model using specified method
  • slnlda SLNLDA Performs Nullspace-based Linear Discriminant Analysis
  • slpca SLPCA Learns a PCA model from training samples
  • slscatter SLSCATTER Compute the scatter matrix
  • sl2dpcaex SL2DPCAEX Learns Extended 2D PCA on a set of matrix samples
  • slarrmean SLARRMEAN Computes the mean of a set of arrays
  • slpartitionpca SLPARTITIONPCA Performs Partition-based PCA and saves the models
  • slcompresstext SLCOMPRESSTEXT Compresses a cell array of text
  • slclassify SLCLASSIFY Classifies a set of samples according to final scores
  • slclassify_blks SLCLASSIFY_BLKS Classifies samples according to blockwise scores
  • slsharedisp_attach SLSHAREDISP_ATTACH Attachs to global display options
  • xml_getattribs XML_GETATTRIBS Constructs an attribte struct from an XML element

SUBFUNCTIONS ^

SOURCE CODE ^

0001 function P = slparseprops(P0, varargin)
0002 %SLPARSEPROPS Parses input parameters
0003 %
0004 % $ Syntax $
0005 %   - P = slparseprops(P0, property_struct)
0006 %   - P = slparseprops(P0, property_name1, property_value1, ...)
0007 %
0008 % $ Syntax $
0009 %   - P = slparseprops(P0, property_struct) parses the properties from a
0010 %     property structure. The structure has multiple entries, with the
0011 %     property names as field names, and the property values are corresponding
0012 %     values.
0013 %
0014 %   - P = slparseprops(P0, property_name1, property_value1, ...) parses
0015 %     the properties from property list. The list are a argument list with
0016 %     the form of multiple pairs of property names and corresponding values.
0017 %
0018 % $ Remarks $
0019 %   - The P0 specifies the default values of properties. All properties
0020 %     that can be set should appear in P0. If some properties specified in
0021 %     following arguments are not included in P0, an error will be raised.
0022 %
0023 %   - Passing arguments in the way of property specification is a convenient
0024 %     method when multiple values need to be input. The user can only change
0025 %     some properties, while leaving others being in their default values.
0026 %     With this function, the function composer can design the function
0027 %     interfaces in the following form: func(main_parameters, varargin), and
0028 %     use parseprops(P0, varargin{:}) to parse the properties specified in the
0029 %     extra arguments.
0030 %
0031 % $ History $
0032 %   - Created by Dahua Lin on Dec 19th, 2005
0033 %   - Modified by Dahua Lin, on Aug 27, 2006
0034 %       - enhance the compatibility with older version of Matlab
0035 %
0036 
0037 if nargin == 1
0038     P = P0;
0039 elseif nargin == 2
0040     if isempty(varargin{1})
0041         P = P0;
0042     elseif isstruct(varargin{1})
0043         P = parse_props_from_struct(P0, varargin{1});
0044     else
0045         error('sltoolbox:invalidarg', ...
0046             'Invalid input arguments for properties specification');
0047     end
0048 else
0049     n = length(varargin);
0050     nitems = n / 2;
0051     if nitems ~= floor(nitems)  % not an integer
0052         error('sltoolbox:invalidarg', ...
0053             'Invalid input arguments for properties specification');
0054     end
0055     args = reshape(varargin, [2, nitems]);
0056     P = parse_props_from_arglist(P0, args);
0057 end
0058 
0059 
0060 %%------------ parse functions  -----------------
0061 
0062 function P = parse_props_from_struct(P0, S)
0063 
0064 s_names = fieldnames(S);
0065 check_names(P0, s_names);
0066 
0067 n = length(s_names);
0068 P = P0;
0069 for i = 1 : n
0070     curname = s_names{i};
0071     P.(curname) = S.(curname);
0072 end
0073 
0074 
0075 function P = parse_props_from_arglist(P0, args)
0076 
0077 a_names = args(1, :);
0078 check_names(P0, a_names);
0079 
0080 n = length(a_names);
0081 P = P0;
0082 for i = 1 : n
0083     curname = a_names{i};
0084     P.(curname) = args{2, i};
0085 end
0086 
0087 
0088 
0089 function check_names(P0, names)
0090 
0091 n = length(names);
0092 for i = 1 : n
0093     if ~ischar(names{i})
0094         error('Encounter a non-char property name');
0095     end
0096 end
0097 
0098 for i = 1 : n
0099     if ~isfield(P0, names{i})
0100         error('The property name %s is invalid', names{i});
0101     end
0102 end
0103 
0104 
0105 
0106 
0107 
0108 
0109     
0110     
0111     
0112 
0113

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

Contact us at files@mathworks.com