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 * Copyright (C) 2012 Sergey Lisitsyn 00008 */ 00009 00010 #ifndef FEATUREBLOCKLOGISTICREGRESSION_H_ 00011 #define FEATUREBLOCKLOGISTICREGRESSION_H_ 00012 00013 #include <shogun/lib/config.h> 00014 #include <shogun/lib/IndexBlockRelation.h> 00015 #include <shogun/machine/LinearMachine.h> 00016 00017 namespace shogun 00018 { 00032 class CFeatureBlockLogisticRegression : public CLinearMachine 00033 { 00034 00035 public: 00036 MACHINE_PROBLEM_TYPE(PT_BINARY) 00037 00038 00039 CFeatureBlockLogisticRegression(); 00040 00048 CFeatureBlockLogisticRegression( 00049 float64_t z, CDotFeatures* training_data, 00050 CBinaryLabels* training_labels, CIndexBlockRelation* task_relation); 00051 00053 virtual ~CFeatureBlockLogisticRegression(); 00054 00056 virtual const char* get_name() const 00057 { 00058 return "FeatureBlockLogisticRegression"; 00059 } 00060 00064 CIndexBlockRelation* get_feature_relation() const; 00065 00069 void set_feature_relation(CIndexBlockRelation* feature_relation); 00070 00071 virtual float64_t apply_one(int32_t vec_idx); 00072 00074 int32_t get_max_iter() const; 00076 float64_t get_q() const; 00078 int32_t get_regularization() const; 00080 int32_t get_termination() const; 00082 float64_t get_tolerance() const; 00084 float64_t get_z() const; 00085 00087 void set_max_iter(int32_t max_iter); 00089 void set_q(float64_t q); 00091 void set_regularization(int32_t regularization); 00093 void set_termination(int32_t termination); 00095 void set_tolerance(float64_t tolerance); 00097 void set_z(float64_t z); 00098 00099 protected: 00100 00101 virtual SGVector<float64_t> apply_get_outputs(CFeatures* data); 00102 00104 virtual bool train_machine(CFeatures* data=NULL); 00105 00106 private: 00107 00109 void register_parameters(); 00110 00111 protected: 00112 00114 CIndexBlockRelation* m_feature_relation; 00115 00117 int32_t m_regularization; 00118 00120 int32_t m_termination; 00121 00123 int32_t m_max_iter; 00124 00126 float64_t m_tolerance; 00127 00129 float64_t m_q; 00130 00132 float64_t m_z; 00133 00134 }; 00135 } 00136 #endif