Go to the documentation of this file.00001 #ifndef _SGDQN_H___
00002 #define _SGDQN_H___
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 #include <shogun/lib/common.h>
00026 #include <shogun/machine/LinearMachine.h>
00027 #include <shogun/features/DotFeatures.h>
00028 #include <shogun/features/Labels.h>
00029 #include <shogun/loss/LossFunction.h>
00030
00031 namespace shogun
00032 {
00034 class CSGDQN : public CLinearMachine
00035 {
00036 public:
00038 CSGDQN();
00039
00044 CSGDQN(float64_t C);
00045
00052 CSGDQN(
00053 float64_t C, CDotFeatures* traindat,
00054 CLabels* trainlab);
00055
00056 virtual ~CSGDQN();
00057
00062 virtual inline EClassifierType get_classifier_type() { return CT_SGDQN; }
00063
00072 virtual bool train(CFeatures* data=NULL);
00073
00080 inline void set_C(float64_t c_neg, float64_t c_pos) { C1=c_neg; C2=c_pos; }
00081
00086 inline float64_t get_C1() { return C1; }
00087
00092 inline float64_t get_C2() { return C2; }
00093
00098 inline void set_epochs(int32_t e) { epochs=e; }
00099
00104 inline int32_t get_epochs() { return epochs; }
00105
00107 void compute_ratio(float64_t* W,float64_t* W_1,float64_t* B,float64_t* dst,int32_t dim,float64_t regularizer_lambda,float64_t loss);
00108
00110 void combine_and_clip(float64_t* Bc,float64_t* B,int32_t dim,float64_t c1,float64_t c2,float64_t v1,float64_t v2);
00111
00116 void set_loss_function(CLossFunction* loss_func);
00117
00122 inline CLossFunction* get_loss_function() { SG_REF(loss); return loss; }
00123
00125 inline virtual const char* get_name() const { return "SGDQN"; }
00126
00127 protected:
00129 void calibrate();
00130
00131 private:
00132 void init();
00133
00134 private:
00135 float64_t t;
00136 float64_t C1;
00137 float64_t C2;
00138 int32_t epochs;
00139 int32_t skip;
00140 int32_t count;
00141
00142 CLossFunction* loss;
00143 };
00144 }
00145 #endif