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 2 of the License, or 00005 * (at your option) any later version. 00006 * 00007 * Written (W) 2007-2009 Christian Widmer 00008 * Copyright (C) 2007-2009 Max-Planck-Society 00009 */ 00010 00011 #ifndef _DomainAdaptation_SVM_H___ 00012 #define _DomainAdaptation_SVM_H___ 00013 00014 00015 #include "lib/common.h" 00016 #include "classifier/svm/SVMLight.h" 00017 00018 #include <stdio.h> 00019 00020 namespace shogun 00021 { 00023 class CDomainAdaptationSVM : public CSVMLight 00024 { 00025 public: 00026 00028 CDomainAdaptationSVM(); 00029 00038 CDomainAdaptationSVM(float64_t C, CKernel* k, CLabels* lab, CSVM* presvm, float64_t B); 00039 00041 virtual ~CDomainAdaptationSVM(); 00042 00048 void init(CSVM* presvm, float64_t B); 00049 00058 virtual bool train(CFeatures* data=NULL); 00059 00064 virtual inline EClassifierType get_classifier_type() { return CT_DASVM; } 00065 00071 virtual CLabels* classify(CFeatures* data); 00072 00077 virtual CSVM* get_presvm(); 00078 00083 virtual float64_t get_B(); 00084 00089 virtual float64_t get_train_factor(); 00090 00094 virtual void set_train_factor(float64_t factor); 00095 00097 inline virtual const char* get_name() const { return "DomainAdaptationSVM"; } 00098 00099 protected: 00100 00105 virtual bool is_presvm_sane(); 00106 00107 private: 00108 void init(); 00109 00110 protected: 00111 00113 CSVM* presvm; 00114 00116 float64_t B; 00117 00119 float64_t train_factor; 00120 }; 00121 } 00122 #endif