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 <shogun/features/SimpleFeatures.h>
00016 #include <shogun/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:
00072         CTOPFeatures();
00073 
00082         CTOPFeatures(int32_t size, CHMM* p, CHMM* n, bool neglin, bool poslin);
00083 
00085         CTOPFeatures(const CTOPFeatures &orig);
00086 
00087         virtual ~CTOPFeatures();
00088 
00094         void set_models(CHMM* p, CHMM* n);
00095 
00100         virtual float64_t* set_feature_matrix();
00101 
00106         int32_t compute_num_features();
00107 
00114         bool compute_relevant_indizes(CHMM* hmm, T_HMM_INDIZES* hmm_idx);
00115 
00117         inline virtual const char* get_name() const { return "TOPFeatures"; }
00118 
00119     protected:
00127         virtual float64_t* compute_feature_vector(
00128             int32_t num, int32_t& len, float64_t* target=NULL);
00129 
00136         void compute_feature_vector(float64_t* addr, int32_t num, int32_t& len);
00137 
00138     private:
00139         void init();
00140 
00141     protected:
00143         CHMM* pos;
00145         CHMM* neg;
00147         bool neglinear;
00149         bool poslinear;
00150 
00152         T_HMM_INDIZES pos_relevant_indizes;
00154         T_HMM_INDIZES neg_relevant_indizes;
00155 };
00156 }
00157 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

SHOGUN Machine Learning Toolbox - Documentation