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 00019 class CFKFeatures: public CRealFeatures 00020 { 00021 public: 00028 CFKFeatures(INT size, CHMM* p, CHMM* n); 00029 00031 CFKFeatures(const CFKFeatures &orig); 00032 00033 virtual ~CFKFeatures(); 00034 00040 void set_models(CHMM* p, CHMM* n); 00041 00046 inline void set_a(DREAL a) 00047 { 00048 weight_a=a; 00049 } 00050 00055 inline DREAL get_a() 00056 { 00057 return weight_a; 00058 } 00059 00064 virtual DREAL* set_feature_matrix(); 00065 00071 double set_opt_a(double a=-1); 00072 00077 inline DREAL get_weight_a() { return weight_a; }; 00078 00079 protected: 00087 virtual DREAL* compute_feature_vector(INT num, INT& len, DREAL* target=NULL); 00088 00095 void compute_feature_vector(DREAL* addr, INT num, INT& len); 00096 00102 double deriv_a(double a, INT dimension=-1) ; 00103 00104 protected: 00106 CHMM* pos; 00108 CHMM* neg; 00110 double* pos_prob; 00112 double* neg_prob; 00114 DREAL weight_a; 00115 }; 00116 #endif