[mlpack-svn] [MLPACK] #318: refactor LRSDP into separate LRSDPFunction class

MLPACK Trac trac at coffeetalk-1.cc.gatech.edu
Tue Jan 28 15:48:31 EST 2014


#318: refactor LRSDP into separate LRSDPFunction class
---------------------+------------------------------------------------------
 Reporter:  rcurtin  |        Owner:                           
     Type:  defect   |       Status:  new                      
 Priority:  trivial  |    Milestone:                           
Component:  mlpack   |     Keywords:  lrsdp, api, auglagrangian
 Blocking:           |   Blocked By:                           
---------------------+------------------------------------------------------
 The LRSDP class (src/mlpack/core/optimizers/lrsdp/lrsdp.hpp) is an
 optimizer implementing a low-rank semidefinite program solver that uses
 the augmented Lagrangian optimizer
 (src/mlpack/core/optimizers/aug_langrangian/aug_lagrangian.hpp).  The way
 the AugLagrangian class is set up is that it optimizes a
 AugLagrangianFunction class, and the AugLagrangianFunction class takes a
 FunctionType as a template parameter, and this FunctionType is the LRSDP
 class.

 So you end up with a situation where LRSDP holds an object of type

 {{{
 AugLagrangian<LRSDP>
 }}}

 which in turn holds an object of type

 {{{
 AugLagrangianFunction<LRSDP>
 }}}

 A template parameter to AugLagrangianFunction must implement the following
 functions:

 {{{
 - double Evaluate()
 - void Gradient(...)
 - double EvaluateConstraint()
 - void GradientConstraint(...)
 }}}

 So the LRSDP class must expose those four functions publicly for the whole
 thing to work.  But this is confusing to users, who notice that the LRSDP
 class has these four functions, but they shouldn't call them, because
 those functions are only implemented as template specializations of
 AugLagrangianFunction<LRSDP>::Evaluate() and
 AugLagrangianFunction<LRSDP>::Gradient() (if you just call
 LRSDP::Evaluate(), it will throw an error).

 A better class design could prevent this problem, by putting those four
 functions into a separate class, so that a user who creates an LRSDP
 object does not see those four functions.

-- 
Ticket URL: <http://trac.research.cc.gatech.edu/fastlab/ticket/318>
MLPACK <www.fast-lab.org>
MLPACK is an intuitive, fast, and scalable C++ machine learning library developed at Georgia Tech.


More information about the mlpack-svn mailing list