SHOGUN  v3.2.0
 全部  命名空间 文件 函数 变量 类型定义 枚举 枚举值 友元 宏定义 
StateModel.h
浏览该文件的文档.
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/base/SGObject.h>
15 #include <shogun/lib/SGMatrix.h>
16 #include <shogun/lib/SGVector.h>
20 
21 namespace shogun
22 {
23 
28 class CStateModel : public CSGObject
29 {
30  public:
32  CStateModel();
33 
35  virtual ~CStateModel();
36 
38  int32_t get_num_states() const;
39 
41  int32_t get_num_transmission_params() const;
42 
53  virtual SGMatrix< float64_t > loss_matrix(CSequence* label_seq) = 0;
54 
64  virtual float64_t loss(CSequence* label_seq_lhs, CSequence* label_seq_rhs) = 0;
65 
77  virtual void reshape_emission_params(SGVector< float64_t >& emission_weights,
78  SGVector< float64_t > w, int32_t num_feats, int32_t num_obs) = 0;
79 
90  virtual void reshape_emission_params(CDynamicObjectArray* plif_matrix,
91  SGVector< float64_t > w, int32_t num_feats, int32_t num_plif_nodes) = 0;
92 
101  virtual void reshape_transmission_params(
102  SGMatrix< float64_t >& transmission_weights,
103  SGVector< float64_t > w) = 0;
104 
111  virtual SGVector< int32_t > labels_to_states(CSequence* label_seq) const = 0;
112 
119  virtual CSequence* states_to_labels(SGVector< int32_t > state_seq) const = 0;
120 
133  virtual void weights_to_vector(SGVector< float64_t >& psi,
134  SGMatrix< float64_t > transmission_weights,
135  SGVector< float64_t > emission_weights,
136  int32_t num_feats, int32_t num_obs) const = 0;
137 
151  SGVector< float64_t > emission_weights, int32_t num_feats, int32_t num_obs) const = 0;
152 
171  virtual SGVector< int32_t > get_monotonicity(int32_t num_free_states,
172  int32_t num_feats) const;
173 
190 
207 
209  virtual const char* get_name() const { return "StateModel"; }
210 
211  private:
213  void init();
214 
215  protected:
217  int32_t m_num_states;
218 
221 
224 
227 
230 
231 }; /* class CStateModel */
232 
233 } /* namespace shogun */
234 
235 #endif /* __STATE_MODEL_H__ */
SGMatrix< float64_t > m_state_loss_mat
Definition: StateModel.h:223
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:229
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:28
SGVector< float64_t > m_p
Definition: StateModel.h:226
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:102
double float64_t
Definition: common.h:48
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:220
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:16
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:209
virtual SGMatrix< float64_t > loss_matrix(CSequence *label_seq)=0

SHOGUN Machine Learning Toolbox - Documentation