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 __TWO_STATE_MODEL_H__ 00012 #define __TWO_STATE_MODEL_H__ 00013 00014 #include <shogun/structure/StateModel.h> 00015 #include <shogun/structure/HMSVMModel.h> 00016 00017 namespace shogun 00018 { 00019 00024 class CTwoStateModel : public CStateModel 00025 { 00026 public: 00028 CTwoStateModel(); 00029 00031 virtual ~CTwoStateModel(); 00032 00043 virtual SGMatrix< float64_t > loss_matrix(CSequence* label_seq); 00044 00054 virtual float64_t loss(CSequence* label_seq_lhs, CSequence* label_seq_rhs); 00055 00067 virtual void reshape_emission_params(SGVector< float64_t >& emission_weights, 00068 SGVector< float64_t > w, int32_t num_feats, int32_t num_obs); 00069 00078 virtual void reshape_transmission_params( 00079 SGMatrix< float64_t >& transmission_weights, 00080 SGVector< float64_t > w); 00081 00088 virtual SGVector< int32_t > labels_to_states(CSequence* label_seq) const; 00089 00096 virtual CSequence* states_to_labels(SGVector< int32_t > state_seq) const; 00097 00111 virtual void weights_to_vector(SGVector< float64_t >& psi, 00112 SGMatrix< float64_t > transmission_weights, 00113 SGVector< float64_t > emission_weights, 00114 int32_t num_feats, int32_t num_obs) const; 00115 00128 virtual SGVector< int32_t > get_monotonicity(int32_t num_free_states, 00129 int32_t num_feats) const; 00130 00137 static CHMSVMModel* simulate_two_state_data(); 00138 00140 virtual const char* get_name() const { return "TwoStateModel"; } 00141 }; 00142 00143 } /* namespace shogun */ 00144 00145 #endif /* __TWO_STATE_MODEL_H__ */