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/HMM.h" 00017 00035 class CFKFeatures: public CSimpleFeatures<float64_t> 00036 { 00037 public: 00044 CFKFeatures(int32_t size, CHMM* p, CHMM* n); 00045 00047 CFKFeatures(const CFKFeatures &orig); 00048 00049 virtual ~CFKFeatures(); 00050 00056 void set_models(CHMM* p, CHMM* n); 00057 00062 inline void set_a(float64_t a) 00063 { 00064 weight_a=a; 00065 } 00066 00071 inline float64_t get_a() 00072 { 00073 return weight_a; 00074 } 00075 00080 virtual float64_t* set_feature_matrix(); 00081 00087 float64_t set_opt_a(float64_t a=-1); 00088 00093 inline float64_t get_weight_a() { return weight_a; }; 00094 00096 inline virtual const char* get_name() const { return "FKFeatures"; } 00097 00098 protected: 00106 virtual float64_t* compute_feature_vector( 00107 int32_t num, int32_t& len, float64_t* target=NULL); 00108 00115 void compute_feature_vector(float64_t* addr, int32_t num, int32_t& len); 00116 00122 float64_t deriv_a(float64_t a, int32_t dimension=-1) ; 00123 00124 protected: 00126 CHMM* pos; 00128 CHMM* neg; 00130 float64_t* pos_prob; 00132 float64_t* neg_prob; 00134 float64_t weight_a; 00135 }; 00136 #endif