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) 2006-2009 Soeren Sonnenburg 00008 * Copyright (C) 2006-2009 Fraunhofer Institute FIRST and Max-Planck-Society 00009 */ 00010 00011 #ifndef _SVMLIN_H___ 00012 #define _SVMLIN_H___ 00013 00014 #include <shogun/lib/common.h> 00015 #include <shogun/machine/LinearMachine.h> 00016 #include <shogun/features/DotFeatures.h> 00017 #include <shogun/labels/Labels.h> 00018 00019 namespace shogun 00020 { 00022 class CSVMLin : public CLinearMachine 00023 { 00024 public: 00025 00027 MACHINE_PROBLEM_TYPE(PT_BINARY); 00028 00030 CSVMLin(); 00031 00038 CSVMLin( 00039 float64_t C, CDotFeatures* traindat, 00040 CLabels* trainlab); 00041 virtual ~CSVMLin(); 00042 00047 virtual EMachineType get_classifier_type() { return CT_SVMLIN; } 00048 00055 inline void set_C(float64_t c_neg, float64_t c_pos) { C1=c_neg; C2=c_pos; } 00056 00061 inline float64_t get_C1() { return C1; } 00062 00067 inline float64_t get_C2() { return C2; } 00068 00073 inline void set_bias_enabled(bool enable_bias) { use_bias=enable_bias; } 00074 00079 inline bool get_bias_enabled() { return use_bias; } 00080 00085 inline void set_epsilon(float64_t eps) { epsilon=eps; } 00086 00091 inline float64_t get_epsilon() { return epsilon; } 00092 00094 virtual const char* get_name() const { return "SVMLin"; } 00095 00096 protected: 00105 virtual bool train_machine(CFeatures* data=NULL); 00106 00107 protected: 00109 float64_t C1; 00111 float64_t C2; 00113 float64_t epsilon; 00114 00116 bool use_bias; 00117 }; 00118 } 00119 #endif