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-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 _CTOPFEATURES__H__
00013 #define _CTOPFEATURES__H__
00014 
00015 #include "features/RealFeatures.h"
00016 #include "distributions/hmm/HMM.h"
00017 
00019 struct T_HMM_INDIZES
00020 {
00022     int32_t* idx_p;
00024     int32_t* idx_q;
00026     int32_t* idx_a_rows;
00028     int32_t* idx_a_cols;
00030     int32_t* idx_b_rows;
00032     int32_t* idx_b_cols;
00033 
00035     int32_t num_p;
00037     int32_t num_q;
00039     int32_t num_a;
00041     int32_t num_b;
00042 };
00043 
00059 class CTOPFeatures : public CRealFeatures
00060 {
00061     public:
00070         CTOPFeatures(int32_t size, CHMM* p, CHMM* n, bool neglin, bool poslin);
00071 
00073         CTOPFeatures(const CTOPFeatures &orig);
00074 
00075         virtual ~CTOPFeatures();
00076 
00082         void set_models(CHMM* p, CHMM* n);
00083 
00088         virtual float64_t* set_feature_matrix();
00089 
00094         int32_t compute_num_features();
00095 
00102         bool compute_relevant_indizes(CHMM* hmm, T_HMM_INDIZES* hmm_idx);
00103 
00104     protected:
00112         virtual float64_t* compute_feature_vector(
00113             int32_t num, int32_t& len, float64_t* target=NULL);
00114 
00121         void compute_feature_vector(float64_t* addr, int32_t num, int32_t& len);
00122 
00123     protected:
00125         CHMM* pos;
00127         CHMM* neg;
00129         bool neglinear;
00131         bool poslinear;
00132 
00134         T_HMM_INDIZES pos_relevant_indizes;
00136         T_HMM_INDIZES neg_relevant_indizes;
00137 };
00138 #endif

SHOGUN Machine Learning Toolbox - Documentation