[mlpack-svn] [MLPACK] #120: Force all machine learning methods to consistent API
MLPACK Trac
trac at coffeetalk-1.cc.gatech.edu
Thu Oct 27 23:11:03 EDT 2011
#120: Force all machine learning methods to consistent API
-------------------------------------+--------------------------------------
Reporter: rcurtin | Owner:
Type: defect | Status: new
Priority: major | Milestone: MLPACK 1.0
Component: MLPACK | Resolution:
Keywords: consistent api methods | Blocking:
Blocked By: 118, 152, 153, 154 |
-------------------------------------+--------------------------------------
Comment (by nslagle):
Interestingly, in reading about
[http://en.wikipedia.org/wiki/Policy_based_design policy-based design in
C++], I learned that a standard approach ''is'' to use inheritance and
multiple inheritance to promote functionality sharing. I agree that the
logger (and per our more recent discussion, the CLI) should not be classes
from which ''MLMethods'' derive, I think that a base ''MLMethod'' class
would contain save/load functionality with protected
read/write/saveParam/loadParam methods, a private XML tree traverser (as
is currently in the code), and a virtual pair of SaveModel and LoadModel
defined as dummy ''return true'' statements. This permits later classes
to override them if desired, but if a method down below has no need of
saving and loading, it can simply ignore these methods.
So we might have something like this:
{{{
MLMethod (save/load functionality, method name variable)
. . .
. . .
. . .
MLClassifier MLRegressor MLDensityEstimator
}}}
''MLDensityEstimators'' would include a KDE using dual-tree, under which
we'd have KCDE using dual-tree. Other sibling classes would later include
some ideas I plan to spring on Alex later on (though we've discussed them
briefly this semester).
Each of these classes and subclasses would continue to take template
arguments for kernels, tree-types, etc, but have the advantage of sharing
code.
In the context of this ticket, the uniform API across all descendants of
''MLMethod'' currently would include (as it should anyway) a SaveModel and
a LoadModel function.
So let the fireworks begin!
--
Ticket URL: <http://trac.research.cc.gatech.edu/fastlab/ticket/120#comment:20>
MLPACK <www.fast-lab.org>
MLPACK is an intuitive, fast, and scalable C++ machine learning library developed by the FASTLAB at Georgia Tech under Dr. Alex Gray.
More information about the mlpack-svn
mailing list