SHOGUN  3.2.1
 全部  命名空间 文件 函数 变量 类型定义 枚举 枚举值 友元 宏定义  
FactorGraph.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 __FACTORGRAPH_H__
12 #define __FACTORGRAPH_H__
13 
15 #include <shogun/lib/SGVector.h>
19 
20 namespace shogun
21 {
22 
25 class CFactorGraph : public CSGObject
26 {
27 
28 public:
29  CFactorGraph();
30 
35  CFactorGraph(const SGVector<int32_t> card);
36 
41  CFactorGraph(const CFactorGraph &fg);
42 
44  ~CFactorGraph();
45 
47  virtual const char* get_name() const { return "FactorGraph"; }
48 
53  void add_factor(CFactor* factor);
54 
59  void add_data_source(CFactorDataSource* datasource);
60 
63 
66 
68  int32_t get_num_factors() const;
69 
72 
78 
80  void compute_energies();
81 
86  float64_t evaluate_energy(const SGVector<int32_t> state) const;
87 
93 
96 
99 
101  int32_t get_num_edges() const;
102 
104  int32_t get_num_vars() const;
105 
110  void connect_components();
111 
113  bool is_acyclic_graph() const;
114 
116  bool is_connected_graph() const;
117 
119  bool is_tree_graph() const;
120 
125  virtual void loss_augmentation(CFactorGraphObservation* gt);
126 
132  virtual void loss_augmentation(SGVector<int32_t> states_gt, \
134 
135 private:
137  void register_parameters();
138 
140  void init();
141 
142 protected:
143  // TODO: FactorNode, VariableNode, such that they have IDs
144 
147 
150 
153 
156 
159 
161  int32_t m_num_edges;
162 
163 };
164 
165 }
166 
167 #endif
168 
float64_t evaluate_energy(const SGVector< int32_t > state) const
void add_factor(CFactor *factor)
Definition: FactorGraph.cpp:95
void add_data_source(CFactorDataSource *datasource)
int32_t get_num_edges() const
bool is_tree_graph() const
int32_t get_num_factors() const
CDynamicObjectArray * get_factors() const
CDisjointSet * get_disjoint_set() const
CDynamicObjectArray * m_datasources
Definition: FactorGraph.h:152
void set_cardinalities(SGVector< int32_t > cards)
Class SGObject is the base class of all shogun objects.
Definition: SGObject.h:102
CDynamicObjectArray * get_factor_data_sources() const
int32_t get_num_vars() const
double float64_t
Definition: common.h:48
Class CFactorGraphObservation is used as the structured output.
Class CFactorDataSource Source for factor data. In some cases, the same data can be shared by many fa...
Definition: Factor.h:25
CDisjointSet * m_dset
Definition: FactorGraph.h:155
Dynamic array class for CSGObject pointers that creates an array that can be used like a list or an a...
Class CDisjointSet data structure for linking graph nodes It's easy to identify connected graph...
Definition: DisjointSet.h:24
SGVector< float64_t > evaluate_energies() const
CDynamicObjectArray * m_factors
Definition: FactorGraph.h:149
Class CFactorGraph a factor graph is a structured input in general.
Definition: FactorGraph.h:25
bool is_acyclic_graph() const
SGVector< int32_t > get_cardinalities() const
virtual void loss_augmentation(CFactorGraphObservation *gt)
SGVector< int32_t > m_cardinalities
Definition: FactorGraph.h:146
Class CFactor A factor is defined on a clique in the factor graph. Each factor can have its own data...
Definition: Factor.h:87
virtual const char * get_name() const
Definition: FactorGraph.h:47
bool is_connected_graph() const

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