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 #ifndef _DomainAdaptation_SVM_LINEAR_H___ 00012 #define _DomainAdaptation_SVM_LINEAR_H___ 00013 00014 #include <shogun/lib/common.h> 00015 #include <shogun/classifier/svm/LibLinear.h> 00016 00017 #include <stdio.h> 00018 00019 namespace shogun 00020 { 00021 00022 #ifdef HAVE_LAPACK 00023 00025 class CDomainAdaptationSVMLinear : public CLibLinear 00026 { 00027 00028 public: 00029 00031 CDomainAdaptationSVMLinear(); 00032 00033 00042 CDomainAdaptationSVMLinear(float64_t C, CDotFeatures* f, CLabels* lab, CLinearMachine* presvm, float64_t B); 00043 00044 00046 virtual ~CDomainAdaptationSVMLinear(); 00047 00048 00054 void init(CLinearMachine* presvm, float64_t B); 00055 00060 virtual EMachineType get_classifier_type() { return CT_DASVMLINEAR; } 00061 00062 00068 virtual CBinaryLabels* apply_binary(CFeatures* data=NULL); 00069 00070 00075 virtual CLinearMachine* get_presvm(); 00076 00077 00082 virtual float64_t get_B(); 00083 00084 00089 virtual float64_t get_train_factor(); 00090 00091 00095 virtual void set_train_factor(float64_t factor); 00096 00102 //virtual std::vector<float64_t> get_linear_term(); 00103 00104 00105 /* 00106 * set linear term of the QP 00107 * 00108 * @param lin the linear term 00109 */ 00110 //virtual void set_linear_term(std::vector<float64_t> lin); 00111 00112 00114 virtual const char* get_name() const { return "DomainAdaptationSVMLinear"; } 00115 00116 protected: 00117 00122 virtual bool is_presvm_sane(); 00123 00132 virtual bool train_machine(CFeatures* data=NULL); 00133 00134 protected: 00135 00137 CLinearMachine* presvm; 00138 00139 00141 float64_t B; 00142 00143 00145 float64_t train_factor; 00146 00147 00148 }; 00149 #endif //HAVE_LAPACK 00150 00151 } /* namespace shogun */ 00152 00153 #endif //_DomainAdaptation_SVM_LINEAR_H___