SHOGUN v0.9.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 "lib/common.h" 00016 #include "lib/config.h" 00017 #include "classifier/svm/MultiClassSVM.h" 00018 #include "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(void); 00055 00057 CScatterSVM(SCATTER_TYPE type); 00058 00065 CScatterSVM(float64_t C, CKernel* k, CLabels* lab); 00066 00068 virtual ~CScatterSVM(); 00069 00078 virtual bool train(CFeatures* data=NULL); 00079 00084 virtual inline EClassifierType get_classifier_type() { return CT_SCATTERSVM; } 00085 00091 virtual float64_t classify_example(int32_t num); 00092 00097 virtual CLabels* classify_one_vs_rest(); 00098 00100 inline virtual const char* get_name() const { return "ScatterSVM"; } 00101 00102 private: 00103 void compute_norm_wc(); 00104 virtual bool train_no_bias_libsvm(); 00105 00106 virtual bool train_testrule12(); 00107 00108 protected: 00110 SCATTER_TYPE scatter_type; 00111 00113 svm_problem problem; 00115 svm_parameter param; 00116 00118 struct svm_model* model; 00119 00121 float64_t* norm_wc; 00122 00124 float64_t* norm_wcw; 00125 00127 float64_t rho; 00128 00130 int32_t m_num_classes; 00131 }; 00132 } 00133 #endif // ScatterSVM