ScatterSVM.h

Go to the documentation of this file.
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) 2009 Soeren Sonnenburg
00008  * Written (W) 2009 Marius Kloft
00009  * Copyright (C) 2009 TU Berlin and Max-Planck-Society
00010  */
00011 
00012 #ifndef _SCATTERSVM_H___
00013 #define _SCATTERSVM_H___
00014 
00015 #include <shogun/lib/common.h>
00016 #include <shogun/lib/config.h>
00017 #include <shogun/multiclass/MulticlassSVM.h>
00018 #include <shogun/lib/external/shogun_libsvm.h>
00019 
00020 #include <stdio.h>
00021 
00022 namespace shogun
00023 {
00025     enum SCATTER_TYPE
00026     {
00028         NO_BIAS_LIBSVM,
00029 #ifdef USE_SVMLIGHT
00030 
00031         NO_BIAS_SVMLIGHT,
00032 #endif //USE_SVMLIGHT
00033 
00034         TEST_RULE1,
00036         TEST_RULE2
00037     };
00038 
00053 class CScatterSVM : public CMulticlassSVM
00054 {
00055     public:
00057         CScatterSVM();
00058 
00060         CScatterSVM(SCATTER_TYPE type);
00061 
00068         CScatterSVM(float64_t C, CKernel* k, CLabels* lab);
00069 
00071         virtual ~CScatterSVM();
00072 
00077         virtual EMachineType get_classifier_type() { return CT_SCATTERSVM; }
00078 
00084         virtual float64_t apply(int32_t num);
00085 
00090         virtual CLabels* classify_one_vs_rest();
00091 
00093         virtual const char* get_name() const { return "ScatterSVM"; }
00094 
00095     protected:
00104         virtual bool train_machine(CFeatures* data=NULL);
00105 
00106     private:
00107         void compute_norm_wc();
00108         virtual bool train_no_bias_libsvm();
00109 #ifdef USE_SVMLIGHT
00110         virtual bool train_no_bias_svmlight();
00111 #endif //USE_SVMLIGHT
00112         virtual bool train_testrule12();
00113 
00114     protected:
00116         SCATTER_TYPE scatter_type;
00117 
00119         svm_problem problem;
00121         svm_parameter param;
00122 
00124         struct svm_model* model;
00125 
00127         float64_t* norm_wc;
00128 
00130         float64_t* norm_wcw;
00131 
00133         float64_t rho;
00134 
00136         int32_t m_num_classes;
00137 };
00138 }
00139 #endif // ScatterSVM
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

SHOGUN Machine Learning Toolbox - Documentation