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/lib/DataType.h>
00015 #include <shogun/lib/SGNDArray.h>
00016 #include <shogun/lib/SGMatrix.h>
00017 #include <shogun/base/SGObject.h>
00018 #include <shogun/structure/Plif.h>
00019 #include <shogun/structure/PlifBase.h>
00020 #include <shogun/features/StringFeatures.h>
00021 #include <shogun/lib/DynamicArray.h>
00022 
00023 namespace shogun
00024 {
00025 template <class T> class SGString;
00026 
00029 class CPlifMatrix: public CSGObject
00030 {
00031     public:
00035         CPlifMatrix();
00036 
00040         ~CPlifMatrix();
00041 
00046         inline CPlif** get_PEN() { return m_PEN; }
00047 
00052         inline CPlifBase** get_plif_matrix() { return m_plif_matrix; }
00053 
00059         inline int32_t get_num_states() { return m_num_states; }
00060 
00061 
00066         inline CPlifBase** get_state_signals() { return m_state_signals; }
00067 
00072         inline int32_t get_num_plifs() { return m_num_plifs; }
00073 
00078         inline int32_t get_num_limits() { return m_num_limits; }
00079 
00085         void create_plifs(int32_t num_plifs, int32_t num_limits);
00086 
00091         void set_plif_ids(SGVector<int32_t> ids);
00092 
00097         void set_plif_min_values(SGVector<float64_t> min_values);
00098 
00103         void set_plif_max_values(SGVector<float64_t> max_values);
00104 
00109         void set_plif_use_cache(SGVector<bool> use_cache);
00110 
00115         void set_plif_use_svm(SGVector<int32_t> use_svm);
00116 
00122         void set_plif_limits(SGMatrix<float64_t> limits);
00123 
00129         void set_plif_penalties(SGMatrix<float64_t> penalties);
00130 
00137         void set_plif_names(SGString<char>* names, int32_t num_values, int32_t maxlen=0);
00138 
00147         void set_plif_transform_type(SGString<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 
00170         bool compute_plif_matrix(SGNDArray<float64_t> penalties_array);
00171 
00178         bool compute_signal_plifs(SGMatrix<int32_t> state_signals);
00179 
00186         void set_plif_state_signal_matrix(int32_t *plif_id_matrix, int32_t m, int32_t n);
00187 
00188 
00190         virtual const char* get_name() const { return "PlifMatrix"; }
00191 
00192     protected:
00193 
00195         CPlif** m_PEN;
00196 
00198         int32_t m_num_plifs;
00199 
00201         int32_t m_num_limits;
00202 
00204         int32_t m_num_states;
00205 
00207         int m_feat_dim3;
00208 
00210         CDynamicArray<int32_t> m_ids;
00211 
00213         CPlifBase** m_plif_matrix;
00214 
00216         CPlifBase** m_state_signals;
00217 };
00218 }
00219 #endif /* _PLIFMATRIX_H_ */
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

SHOGUN Machine Learning Toolbox - Documentation