PlifMatrix.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) 2009 Soeren Sonnenburg
00008  * Copyright (C) 2009 Fraunhofer Institute FIRST and Max-Planck-Society
00009  */
00010 
00011 #ifndef _PLIFMATRIX_H_
00012 #define _PLIFMATRIX_H_
00013 
00014 #include "base/SGObject.h"
00015 #include "structure/Plif.h"
00016 #include "structure/PlifBase.h"
00017 #include "features/StringFeatures.h"
00018 #include "lib/Array.h"
00019 #include "lib/Array2.h"
00020 #include "lib/Array3.h"
00021 
00022 namespace shogun
00023 {
00024 template <class T> class T_STRING;
00025 
00028 class CPlifMatrix: public CSGObject
00029 {
00030     public:
00034         CPlifMatrix();
00035 
00039         ~CPlifMatrix();
00040 
00045         inline CPlif** get_PEN() { return m_PEN; }
00046 
00051         inline CPlifBase** get_plif_matrix() { return m_plif_matrix; }
00052 
00057         inline CPlifBase** get_state_signals() { return m_state_signals; }
00058 
00063         inline int32_t get_num_plifs() { return m_num_plifs; }
00064 
00069         inline int32_t get_num_limits() { return m_num_limits; }
00070 
00076         void create_plifs(int32_t num_plifs, int32_t num_limits);
00077 
00083         void set_plif_ids(int32_t* ids, int32_t num_ids);
00084 
00090         void set_plif_min_values(float64_t* min_values, int32_t num_values);
00091 
00097         void set_plif_max_values(float64_t* max_values, int32_t num_values);
00098 
00104         void set_plif_use_cache(bool* use_cache, int32_t num_values);
00105 
00111         void set_plif_use_svm(int32_t* use_svm, int32_t num_values);
00112 
00120         void set_plif_limits(float64_t* limits, int32_t num_plifs, int32_t num_limits);
00121 
00129         void set_plif_penalties(float64_t* penalties, int32_t num_plifs, int32_t num_limits);
00130 
00137         void set_plif_names(T_STRING<char>* names, int32_t num_values, int32_t maxlen=0);
00138 
00147         void set_plif_transform_type(T_STRING<char>* transform_type, int32_t num_values, int32_t maxlen=0);
00148 
00154         inline int32_t get_plif_id(int32_t idx)
00155         {
00156             int32_t id = m_ids[idx];
00157             if (id>=m_num_plifs)
00158                 SG_ERROR("plif id (%i)  exceeds array length (%i)\n",id,m_num_plifs);
00159             return id;
00160         }
00161 
00172         bool compute_plif_matrix(
00173                 float64_t* penalties_array, int32_t* Dim, int32_t numDims);
00174 
00183         bool compute_signal_plifs(
00184                 int32_t* state_signals, int32_t feat_dim3, int32_t num_states);
00185 
00186 
00187 
00194         void set_plif_state_signal_matrix(int32_t *plif_id_matrix, int32_t m, int32_t n);
00195 
00196 
00198         inline virtual const char* get_name() const { return "PlifMatrix"; }
00199 
00200     protected:
00201         
00203         CPlif** m_PEN;
00204 
00206         int32_t m_num_plifs;
00207 
00209         int32_t m_num_limits;
00210 
00212         CArray<int32_t> m_ids;
00213 
00215         CPlifBase** m_plif_matrix;
00216 
00218         CPlifBase** m_state_signals;
00219 };
00220 }
00221 #endif /* _PLIFMATRIX_H_ */

SHOGUN Machine Learning Toolbox - Documentation