SHOGUN  v3.2.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
FactorGraphModel.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) 2013 Shell Hu
8  * Copyright (C) 2013 Shell Hu
9  */
10 
11 #ifndef __FACTOR_GRAPH_MODEL_H__
12 #define __FACTOR_GRAPH_MODEL_H__
13 
14 #include <shogun/lib/SGString.h>
19 
20 namespace shogun
21 {
22 
31 {
32 public:
35 
45  EMAPInferType inf_type = TREE_MAX_PROD, bool verbose = false);
46 
49 
51  virtual const char* get_name() const { return "FactorGraphModel"; }
52 
59  void add_factor_type(CFactorType* ftype);
60 
65  void del_factor_type(const int32_t ftype_id);
66 
69 
74  CFactorType* get_factor_type(const int32_t ftype_id) const;
75 
78 
83  SGVector<int32_t> get_params_mapping(const int32_t ftype_id);
84 
87 
93 
106  virtual SGVector< float64_t > get_joint_feature_vector(int32_t feat_idx, CStructuredData* y);
107 
121  virtual CResultSet* argmax(SGVector< float64_t > w, int32_t feat_idx, bool const training = true);
122 
131 
136  virtual void init_training();
137 
149  virtual void init_primal_opt(
150  float64_t regularization,
155 
160  virtual int32_t get_dim() const;
161 
162 private:
164  void init();
165 
166 protected:
169 
172 
175 
178 
180  bool m_verbose;
181 };
182 
183 }
184 
185 #endif
186 
Class CFactorType defines the way of factor parameterization.
Definition: FactorType.h:22
SGVector< int32_t > get_params_mapping(const int32_t ftype_id)
SGVector< int32_t > get_global_params_mapping() const
Base class of the labels used in Structured Output (SO) problems.
virtual void init_primal_opt(float64_t regularization, SGMatrix< float64_t > &A, SGVector< float64_t > a, SGMatrix< float64_t > B, SGVector< float64_t > &b, SGVector< float64_t > lb, SGVector< float64_t > ub, SGMatrix< float64_t > &C)
SGVector< float64_t > fparams_to_w()
CDynamicObjectArray * m_factor_types
void add_factor_type(CFactorType *ftype)
virtual int32_t get_dim() const
virtual SGVector< float64_t > get_joint_feature_vector(int32_t feat_idx, CStructuredData *y)
void w_to_fparams(SGVector< float64_t > w)
virtual const char * get_name() const
double float64_t
Definition: common.h:48
CDynamicObjectArray * get_factor_types() const
virtual CResultSet * argmax(SGVector< float64_t > w, int32_t feat_idx, bool const training=true)
CFactorGraphModel defines a model in terms of CFactorGraph and CMAPInference, where parameters are as...
Dynamic array class for CSGObject pointers that creates an array that can be used like a list or an a...
Class CStructuredModel that represents the application specific model and contains most of the applic...
void del_factor_type(const int32_t ftype_id)
The class Features is the base class of all feature objects.
Definition: Features.h:62
SGVector< int32_t > m_w_map
virtual float64_t delta_loss(CStructuredData *y1, CStructuredData *y2)
SGVector< float64_t > m_w_cache
Base class of the components of StructuredLabels.
CFactorType * get_factor_type(const int32_t ftype_id) const

SHOGUN Machine Learning Toolbox - Documentation