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 MULTICLASSLOGISTICREGRESSION_H_ 00012 #define MULTICLASSLOGISTICREGRESSION_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 00019 namespace shogun 00020 { 00021 00025 class CMulticlassLogisticRegression : public CLinearMulticlassMachine 00026 { 00027 public: 00028 MACHINE_PROBLEM_TYPE(PT_MULTICLASS) 00029 00030 00031 CMulticlassLogisticRegression(); 00032 00038 CMulticlassLogisticRegression(float64_t z, CDotFeatures* feats, CLabels* labs); 00039 00041 virtual ~CMulticlassLogisticRegression(); 00042 00044 virtual const char* get_name() const 00045 { 00046 return "MulticlassLogisticRegression"; 00047 } 00048 00052 inline void set_z(float64_t z) 00053 { 00054 ASSERT(z>0); 00055 m_z = z; 00056 } 00060 inline float64_t get_z() const { return m_z; } 00061 00065 inline void set_epsilon(float64_t epsilon) 00066 { 00067 ASSERT(epsilon>0); 00068 m_epsilon = epsilon; 00069 } 00073 inline float64_t get_epsilon() const { return m_epsilon; } 00074 00078 inline void set_max_iter(int32_t max_iter) 00079 { 00080 ASSERT(max_iter>0); 00081 m_max_iter = max_iter; 00082 } 00086 inline int32_t get_max_iter() const { return m_max_iter; } 00087 00088 protected: 00089 00091 virtual bool train_machine(CFeatures* data = NULL); 00092 00093 private: 00094 00096 void init_defaults(); 00097 00099 void register_parameters(); 00100 00101 protected: 00102 00104 float64_t m_z; 00105 00107 float64_t m_epsilon; 00108 00110 int32_t m_max_iter; 00111 00112 }; 00113 } 00114 #endif /* HAVE_EIGEN3 */ 00115 #endif