TOPFeatures.h

Go to the documentation of this file.
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/HMM.h"
00017 
00018 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00019 
00020 struct T_HMM_INDIZES
00021 {
00023     int32_t* idx_p;
00025     int32_t* idx_q;
00027     int32_t* idx_a_rows;
00029     int32_t* idx_a_cols;
00031     int32_t* idx_b_rows;
00033     int32_t* idx_b_cols;
00034 
00036     int32_t num_p;
00038     int32_t num_q;
00040     int32_t num_a;
00042     int32_t num_b;
00043 };
00044 #endif // DOXYGEN_SHOULD_SKIP_THIS
00045 
00063 class CTOPFeatures : public CSimpleFeatures<float64_t>
00064 {
00065     public:
00074         CTOPFeatures(int32_t size, CHMM* p, CHMM* n, bool neglin, bool poslin);
00075 
00077         CTOPFeatures(const CTOPFeatures &orig);
00078 
00079         virtual ~CTOPFeatures();
00080 
00086         void set_models(CHMM* p, CHMM* n);
00087 
00092         virtual float64_t* set_feature_matrix();
00093 
00098         int32_t compute_num_features();
00099 
00106         bool compute_relevant_indizes(CHMM* hmm, T_HMM_INDIZES* hmm_idx);
00107 
00109         inline virtual const char* get_name() const { return "TOPFeatures"; }
00110 
00111     protected:
00119         virtual float64_t* compute_feature_vector(
00120             int32_t num, int32_t& len, float64_t* target=NULL);
00121 
00128         void compute_feature_vector(float64_t* addr, int32_t num, int32_t& len);
00129 
00130     protected:
00132         CHMM* pos;
00134         CHMM* neg;
00136         bool neglinear;
00138         bool poslinear;
00139 
00141         T_HMM_INDIZES pos_relevant_indizes;
00143         T_HMM_INDIZES neg_relevant_indizes;
00144 };
00145 #endif

SHOGUN Machine Learning Toolbox - Documentation