SHOGUN
v3.2.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 00080 virtual void reshape_emission_params(CDynamicObjectArray* plif_matrix, 00081 SGVector< float64_t > w, int32_t num_feats, int32_t num_plif_nodes); 00082 00091 virtual void reshape_transmission_params( 00092 SGMatrix< float64_t >& transmission_weights, 00093 SGVector< float64_t > w); 00094 00101 virtual SGVector< int32_t > labels_to_states(CSequence* label_seq) const; 00102 00109 virtual CSequence* states_to_labels(SGVector< int32_t > state_seq) const; 00110 00123 virtual void weights_to_vector(SGVector< float64_t >& psi, 00124 SGMatrix< float64_t > transmission_weights, 00125 SGVector< float64_t > emission_weights, 00126 int32_t num_feats, int32_t num_obs) const; 00127 00140 virtual SGVector< float64_t > weights_to_vector(SGMatrix< float64_t > transmission_weights, 00141 SGVector< float64_t > emission_weights, int32_t num_feats, int32_t num_obs) const; 00142 00155 virtual SGVector< int32_t > get_monotonicity(int32_t num_free_states, 00156 int32_t num_feats) const; 00157 00169 static CHMSVMModel* simulate_data(int32_t num_exm, int32_t exm_len, int32_t num_features, int32_t num_noise_features); 00170 00172 virtual const char* get_name() const { return "TwoStateModel"; } 00173 }; 00174 00175 } /* namespace shogun */ 00176 00177 #endif /* __TWO_STATE_MODEL_H__ */