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) 1999-2009 Soeren Sonnenburg 00008 * Written (W) 1999-2008 Gunnar Raetsch 00009 * Copyright (C) 1999-2009 Fraunhofer Institute FIRST and Max-Planck-Society 00010 */ 00011 00012 #ifndef _CFKFEATURES__H__ 00013 #define _CFKFEATURES__H__ 00014 00015 #include "features/SimpleFeatures.h" 00016 #include "distributions/HMM.h" 00017 00018 namespace shogun 00019 { 00020 00021 template <class T> class CSimpleFeatures; 00022 class CHMM; 00023 00041 class CFKFeatures: public CSimpleFeatures<float64_t> 00042 { 00043 public: 00050 CFKFeatures(int32_t size, CHMM* p, CHMM* n); 00051 00053 CFKFeatures(const CFKFeatures &orig); 00054 00055 virtual ~CFKFeatures(); 00056 00062 void set_models(CHMM* p, CHMM* n); 00063 00068 inline void set_a(float64_t a) 00069 { 00070 weight_a=a; 00071 } 00072 00077 inline float64_t get_a() 00078 { 00079 return weight_a; 00080 } 00081 00086 virtual float64_t* set_feature_matrix(); 00087 00093 float64_t set_opt_a(float64_t a=-1); 00094 00099 inline float64_t get_weight_a() { return weight_a; }; 00100 00102 inline virtual const char* get_name() const { return "FKFeatures"; } 00103 00104 protected: 00112 virtual float64_t* compute_feature_vector( 00113 int32_t num, int32_t& len, float64_t* target=NULL); 00114 00121 void compute_feature_vector(float64_t* addr, int32_t num, int32_t& len); 00122 00128 float64_t deriv_a(float64_t a, int32_t dimension=-1) ; 00129 00130 protected: 00132 CHMM* pos; 00134 CHMM* neg; 00136 float64_t* pos_prob; 00138 float64_t* neg_prob; 00140 float64_t weight_a; 00141 }; 00142 } 00143 #endif