SHOGUN  v3.2.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
SOSVMHelper.h
Go to the documentation of this file.
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) 2013 Shell Hu
00008  * Copyright (C) 2013 Shell Hu
00009  */
00010 
00011 #ifndef __SOSVM_HELPER_H__
00012 #define __SOSVM_HELPER_H__
00013 
00014 #include <shogun/base/SGObject.h>
00015 #include <shogun/lib/SGVector.h>
00016 #include <shogun/structure/StructuredModel.h>
00017 
00018 namespace shogun
00019 {
00020 
00029 class CSOSVMHelper : public CSGObject
00030 {
00031 public:
00033     CSOSVMHelper();
00034 
00039     CSOSVMHelper(int32_t bufsize);
00040 
00042     virtual ~CSOSVMHelper();
00043 
00045     virtual const char* get_name() const { return "SOSVMHelper"; }
00046 
00055     static float64_t primal_objective(SGVector<float64_t> w, CStructuredModel* model, float64_t lbda);
00056 
00066     static float64_t dual_objective(SGVector<float64_t> w, float64_t b_alpha, float64_t lbda);
00067 
00074     static float64_t average_loss(SGVector<float64_t> w, CStructuredModel* model);
00075 
00084     virtual void add_debug_info(float64_t primal, float64_t eff_pass, float64_t train_error,
00085         float64_t dual = -1, float64_t dgap = -1);
00086 
00091     SGVector<float64_t> get_primal_values() const;
00092 
00097     SGVector<float64_t> get_dual_values() const;
00098 
00103     SGVector<float64_t> get_duality_gaps() const;
00104 
00109     SGVector<float64_t> get_eff_passes() const;
00110 
00115     SGVector<float64_t> get_train_errors() const;
00116 
00119     void terminate();
00120 
00121 private:
00123     void init();
00124 
00125 private:
00127     SGVector<float64_t> m_primal;
00128 
00130     SGVector<float64_t> m_dual;
00131 
00133     SGVector<float64_t> m_duality_gap;
00134 
00136     SGVector<float64_t> m_eff_pass;
00137 
00139     SGVector<float64_t> m_train_error;
00140 
00142     int32_t m_tracker;
00143 
00145     int32_t m_bufsize;
00146 
00147 }; /* CSOSVMHelper */
00148 
00149 } /* namespace shogun */
00150 
00151 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

SHOGUN Machine Learning Toolbox - Documentation