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 TString;
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 
00091         void set_plif_ids(int32_t* ids, int32_t num_ids);
00092 
00098         void set_plif_min_values(float64_t* min_values, int32_t num_values);
00099 
00105         void set_plif_max_values(float64_t* max_values, int32_t num_values);
00106 
00112         void set_plif_use_cache(bool* use_cache, int32_t num_values);
00113 
00119         void set_plif_use_svm(int32_t* use_svm, int32_t num_values);
00120 
00128         void set_plif_limits(float64_t* limits, int32_t num_plifs, int32_t num_limits);
00129 
00137         void set_plif_penalties(float64_t* penalties, int32_t num_plifs, int32_t num_limits);
00138 
00145         void set_plif_names(TString<char>* names, int32_t num_values, int32_t maxlen=0);
00146 
00155         void set_plif_transform_type(TString<char>* transform_type, int32_t num_values, int32_t maxlen=0);
00156 
00162         inline int32_t get_plif_id(int32_t idx)
00163         {
00164             int32_t id = m_ids[idx];
00165             if (id>=m_num_plifs)
00166                 SG_ERROR("plif id (%i)  exceeds array length (%i)\n",id,m_num_plifs);
00167             return id;
00168         }
00169 
00180         bool compute_plif_matrix(
00181                 float64_t* penalties_array, int32_t* Dim, int32_t numDims);
00182 
00191         bool compute_signal_plifs(
00192                 int32_t* state_signals, int32_t feat_dim3, int32_t num_states);
00193 
00194 
00195 
00202         void set_plif_state_signal_matrix(int32_t *plif_id_matrix, int32_t m, int32_t n);
00203 
00204 
00206         inline virtual const char* get_name() const { return "PlifMatrix"; }
00207 
00208     protected:
00209         
00211         CPlif** m_PEN;
00212 
00214         int32_t m_num_plifs;
00215 
00217         int32_t m_num_limits;
00218 
00220         int32_t m_num_states;
00221 
00223         int m_feat_dim3;
00224 
00226         CArray<int32_t> m_ids;
00227 
00229         CPlifBase** m_plif_matrix;
00230 
00232         CPlifBase** m_state_signals;
00233 };
00234 }
00235 #endif /* _PLIFMATRIX_H_ */
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

SHOGUN Machine Learning Toolbox - Documentation