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 Sergey Lisitsyn 00008 * Copyright (C) 2012 Sergey Lisitsyn 00009 */ 00010 00011 #ifndef MULTICLASSTREEGUIDEDLOGISTICREGRESSION_H_ 00012 #define MULTICLASSTREEGUIDEDLOGISTICREGRESSION_H_ 00013 #include <shogun/lib/config.h> 00014 #ifdef HAVE_EIGEN3 00015 #include <shogun/lib/common.h> 00016 #include <shogun/features/DotFeatures.h> 00017 #include <shogun/machine/LinearMulticlassMachine.h> 00018 #include <shogun/lib/IndexBlockTree.h> 00019 00020 namespace shogun 00021 { 00022 00025 class CMulticlassTreeGuidedLogisticRegression : public CLinearMulticlassMachine 00026 { 00027 public: 00028 MACHINE_PROBLEM_TYPE(PT_MULTICLASS) 00029 00030 00031 CMulticlassTreeGuidedLogisticRegression(); 00032 00039 CMulticlassTreeGuidedLogisticRegression(float64_t z, CDotFeatures* feats, CLabels* labs, CIndexBlockTree* tree); 00040 00042 virtual ~CMulticlassTreeGuidedLogisticRegression(); 00043 00045 virtual const char* get_name() const 00046 { 00047 return "MulticlassTreeGuidedLogisticRegression"; 00048 } 00049 00053 inline void set_z(float64_t z) 00054 { 00055 ASSERT(z>0); 00056 m_z = z; 00057 } 00061 inline float64_t get_z() const { return m_z; } 00062 00066 inline void set_epsilon(float64_t epsilon) 00067 { 00068 ASSERT(epsilon>0); 00069 m_epsilon = epsilon; 00070 } 00074 inline float64_t get_epsilon() const { return m_epsilon; } 00075 00079 inline void set_max_iter(int32_t max_iter) 00080 { 00081 ASSERT(max_iter>0); 00082 m_max_iter = max_iter; 00083 } 00087 inline int32_t get_max_iter() const { return m_max_iter; } 00088 00092 inline void set_index_tree(CIndexBlockTree* index_tree) 00093 { 00094 SG_REF(index_tree); 00095 SG_UNREF(m_index_tree); 00096 m_index_tree = index_tree; 00097 } 00101 inline CIndexBlockTree* get_index_tree() const 00102 { 00103 SG_REF(m_index_tree); 00104 return m_index_tree; 00105 } 00106 00107 protected: 00108 00110 virtual bool train_machine(CFeatures* data = NULL); 00111 00112 private: 00113 00115 void init_defaults(); 00116 00118 void register_parameters(); 00119 00120 protected: 00121 00123 CIndexBlockTree* m_index_tree; 00124 00126 float64_t m_z; 00127 00129 float64_t m_epsilon; 00130 00132 int32_t m_max_iter; 00133 00134 }; 00135 } 00136 #endif /* HAVE_EIGEN3 */ 00137 #endif