SHOGUN
v1.1.0
|
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/classifier/svm/MultiClassSVM.h> 00018 #include <shogun/classifier/svm/SVM_libsvm.h> 00019 00020 #include <stdio.h> 00021 00022 namespace shogun 00023 { 00025 enum SCATTER_TYPE 00026 { 00028 NO_BIAS_LIBSVM, 00029 00031 TEST_RULE1, 00033 TEST_RULE2 00034 }; 00035 00050 class CScatterSVM : public CMultiClassSVM 00051 { 00052 public: 00054 CScatterSVM(); 00055 00057 CScatterSVM(SCATTER_TYPE type); 00058 00065 CScatterSVM(float64_t C, CKernel* k, CLabels* lab); 00066 00068 virtual ~CScatterSVM(); 00069 00074 virtual inline EClassifierType get_classifier_type() { return CT_SCATTERSVM; } 00075 00081 virtual float64_t apply(int32_t num); 00082 00087 virtual CLabels* classify_one_vs_rest(); 00088 00090 inline virtual const char* get_name() const { return "ScatterSVM"; } 00091 00092 protected: 00101 virtual bool train_machine(CFeatures* data=NULL); 00102 00103 private: 00104 void compute_norm_wc(); 00105 virtual bool train_no_bias_libsvm(); 00106 00107 virtual bool train_testrule12(); 00108 00109 protected: 00111 SCATTER_TYPE scatter_type; 00112 00114 svm_problem problem; 00116 svm_parameter param; 00117 00119 struct svm_model* model; 00120 00122 float64_t* norm_wc; 00123 00125 float64_t* norm_wcw; 00126 00128 float64_t rho; 00129 00131 int32_t m_num_classes; 00132 }; 00133 } 00134 #endif // ScatterSVM