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 Mikio L. Braun 00008 * Written (W) 1999-2009 Soeren Sonnenburg 00009 * Copyright (C) 1999-2009 Fraunhofer Institute FIRST and Max-Planck-Society 00010 */ 00011 00012 #ifndef _KRR_H__ 00013 #define _KRR_H__ 00014 00015 #include <shogun/lib/config.h> 00016 #include <shogun/regression/Regression.h> 00017 00018 #ifdef HAVE_LAPACK 00019 00020 #include <shogun/machine/KernelMachine.h> 00021 00022 namespace shogun 00023 { 00054 class CKRR : public CKernelMachine 00055 { 00056 public: 00058 CKRR(); 00059 00066 CKRR(float64_t tau, CKernel* k, CLabels* lab); 00067 virtual ~CKRR(); 00068 00073 inline void set_tau(float64_t t) { tau = t; }; 00074 00079 virtual CLabels* apply(); 00080 00086 virtual float64_t apply(int32_t num); 00087 00093 virtual bool load(FILE* srcfile); 00094 00100 virtual bool save(FILE* dstfile); 00101 00106 inline virtual EClassifierType get_classifier_type() 00107 { 00108 return CT_KRR; 00109 } 00110 00112 inline virtual const char* get_name() const { return "KRR"; } 00113 00114 protected: 00123 virtual bool train_machine(CFeatures* data=NULL); 00124 00125 private: 00127 float64_t *alpha; 00129 float64_t tau; 00130 }; 00131 } 00132 #endif // HAVE_LAPACK 00133 #endif // _KRR_H__