SHOGUN
v2.0.0
|
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) 2012 Fernando José Iglesias García 00008 * Copyright (C) 2012 Fernando José Iglesias García 00009 */ 00010 00011 #ifndef _HMSVM_MODEL__H__ 00012 #define _HMSVM_MODEL__H__ 00013 00014 #include <shogun/structure/StructuredModel.h> 00015 #include <shogun/structure/HMSVMLabels.h> 00016 #include <shogun/structure/StateModelTypes.h> 00017 #include <shogun/structure/StateModel.h> 00018 00019 namespace shogun 00020 { 00021 00022 enum EStateModelType; 00023 00029 class CHMSVMModel : public CStructuredModel 00030 { 00031 public: 00033 CHMSVMModel(); 00034 00042 CHMSVMModel(CFeatures* features, CStructuredLabels* labels, EStateModelType smt, int32_t num_obs); 00043 00045 virtual ~CHMSVMModel(); 00046 00051 virtual int32_t get_dim() const; 00052 00065 virtual SGVector< float64_t > get_joint_feature_vector(int32_t feat_idx, CStructuredData* y); 00066 00080 virtual CResultSet* argmax(SGVector< float64_t > w, int32_t feat_idx, bool const training = true); 00081 00089 virtual float64_t delta_loss(CStructuredData* y1, CStructuredData* y2); 00090 00101 virtual void init_opt( 00102 SGMatrix< float64_t > & A, SGVector< float64_t > a, 00103 SGMatrix< float64_t > B, SGVector< float64_t > & b, 00104 SGVector< float64_t > lb, SGVector< float64_t > ub, 00105 SGMatrix < float64_t > & C); 00106 00111 virtual bool check_training_setup() const; 00112 00121 virtual int32_t get_num_aux() const; 00122 00130 virtual int32_t get_num_aux_con() const; 00131 00132 private: 00133 /* internal initialization */ 00134 void init(); 00135 00136 private: 00138 int32_t m_num_states; 00139 00141 int32_t m_num_obs; 00142 00144 int32_t m_num_aux; 00145 00147 CStateModel* m_state_model; 00148 00150 SGMatrix< float64_t > m_transmission_weights; 00151 00153 SGVector< float64_t > m_emission_weights; 00154 00155 }; /* class CHMSVMModel */ 00156 00157 } /* namespace shogun */ 00158 00159 #endif /* _HMSVM_MODEL__H__ */