SHOGUN  4.1.0
 全部  命名空间 文件 函数 变量 类型定义 枚举 枚举值 友元 宏定义  
FactorGraphModel.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) 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/config.h>
15 
16 #include <shogun/lib/SGString.h>
21 
22 namespace shogun
23 {
24 
33 {
34 public:
37 
47  EMAPInferType inf_type = TREE_MAX_PROD, bool verbose = false);
48 
51 
53  virtual const char* get_name() const { return "FactorGraphModel"; }
54 
61  void add_factor_type(CFactorType* ftype);
62 
67  void del_factor_type(const int32_t ftype_id);
68 
71 
76  CFactorType* get_factor_type(const int32_t ftype_id) const;
77 
80 
85  SGVector<int32_t> get_params_mapping(const int32_t ftype_id);
86 
89 
95 
108  virtual SGVector< float64_t > get_joint_feature_vector(int32_t feat_idx, CStructuredData* y);
109 
123  virtual CResultSet* argmax(SGVector< float64_t > w, int32_t feat_idx, bool const training = true);
124 
133 
138  virtual void init_training();
139 
151  virtual void init_primal_opt(
152  float64_t regularization,
157 
162  virtual int32_t get_dim() const;
163 
164 private:
166  void init();
167 
168 protected:
171 
174 
177 
180 
182  bool m_verbose;
183 };
184 
185 }
186 
187 #endif
188 
Class CFactorType defines the way of factor parameterization.
Definition: FactorType.h:24
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.
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:50
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...
all of classes and functions are contained in the shogun namespace
Definition: class_list.h:18
void del_factor_type(const int32_t ftype_id)
The class Features is the base class of all feature objects.
Definition: Features.h:68
SGVector< int32_t > m_w_map
virtual float64_t delta_loss(CStructuredData *y1, CStructuredData *y2)
SGVector< float64_t > m_w_cache
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)
Base class of the components of StructuredLabels.
CFactorType * get_factor_type(const int32_t ftype_id) const

SHOGUN 机器学习工具包 - 项目文档