SHOGUN  4.2.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
TOPFeatures.h
Go to the documentation of this file.
1 /*
2  * This program is free software; you can redistribute it and/or modify
3  * it under the terms of the GNU General Public License as published by
4  * the Free Software Foundation; either version 3 of the License, or
5  * (at your option) any later version.
6  *
7  * Written (W) 1999-2009 Soeren Sonnenburg
8  * Written (W) 1999-2008 Gunnar Raetsch
9  * Copyright (C) 1999-2009 Fraunhofer Institute FIRST and Max-Planck-Society
10  */
11 
12 #ifndef _CTOPFEATURES__H__
13 #define _CTOPFEATURES__H__
14 
15 #include <shogun/lib/config.h>
16 
19 
20 namespace shogun
21 {
22 template <class T> class CDenseFeatures;
23 class CHMM;
24 
25 #ifndef DOXYGEN_SHOULD_SKIP_THIS
26 
27 struct T_HMM_INDIZES
28 {
30  int32_t* idx_p;
32  int32_t* idx_q;
34  int32_t* idx_a_rows;
36  int32_t* idx_a_cols;
38  int32_t* idx_b_rows;
40  int32_t* idx_b_cols;
41 
43  int32_t num_p;
45  int32_t num_q;
47  int32_t num_a;
49  int32_t num_b;
50 };
51 #endif // DOXYGEN_SHOULD_SKIP_THIS
52 
70 class CTOPFeatures : public CDenseFeatures<float64_t>
71 {
72  public:
74  CTOPFeatures();
75 
84  CTOPFeatures(int32_t size, CHMM* p, CHMM* n, bool neglin, bool poslin);
85 
87  CTOPFeatures(const CTOPFeatures &orig);
88 
89  virtual ~CTOPFeatures();
90 
96  void set_models(CHMM* p, CHMM* n);
97 
102  virtual float64_t* set_feature_matrix();
103 
108  int32_t compute_num_features();
109 
116  bool compute_relevant_indizes(CHMM* hmm, T_HMM_INDIZES* hmm_idx);
117 
119  virtual const char* get_name() const { return "TOPFeatures"; }
120 
121  protected:
130  int32_t num, int32_t& len, float64_t* target=NULL);
131 
138  void compute_feature_vector(float64_t* addr, int32_t num, int32_t& len);
139 
140  private:
141  void init();
142 
143  protected:
149  bool neglinear;
151  bool poslinear;
152 
154  T_HMM_INDIZES pos_relevant_indizes;
156  T_HMM_INDIZES neg_relevant_indizes;
157 };
158 }
159 #endif
T_HMM_INDIZES pos_relevant_indizes
Definition: TOPFeatures.h:154
The class DenseFeatures implements dense feature matrices.
Definition: LDA.h:40
virtual float64_t * set_feature_matrix()
void set_models(CHMM *p, CHMM *n)
Definition: TOPFeatures.cpp:64
T_HMM_INDIZES neg_relevant_indizes
Definition: TOPFeatures.h:156
virtual const char * get_name() const
Definition: TOPFeatures.h:119
virtual float64_t * compute_feature_vector(int32_t num, int32_t &len, float64_t *target=NULL)
Definition: TOPFeatures.cpp:86
double float64_t
Definition: common.h:50
The class TOPFeatures implements TOP kernel features obtained from two Hidden Markov models...
Definition: TOPFeatures.h:70
all of classes and functions are contained in the shogun namespace
Definition: class_list.h:18
bool compute_relevant_indizes(CHMM *hmm, T_HMM_INDIZES *hmm_idx)
int32_t compute_num_features()
Hidden Markov Model.
Definition: HMM.h:369

SHOGUN Machine Learning Toolbox - Documentation