SHOGUN  4.1.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules 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__ */
SGMatrix< float64_t > m_state_loss_mat
Definition: StateModel.h:225
virtual ~CStateModel()
Definition: StateModel.cpp:20
SGVector< float64_t > get_start_states() const
Definition: StateModel.cpp:56
SGVector< float64_t > m_q
Definition: StateModel.h:231
virtual CSequence * states_to_labels(SGVector< int32_t > state_seq) const =0
SGVector< float64_t > get_stop_states() const
Definition: StateModel.cpp:61
class CStateModel base, abstract class for the internal state representation used in the CHMSVMModel...
Definition: StateModel.h:30
SGVector< float64_t > m_p
Definition: StateModel.h:228
virtual void reshape_emission_params(SGVector< float64_t > &emission_weights, SGVector< float64_t > w, int32_t num_feats, int32_t num_obs)=0
int32_t get_num_transmission_params() const
Definition: StateModel.cpp:29
Class CSequence to be used in the application of Structured Output (SO) learning to Hidden Markov Sup...
Class SGObject is the base class of all shogun objects.
Definition: SGObject.h:112
double float64_t
Definition: common.h:50
Dynamic array class for CSGObject pointers that creates an array that can be used like a list or an a...
int32_t get_num_states() const
Definition: StateModel.cpp:24
virtual SGVector< int32_t > get_monotonicity(int32_t num_free_states, int32_t num_feats) const
Definition: StateModel.cpp:48
int32_t m_num_transmission_params
Definition: StateModel.h:222
virtual SGVector< int32_t > labels_to_states(CSequence *label_seq) const =0
all of classes and functions are contained in the shogun namespace
Definition: class_list.h:18
virtual void reshape_transmission_params(SGMatrix< float64_t > &transmission_weights, SGVector< float64_t > w)=0
virtual float64_t loss(CSequence *label_seq_lhs, CSequence *label_seq_rhs)=0
virtual void weights_to_vector(SGVector< float64_t > &psi, SGMatrix< float64_t > transmission_weights, SGVector< float64_t > emission_weights, int32_t num_feats, int32_t num_obs) const =0
virtual const char * get_name() const
Definition: StateModel.h:211
virtual SGMatrix< float64_t > loss_matrix(CSequence *label_seq)=0

SHOGUN Machine Learning Toolbox - Documentation