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-2008 Soeren Sonnenburg 00008 * Written (W) 1999-2008 Gunnar Raetsch 00009 * Copyright (C) 1999-2008 Fraunhofer Institute FIRST and Max-Planck-Society 00010 */ 00011 00012 #ifndef _CFKFEATURES__H__ 00013 #define _CFKFEATURES__H__ 00014 00015 #include "features/RealFeatures.h" 00016 #include "distributions/hmm/HMM.h" 00017 00033 class CFKFeatures: public CRealFeatures 00034 { 00035 public: 00042 CFKFeatures(int32_t size, CHMM* p, CHMM* n); 00043 00045 CFKFeatures(const CFKFeatures &orig); 00046 00047 virtual ~CFKFeatures(); 00048 00054 void set_models(CHMM* p, CHMM* n); 00055 00060 inline void set_a(float64_t a) 00061 { 00062 weight_a=a; 00063 } 00064 00069 inline float64_t get_a() 00070 { 00071 return weight_a; 00072 } 00073 00078 virtual float64_t* set_feature_matrix(); 00079 00085 float64_t set_opt_a(float64_t a=-1); 00086 00091 inline float64_t get_weight_a() { return weight_a; }; 00092 00093 protected: 00101 virtual float64_t* compute_feature_vector( 00102 int32_t num, int32_t& len, float64_t* target=NULL); 00103 00110 void compute_feature_vector(float64_t* addr, int32_t num, int32_t& len); 00111 00117 float64_t deriv_a(float64_t a, int32_t dimension=-1) ; 00118 00119 protected: 00121 CHMM* pos; 00123 CHMM* neg; 00125 float64_t* pos_prob; 00127 float64_t* neg_prob; 00129 float64_t weight_a; 00130 }; 00131 #endif