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 slreevallearn
Home > sltoolbox > learn > slreevallearn.m

slreevallearn

PURPOSE ^

SLREEVALLEARN Performs an iterative learning based on re-evaluation

SYNOPSIS ^

function [models, Q, info] = slreevallearn(models, Q, data, estfunctor, evalfunctor, cmpfunctor, varargin)

DESCRIPTION ^

SLREEVALLEARN Performs an iterative learning based on re-evaluation

 $ Syntax $
   - [models, Q] = slreevallearn(models, data, estfunctor, evalfunctor, cmpfunctor, ...)
   - [models, Q, info] = slreevallearn(models, data, estfunctor, evalfunctor, cmpfunctor, ...)

 $ Arguments $
   - models:       the models to learn
                   input one: the initial model
                   output one: the learned model
   - Q:            the evaluated quantities on the data
   - data:         the data (samples) to learn from
   - estfunctor:   the functor to estimate/update model, in the form:
                   models = f(models, data, Q, ...)
                   If the process is recorded, it is like:
                   [models, rec] = f(models, data, Q, ...)
   - evalfunctor:  the functor to evaluate/update the quantities, like:
                   Q = f(models, data, Q, ...)
   - cmpfunctor:   the functor to judge convergence, like:
                   isconverged = f(models_prev, models, Q_prev, Q, ...)
   - info:         The information of the iteration process

 $ Description $
   - [models, Q] = slreevallearn(models, data, estfunctor, evalfunctor, cmpfunctor, ...) 
     implements a skeleton of learning procedure based on re-evaluation.
     The procedure alternates the model estimation based on data and 
     corresponding evaluated quantities, and the evaluation by applying
     models to data to get quantities.
     \*
     \t   Table. The Properties of Re-evaluating Learning
     \h    name        &   description
          'iter'       & The iteration control properties. default = {}
          'isrecorded' & whether the model estimation is recorded
                         default = false;
          'verbose'    & whether to show progress, default = true
     \*
   
 $ Remarks $
   - It is implemented based on sliterproc.

   - It essentially serves as the core of many learning paradigms, 
     such as E-M method of finite mixture model learning, AdaBoost,
     K-means, robust subspace learning, etc.

 $ History $
   - Created by Dahua Lin, on Aug 31, 2006

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:
  • slkmeansex SLKMEANSEX Performs Generalized K-means
  • slfmm SLFMM Learns a Finite Mixture Model (FMM)

SUBFUNCTIONS ^

SOURCE CODE ^

0001 function [models, Q, info] = slreevallearn(models, Q, data, estfunctor, evalfunctor, cmpfunctor, varargin)
0002 %SLREEVALLEARN Performs an iterative learning based on re-evaluation
0003 %
0004 % $ Syntax $
0005 %   - [models, Q] = slreevallearn(models, data, estfunctor, evalfunctor, cmpfunctor, ...)
0006 %   - [models, Q, info] = slreevallearn(models, data, estfunctor, evalfunctor, cmpfunctor, ...)
0007 %
0008 % $ Arguments $
0009 %   - models:       the models to learn
0010 %                   input one: the initial model
0011 %                   output one: the learned model
0012 %   - Q:            the evaluated quantities on the data
0013 %   - data:         the data (samples) to learn from
0014 %   - estfunctor:   the functor to estimate/update model, in the form:
0015 %                   models = f(models, data, Q, ...)
0016 %                   If the process is recorded, it is like:
0017 %                   [models, rec] = f(models, data, Q, ...)
0018 %   - evalfunctor:  the functor to evaluate/update the quantities, like:
0019 %                   Q = f(models, data, Q, ...)
0020 %   - cmpfunctor:   the functor to judge convergence, like:
0021 %                   isconverged = f(models_prev, models, Q_prev, Q, ...)
0022 %   - info:         The information of the iteration process
0023 %
0024 % $ Description $
0025 %   - [models, Q] = slreevallearn(models, data, estfunctor, evalfunctor, cmpfunctor, ...)
0026 %     implements a skeleton of learning procedure based on re-evaluation.
0027 %     The procedure alternates the model estimation based on data and
0028 %     corresponding evaluated quantities, and the evaluation by applying
0029 %     models to data to get quantities.
0030 %     \*
0031 %     \t   Table. The Properties of Re-evaluating Learning
0032 %     \h    name        &   description
0033 %          'iter'       & The iteration control properties. default = {}
0034 %          'isrecorded' & whether the model estimation is recorded
0035 %                         default = false;
0036 %          'verbose'    & whether to show progress, default = true
0037 %     \*
0038 %
0039 % $ Remarks $
0040 %   - It is implemented based on sliterproc.
0041 %
0042 %   - It essentially serves as the core of many learning paradigms,
0043 %     such as E-M method of finite mixture model learning, AdaBoost,
0044 %     K-means, robust subspace learning, etc.
0045 %
0046 % $ History $
0047 %   - Created by Dahua Lin, on Aug 31, 2006
0048 %
0049 
0050 %% parse and verify input
0051 
0052 if nargin < 6
0053     raise_lackinput('slreevallearn', 6);
0054 end
0055 
0056 opts.iter = {};
0057 opts.isrecorded = false;
0058 opts.verbose = true;
0059 opts = slparseprops(opts, varargin{:});
0060 
0061 %% Main
0062 
0063 slsharedisp_attach('slreevallearn', 'show', opts.verbose);
0064 
0065 slsharedisp('Learning by re-evaluation');
0066 
0067 objects = {models, data, Q};
0068 iterfunctor = {@reevallearn_iter, estfunctor, evalfunctor, opts};
0069 cmpfunctor = {@reevallearn_cmp, cmpfunctor};
0070 if nargout < 2
0071     objects = ...
0072         sliterproc(objects, iterfunctor, cmpfunctor, opts.isrecorded, opts.iter{:});
0073 else
0074     [objects, info] = ...
0075         sliterproc(objects, iterfunctor, cmpfunctor, opts.isrecorded, opts.iter{:});
0076 end
0077 
0078 models = objects{1};
0079 Q = objects{3};
0080 
0081 slsharedisp_detach();
0082 
0083 
0084 %% Iteration functors
0085 
0086 function varargout = reevallearn_iter(objects, estfunctor, evalfunctor, opts)
0087 % objects = {models, data, Q}
0088 
0089 [models, data, Q] = deal(objects{:});
0090 
0091 if ~opts.isrecorded
0092     models = slevalfunctor(estfunctor, models, data, Q);
0093 else
0094     [models, info] = slevalfunctor(estfunctor, models, data, Q);
0095 end
0096 Q = slevalfunctor(evalfunctor, models, data, Q);
0097 
0098 objects = {models, data, Q};
0099 
0100 if ~opts.isrecorded
0101     varargout = {objects};
0102 else
0103     varargout = {objects, info};
0104 end
0105 
0106 
0107 function isconverged = reevallearn_cmp(objects_prev, objects, cmpfunctor)
0108 
0109 models_prev = objects_prev{1};
0110 Q_prev = objects_prev{3};
0111 models = objects{1};
0112 Q = objects{3};
0113 
0114 isconverged = slevalfunctor(cmpfunctor, models_prev, models, Q_prev, Q);
0115 
0116 
0117 
0118 
0119 
0120 
0121 
0122 
0123 
0124 
0125

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

Contact us at files@mathworks.com