|
SHOGUN v0.9.3
|
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 _CTOPFEATURES__H__ 00013 #define _CTOPFEATURES__H__ 00014 00015 #include "features/SimpleFeatures.h" 00016 #include "distributions/HMM.h" 00017 00018 namespace shogun 00019 { 00020 template <class T> class CSimpleFeatures; 00021 class CHMM; 00022 00023 #ifndef DOXYGEN_SHOULD_SKIP_THIS 00024 00025 struct T_HMM_INDIZES 00026 { 00028 int32_t* idx_p; 00030 int32_t* idx_q; 00032 int32_t* idx_a_rows; 00034 int32_t* idx_a_cols; 00036 int32_t* idx_b_rows; 00038 int32_t* idx_b_cols; 00039 00041 int32_t num_p; 00043 int32_t num_q; 00045 int32_t num_a; 00047 int32_t num_b; 00048 }; 00049 #endif // DOXYGEN_SHOULD_SKIP_THIS 00050 00068 class CTOPFeatures : public CSimpleFeatures<float64_t> 00069 { 00070 public: 00079 CTOPFeatures(int32_t size, CHMM* p, CHMM* n, bool neglin, bool poslin); 00080 00082 CTOPFeatures(const CTOPFeatures &orig); 00083 00084 virtual ~CTOPFeatures(); 00085 00091 void set_models(CHMM* p, CHMM* n); 00092 00097 virtual float64_t* set_feature_matrix(); 00098 00103 int32_t compute_num_features(); 00104 00111 bool compute_relevant_indizes(CHMM* hmm, T_HMM_INDIZES* hmm_idx); 00112 00114 inline virtual const char* get_name() const { return "TOPFeatures"; } 00115 00116 protected: 00124 virtual float64_t* compute_feature_vector( 00125 int32_t num, int32_t& len, float64_t* target=NULL); 00126 00133 void compute_feature_vector(float64_t* addr, int32_t num, int32_t& len); 00134 00135 protected: 00137 CHMM* pos; 00139 CHMM* neg; 00141 bool neglinear; 00143 bool poslinear; 00144 00146 T_HMM_INDIZES pos_relevant_indizes; 00148 T_HMM_INDIZES neg_relevant_indizes; 00149 }; 00150 } 00151 #endif