SHOGUN
v3.2.0
|
00001 /* 00002 * This program is free software; you can redistribute it and/or modify 00003 * it under the terms of the GNU General Public License as published by 00004 * the Free Software Foundation; either version 3 of the License, or 00005 * (at your option) any later version. 00006 * 00007 * Written (W) 2012 Chiyuan Zhang 00008 * Copyright (C) 2012 Chiyuan Zhang 00009 */ 00010 00011 #ifndef SHAREBOOSTOPTIMIZER_H__ 00012 #define SHAREBOOSTOPTIMIZER_H__ 00013 00014 #include <shogun/multiclass/ShareBoost.h> 00015 00016 namespace shogun 00017 { 00018 00020 class ShareBoostOptimizer 00021 { 00022 public: 00024 ShareBoostOptimizer(CShareBoost *sb, bool verbose=false) 00025 :m_sb(sb), m_verbose(verbose) { SG_REF(m_sb); } 00027 ~ShareBoostOptimizer() { SG_UNREF(m_sb); } 00028 00030 void optimize(); 00031 private: 00033 static float64_t lbfgs_evaluate(void *userdata, const float64_t *W, float64_t *grad, const int32_t n, const float64_t step); 00034 00036 static int lbfgs_progress( 00037 void *instance, 00038 const float64_t *x, 00039 const float64_t *g, 00040 const float64_t fx, 00041 const float64_t xnorm, 00042 const float64_t gnorm, 00043 const float64_t step, 00044 int n, 00045 int k, 00046 int ls 00047 ); 00048 00049 CShareBoost *m_sb; 00050 bool m_verbose; 00051 }; 00052 00053 } /* shogun */ 00054 00055 #endif /* end of include guard: SHAREBOOSTOPTIMIZER_H__ */ 00056