DomainAdaptationSVMLinear.h

Go to the documentation of this file.
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-2010 Christian Widmer
00008  * Copyright (C) 2007-2010 Max-Planck-Society
00009  */
00010 
00011 #ifndef _DomainAdaptation_SVM_LINEAR_H___
00012 #define _DomainAdaptation_SVM_LINEAR_H___
00013 
00014 #include "lib/common.h"
00015 #include "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, CLinearClassifier* presvm, float64_t B);
00043 
00044 
00046         virtual ~CDomainAdaptationSVMLinear();
00047 
00048 
00054         void init(CLinearClassifier* presvm, float64_t B);
00055 
00056 
00057 
00066         virtual bool train(CDotFeatures* data=NULL);
00067 
00068 
00073         virtual inline EClassifierType get_classifier_type() { return CT_DASVMLINEAR; }
00074 
00075 
00081         virtual CLabels* classify(CDotFeatures* data);
00082 
00083 
00088         virtual CLinearClassifier* get_presvm();
00089 
00090 
00095         virtual float64_t get_B();
00096 
00097 
00102         virtual float64_t get_train_factor();
00103 
00104 
00108         virtual void set_train_factor(float64_t factor);
00109 
00115         //virtual std::vector<float64_t> get_linear_term();
00116 
00117 
00123         //virtual void set_linear_term(std::vector<float64_t> lin);
00124 
00125 
00127         inline virtual const char* get_name() const { return "DomainAdaptationSVMLinear"; }
00128 
00129     protected:
00130 
00135         virtual bool is_presvm_sane();
00136 
00137 
00139         CLinearClassifier* presvm;
00140 
00141 
00143         float64_t B;
00144 
00145 
00147         float64_t train_factor;
00148 
00149 
00150 };
00151 
00152 #else /* HAVE_LAPACK  */
00153 
00154 #define IGNORE_IN_CLASSLIST
00155 IGNORE_IN_CLASSLIST class CDomainAdaptationSVMLinear :public CLibLinear
00156 {
00157 public:
00159     CDomainAdaptationSVMLinear(void) {}
00160 
00162     inline virtual const char* get_name() const {
00163         return "DomainAdaptationSVMLinear";
00164     }
00165 };
00166 
00167 #endif //HAVE_LAPACK
00168 
00169 } /* namespace shogun  */
00170 
00171 #endif //_DomainAdaptation_SVM_LINEAR_H___
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

SHOGUN Machine Learning Toolbox - Documentation