SHOGUN  3.2.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
StateModel.h
Go to the documentation of this file.
1 /*
2  * This program is free software; you can redistribute it and/or modify
3  * it under the terms of the GNU General Public License as published by
4  * the Free Software Foundation; either version 3 of the License, or
5  * (at your option) any later version.
6  *
7  * Written (W) 2012 Fernando José Iglesias García
8  * Copyright (C) 2012 Fernando José Iglesias García
9  */
10 
11 #ifndef __STATE_MODEL_H__
12 #define __STATE_MODEL_H__
13 
14 #include <shogun/lib/config.h>
15 
16 #include <shogun/base/SGObject.h>
17 #include <shogun/lib/SGMatrix.h>
18 #include <shogun/lib/SGVector.h>
22 
23 namespace shogun
24 {
25 
30 class CStateModel : public CSGObject
31 {
32  public:
34  CStateModel();
35 
37  virtual ~CStateModel();
38 
40  int32_t get_num_states() const;
41 
43  int32_t get_num_transmission_params() const;
44 
55  virtual SGMatrix< float64_t > loss_matrix(CSequence* label_seq) = 0;
56 
66  virtual float64_t loss(CSequence* label_seq_lhs, CSequence* label_seq_rhs) = 0;
67 
79  virtual void reshape_emission_params(SGVector< float64_t >& emission_weights,
80  SGVector< float64_t > w, int32_t num_feats, int32_t num_obs) = 0;
81 
92  virtual void reshape_emission_params(CDynamicObjectArray* plif_matrix,
93  SGVector< float64_t > w, int32_t num_feats, int32_t num_plif_nodes) = 0;
94 
103  virtual void reshape_transmission_params(
104  SGMatrix< float64_t >& transmission_weights,
105  SGVector< float64_t > w) = 0;
106 
113  virtual SGVector< int32_t > labels_to_states(CSequence* label_seq) const = 0;
114 
121  virtual CSequence* states_to_labels(SGVector< int32_t > state_seq) const = 0;
122 
135  virtual void weights_to_vector(SGVector< float64_t >& psi,
136  SGMatrix< float64_t > transmission_weights,
137  SGVector< float64_t > emission_weights,
138  int32_t num_feats, int32_t num_obs) const = 0;
139 
153  SGVector< float64_t > emission_weights, int32_t num_feats, int32_t num_obs) const = 0;
154 
173  virtual SGVector< int32_t > get_monotonicity(int32_t num_free_states,
174  int32_t num_feats) const;
175 
192 
209 
211  virtual const char* get_name() const { return "StateModel"; }
212 
213  private:
215  void init();
216 
217  protected:
219  int32_t m_num_states;
220 
223 
226 
229 
232 
233 }; /* class CStateModel */
234 
235 } /* namespace shogun */
236 
237 #endif /* __STATE_MODEL_H__ */

SHOGUN Machine Learning Toolbox - Documentation