SHOGUN  v1.1.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
PlifMatrix.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) 2009 Soeren Sonnenburg
8  * Copyright (C) 2009 Fraunhofer Institute FIRST and Max-Planck-Society
9  */
10 
11 #ifndef _PLIFMATRIX_H_
12 #define _PLIFMATRIX_H_
13 
14 #include <shogun/base/SGObject.h>
15 #include <shogun/structure/Plif.h>
18 #include <shogun/lib/Array.h>
19 #include <shogun/lib/Array2.h>
20 #include <shogun/lib/Array3.h>
21 
22 namespace shogun
23 {
24 template <class T> class SGString;
25 
28 class CPlifMatrix: public CSGObject
29 {
30  public:
34  CPlifMatrix();
35 
39  ~CPlifMatrix();
40 
45  inline CPlif** get_PEN() { return m_PEN; }
46 
51  inline CPlifBase** get_plif_matrix() { return m_plif_matrix; }
52 
58  inline int32_t get_num_states() { return m_num_states; }
59 
60 
66 
71  inline int32_t get_num_plifs() { return m_num_plifs; }
72 
77  inline int32_t get_num_limits() { return m_num_limits; }
78 
84  void create_plifs(int32_t num_plifs, int32_t num_limits);
85 
91 
97 
102  void set_plif_max_values(SGVector<float64_t> max_values);
103 
108  void set_plif_use_cache(SGVector<bool> use_cache);
109 
114  void set_plif_use_svm(SGVector<int32_t> use_svm);
115 
122 
128  void set_plif_penalties(SGMatrix<float64_t> penalties);
129 
136  void set_plif_names(SGString<char>* names, int32_t num_values, int32_t maxlen=0);
137 
146  void set_plif_transform_type(SGString<char>* transform_type, int32_t num_values, int32_t maxlen=0);
147 
153  inline int32_t get_plif_id(int32_t idx)
154  {
155  int32_t id = m_ids[idx];
156  if (id>=m_num_plifs)
157  SG_ERROR("plif id (%i) exceeds array length (%i)\n",id,m_num_plifs);
158  return id;
159  }
160 
169  bool compute_plif_matrix(SGNDArray<float64_t> penalties_array);
170 
177  bool compute_signal_plifs(SGMatrix<int32_t> state_signals);
178 
185  void set_plif_state_signal_matrix(int32_t *plif_id_matrix, int32_t m, int32_t n);
186 
187 
189  inline virtual const char* get_name() const { return "PlifMatrix"; }
190 
191  protected:
192 
195 
197  int32_t m_num_plifs;
198 
200  int32_t m_num_limits;
201 
203  int32_t m_num_states;
204 
207 
210 
213 
216 };
217 }
218 #endif /* _PLIFMATRIX_H_ */

SHOGUN Machine Learning Toolbox - Documentation