[mlpack] (GSoC) AdaBoost degsin Ideas & C++11 features - 2 (MingJun Liu)

Mj Liu noodleslik at gmail.com
Sat Mar 15 09:22:31 EDT 2014


Hi All,
    Last time I proposed some ideas on command line interface(CLI), and
mentioned the problem of designing unified interface in AdaBoost  for weak
learner algorithms. To build an unified interface to all of the weak
learners is really a challange. Cheerfully, Ryan Curtin mentioned using
C++11 new feature -- varadic templates last time.
    I have read something about such feature, and found that combining
varadic template with function & bind these three features in C++11, we can
provide a interface like:

templaste<typename MatType, typename WeakLearnerReturnType, ...>
class AdaBoost
{
  public:
    //...

    void set_weak_learner(
               std::function<WeakLearnerReturnType ()> f)
     {
         weak_learner_funtion = std::bind(f);
     }
     //...
  private:
    std::function<WeakLearnerReturnType ()> weak_learner_funtion;
    //...
};
int main(int agc, char *argv[]) {
//...
std::function<SpecifiedWeakLearnerReturnType(MatType)> weak_learner_func ;

weak_learner_func = std::bind(WeakLearnerClassInstance.learn_func(MatType,
otherArgs);

AdaBoostInstace.set_weak_learner(weak_learner_func);
//...
}


     As to the problem how implement AdaBoost with multi-thread, I think
that if we are going to use C++11, then using the new feature thread in
C++11 will be a very well option, since it does not need libraries outside
STL. And also, since Boost library contains the thread feature, it's also
an option. Comparing to OpenMP, I think Boost library or C++11 need more
specific .
      Here<http://software.intel.com/en-us/articles/choosing-the-right-threading-framework>
 and here<http://www10.informatik.uni-erlangen.de/Teaching/Courses/SS2011/CPP/czilli.pdf>
are
articles  comparing OpenMP v.s. C++11/Boost. These two took expriments, and
the results implies OpenMP both present feasible performance and simplicity
in codes. So, I think OpenMP would be an option for multi-thread framework
in MLPACK.

    I think it's time for us to take it seriously to talk about whether we
shall introduce C++11 features into MLPACK library. Benifits and Drawback
will both present, the key is how to get the best balance of such movements.
    Here, I present some ideas and hope more can join the discussion.
Though, there were many debates in the network on the topic of benefit &
drawback of introducing C++11. I think we shall concern something about the
usage of mlpack, like bellowings.
        *  who is using the mlpack,
        *  how many and the ratio of users using compilers supporting
           C++11,
        *  what will the users suffer if they move to compilers supporting
C++11,
        *  was implement MLPACK using selected C++11 features doable
     All above is to find out what impact will it be if we move mlpack to
C++11.
     There were too much we shall to know before moving to C++11, but we
shall make a move now I think. more and more compilers are supporting
features of C++11 now, and sooner or later all of the users vill move to
these compilers, if the move can bring much benefits why not do something
now?
      Any comments  are appreciated. And I think more discussion will draw
the final implemention near.
      Best Regards!
      MingJun Liu
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.cc.gatech.edu/pipermail/mlpack/attachments/20140315/554bf8ee/attachment-0002.html>


More information about the mlpack mailing list