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 MACHINE_PROBLEM_TYPE(PT_REGRESSION);
00067
00069 CSVRLight();
00070
00078 CSVRLight(float64_t C, float64_t epsilon, CKernel* k, CLabels* lab);
00079
00081 virtual ~CSVRLight();
00082
00087 virtual EMachineType get_classifier_type();
00088
00090 void svr_learn();
00091
00101 virtual float64_t compute_objective_function(
00102 float64_t *a, float64_t *lin, float64_t *c, float64_t* eps,
00103 int32_t *label, int32_t totdoc);
00104
00118 virtual void update_linear_component(
00119 int32_t* docs, int32_t *label,
00120 int32_t *active2dnum, float64_t *a, float64_t* a_old,
00121 int32_t *working2dnum, int32_t totdoc,
00122 float64_t *lin, float64_t *aicache, float64_t* c);
00123
00137 virtual void update_linear_component_mkl(
00138 int32_t* docs, int32_t *label,
00139 int32_t *active2dnum, float64_t *a, float64_t* a_old,
00140 int32_t *working2dnum, int32_t totdoc,
00141 float64_t *lin, float64_t *aicache, float64_t* c);
00142
00156 virtual void update_linear_component_mkl_linadd(
00157 int32_t* docs, int32_t *label,
00158 int32_t *active2dnum, float64_t *a, float64_t* a_old,
00159 int32_t *working2dnum, int32_t totdoc,
00160 float64_t *lin, float64_t *aicache, float64_t* c);
00161
00169 void call_mkl_callback(float64_t* a, int32_t* label, float64_t* lin, float64_t* c, int32_t totdoc);
00170
00185 virtual void reactivate_inactive_examples(
00186 int32_t *label,float64_t *a,SHRINK_STATE *shrink_state,
00187 float64_t *lin, float64_t *c, int32_t totdoc,int32_t iteration,
00188 int32_t *inconsistent,
00189 int32_t *docs,float64_t *aicache,
00190 float64_t* maxdiff);
00191
00193 virtual const char* get_name() const { return "SVRLight"; }
00194
00195 protected:
00200 static void* update_linear_component_linadd_helper(void *params);
00201
00207 int32_t regression_fix_index(int32_t i);
00208
00215 static int32_t regression_fix_index2(
00216 int32_t i, int32_t num_vectors);
00217
00224 virtual float64_t compute_kernel(int32_t i, int32_t j);
00225
00234 virtual bool train_machine(CFeatures* data=NULL);
00235
00237 int32_t num_vectors;
00238 };
00239 }
00240 #endif //USE_SVMLIGHT
00241 #endif