SHOGUN  3.2.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups 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/lib/config.h>
15 
16 #include <shogun/lib/DataType.h>
17 #include <shogun/lib/SGNDArray.h>
18 #include <shogun/lib/SGMatrix.h>
19 #include <shogun/base/SGObject.h>
20 #include <shogun/structure/Plif.h>
24 
25 namespace shogun
26 {
27 template <class T> class SGString;
28 
31 class CPlifMatrix: public CSGObject
32 {
33  public:
37  CPlifMatrix();
38 
42  ~CPlifMatrix();
43 
48  inline CPlif** get_PEN() { return m_PEN; }
49 
54  inline CPlifBase** get_plif_matrix() { return m_plif_matrix; }
55 
61  inline int32_t get_num_states() { return m_num_states; }
62 
63 
69 
74  inline int32_t get_num_plifs() { return m_num_plifs; }
75 
80  inline int32_t get_num_limits() { return m_num_limits; }
81 
87  void create_plifs(int32_t num_plifs, int32_t num_limits);
88 
94 
100 
105  void set_plif_max_values(SGVector<float64_t> max_values);
106 
111  void set_plif_use_cache(SGVector<bool> use_cache);
112 
117  void set_plif_use_svm(SGVector<int32_t> use_svm);
118 
125 
131  void set_plif_penalties(SGMatrix<float64_t> penalties);
132 
139  void set_plif_names(SGString<char>* names, int32_t num_values, int32_t maxlen=0);
140 
149  void set_plif_transform_type(SGString<char>* transform_type, int32_t num_values, int32_t maxlen=0);
150 
156  inline int32_t get_plif_id(int32_t idx)
157  {
158  int32_t id = m_ids[idx];
159  if (id>=m_num_plifs)
160  SG_ERROR("plif id (%i) exceeds array length (%i)\n",id,m_num_plifs)
161  return id;
162  }
163 
172  bool compute_plif_matrix(SGNDArray<float64_t> penalties_array);
173 
180  bool compute_signal_plifs(SGMatrix<int32_t> state_signals);
181 
188  void set_plif_state_signal_matrix(int32_t *plif_id_matrix, int32_t m, int32_t n);
189 
190 
192  virtual const char* get_name() const { return "PlifMatrix"; }
193 
194  protected:
195 
198 
200  int32_t m_num_plifs;
201 
203  int32_t m_num_limits;
204 
206  int32_t m_num_states;
207 
210 
213 
216 
219 };
220 }
221 #endif /* _PLIFMATRIX_H_ */

SHOGUN Machine Learning Toolbox - Documentation