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) 2007-2011 Christian Widmer 00008 * Copyright (C) 2007-2011 Max-Planck-Society 00009 */ 00010 00011 #ifdef USE_SVMLIGHT 00012 00013 #ifndef _DomainAdaptation_SVM_H___ 00014 #define _DomainAdaptation_SVM_H___ 00015 00016 00017 #include <shogun/lib/common.h> 00018 #include <shogun/classifier/svm/SVMLight.h> 00019 00020 #include <stdio.h> 00021 00022 namespace shogun 00023 { 00025 class CDomainAdaptationSVM : public CSVMLight 00026 { 00027 public: 00028 00030 CDomainAdaptationSVM(); 00031 00040 CDomainAdaptationSVM(float64_t C, CKernel* k, CLabels* lab, CSVM* presvm, float64_t B); 00041 00043 virtual ~CDomainAdaptationSVM(); 00044 00050 void init(CSVM* presvm, float64_t B); 00051 00056 virtual EMachineType get_classifier_type() { return CT_DASVM; } 00057 00063 virtual CBinaryLabels* apply_binary(CFeatures* data=NULL); 00064 00069 virtual CSVM* get_presvm(); 00070 00075 virtual float64_t get_B(); 00076 00081 virtual float64_t get_train_factor(); 00082 00086 virtual void set_train_factor(float64_t factor); 00087 00089 virtual const char* get_name() const { return "DomainAdaptationSVM"; } 00090 00091 protected: 00092 00097 virtual bool is_presvm_sane(); 00098 00107 virtual bool train_machine(CFeatures* data=NULL); 00108 00109 private: 00110 void init(); 00111 00112 protected: 00113 00115 CSVM* presvm; 00116 00118 float64_t B; 00119 00121 float64_t train_factor; 00122 }; 00123 } 00124 #endif //_DomainAdaptation_SVM_H___ 00125 #endif //USE_SVMLIGHT