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 <shogun/base/SGObject.h>
00015 #include <shogun/structure/Plif.h>
00016 #include <shogun/structure/PlifBase.h>
00017 #include <shogun/features/StringFeatures.h>
00018 #include <shogun/lib/Array.h>
00019 #include <shogun/lib/Array2.h>
00020 #include <shogun/lib/Array3.h>
00021 
00022 namespace shogun
00023 {
00024 template <class T> class SGString;
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 
00058         inline int32_t get_num_states() { return m_num_states; }
00059 
00060 
00065         inline CPlifBase** get_state_signals() { return m_state_signals; }
00066 
00071         inline int32_t get_num_plifs() { return m_num_plifs; }
00072 
00077         inline int32_t get_num_limits() { return m_num_limits; }
00078 
00084         void create_plifs(int32_t num_plifs, int32_t num_limits);
00085 
00090         void set_plif_ids(SGVector<int32_t> ids);
00091 
00096         void set_plif_min_values(SGVector<float64_t> min_values);
00097 
00102         void set_plif_max_values(SGVector<float64_t> max_values);
00103 
00108         void set_plif_use_cache(SGVector<bool> use_cache);
00109 
00114         void set_plif_use_svm(SGVector<int32_t> use_svm);
00115 
00121         void set_plif_limits(SGMatrix<float64_t> limits);
00122 
00128         void set_plif_penalties(SGMatrix<float64_t> penalties);
00129 
00136         void set_plif_names(SGString<char>* names, int32_t num_values, int32_t maxlen=0);
00137 
00146         void set_plif_transform_type(SGString<char>* transform_type, int32_t num_values, int32_t maxlen=0);
00147 
00153         inline int32_t get_plif_id(int32_t idx)
00154         {
00155             int32_t id = m_ids[idx];
00156             if (id>=m_num_plifs)
00157                 SG_ERROR("plif id (%i)  exceeds array length (%i)\n",id,m_num_plifs);
00158             return id;
00159         }
00160 
00169         bool compute_plif_matrix(SGNDArray<float64_t> penalties_array);
00170 
00177         bool compute_signal_plifs(SGMatrix<int32_t> state_signals);
00178 
00185         void set_plif_state_signal_matrix(int32_t *plif_id_matrix, int32_t m, int32_t n);
00186 
00187 
00189         inline virtual const char* get_name() const { return "PlifMatrix"; }
00190 
00191     protected:
00192         
00194         CPlif** m_PEN;
00195 
00197         int32_t m_num_plifs;
00198 
00200         int32_t m_num_limits;
00201 
00203         int32_t m_num_states;
00204 
00206         int m_feat_dim3;
00207 
00209         CArray<int32_t> m_ids;
00210 
00212         CPlifBase** m_plif_matrix;
00213 
00215         CPlifBase** m_state_signals;
00216 };
00217 }
00218 #endif /* _PLIFMATRIX_H_ */
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

SHOGUN Machine Learning Toolbox - Documentation