00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011 #ifndef _SVRLight_H___
00012 #define _SVRLight_H___
00013
00014 #include <shogun/lib/config.h>
00015 #include <shogun/regression/Regression.h>
00016
00017 #ifdef USE_SVMLIGHT
00018 #include <shogun/classifier/svm/SVMLight.h>
00019 #endif //USE_SVMLIGHT
00020
00021 #ifdef USE_SVMLIGHT
00022 namespace shogun
00023 {
00062 class CSVRLight: public CSVMLight
00063 {
00064 public:
00066 CSVRLight();
00067
00075 CSVRLight(float64_t C, float64_t epsilon, CKernel* k, CLabels* lab);
00076
00078 virtual ~CSVRLight();
00079
00084 virtual EClassifierType get_classifier_type();
00085
00087 void svr_learn();
00088
00098 virtual float64_t compute_objective_function(
00099 float64_t *a, float64_t *lin, float64_t *c, float64_t* eps,
00100 int32_t *label, int32_t totdoc);
00101
00115 virtual void update_linear_component(
00116 int32_t* docs, int32_t *label,
00117 int32_t *active2dnum, float64_t *a, float64_t* a_old,
00118 int32_t *working2dnum, int32_t totdoc,
00119 float64_t *lin, float64_t *aicache, float64_t* c);
00120
00134 virtual void update_linear_component_mkl(
00135 int32_t* docs, int32_t *label,
00136 int32_t *active2dnum, float64_t *a, float64_t* a_old,
00137 int32_t *working2dnum, int32_t totdoc,
00138 float64_t *lin, float64_t *aicache, float64_t* c);
00139
00153 virtual void update_linear_component_mkl_linadd(
00154 int32_t* docs, int32_t *label,
00155 int32_t *active2dnum, float64_t *a, float64_t* a_old,
00156 int32_t *working2dnum, int32_t totdoc,
00157 float64_t *lin, float64_t *aicache, float64_t* c);
00158
00166 void call_mkl_callback(float64_t* a, int32_t* label, float64_t* lin, float64_t* c, int32_t totdoc);
00167
00182 virtual void reactivate_inactive_examples(
00183 int32_t *label,float64_t *a,SHRINK_STATE *shrink_state,
00184 float64_t *lin, float64_t *c, int32_t totdoc,int32_t iteration,
00185 int32_t *inconsistent,
00186 int32_t *docs,float64_t *aicache,
00187 float64_t* maxdiff);
00188
00190 inline virtual const char* get_name() const { return "SVRLight"; }
00191
00192 protected:
00197 static void* update_linear_component_linadd_helper(void *params);
00198
00204 int32_t regression_fix_index(int32_t i);
00205
00212 static int32_t regression_fix_index2(
00213 int32_t i, int32_t num_vectors);
00214
00221 virtual float64_t compute_kernel(int32_t i, int32_t j);
00222
00231 virtual bool train_machine(CFeatures* data=NULL);
00232
00234 int32_t num_vectors;
00235 };
00236 }
00237 #endif //USE_SVMLIGHT
00238 #endif