SHOGUN  4.2.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
MAPInference.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 __MAP_INFERENCE_H__
12 #define __MAP_INFERENCE_H__
13 
14 #include <shogun/lib/config.h>
15 
16 #include <shogun/base/SGObject.h>
17 #include <shogun/lib/SGVector.h>
20 
21 namespace shogun
22 {
23 
30 {
35  GRAPH_CUT = 4,
36  GEMPLP = 5
37 };
38 
39 class CMAPInferImpl;
40 
46 class CMAPInference : public CSGObject
47 {
48 public:
50  CMAPInference();
51 
57  CMAPInference(CFactorGraph* fg, EMAPInferType inference_method);
58 
60  virtual ~CMAPInference();
61 
63  virtual const char* get_name() const { return "MAPInference"; }
64 
66  virtual void inference();
67 
73 
75  float64_t get_energy() const;
76 
77 private:
79  void init();
80 
81 protected:
84 
87 
90 
93 };
94 
98 class CMAPInferImpl : public CSGObject
99 {
100 public:
102  CMAPInferImpl();
103 
109 
111  virtual ~CMAPInferImpl();
112 
114  virtual const char* get_name() const { return "MAPInferImpl"; }
115 
120  virtual float64_t inference(SGVector<int32_t> assignment) = 0;
121 
122 private:
124  void register_parameters();
125 
126 protected:
129 };
130 
131 }
132 
133 #endif
virtual float64_t inference(SGVector< int32_t > assignment)=0
Class CMAPInferImpl abstract class of MAP inference implementation.
Definition: MAPInference.h:98
float64_t get_energy() const
CFactorGraph * m_fg
Definition: MAPInference.h:128
Class SGObject is the base class of all shogun objects.
Definition: SGObject.h:115
CFactorGraph * m_fg
Definition: MAPInference.h:83
double float64_t
Definition: common.h:50
Class CFactorGraphObservation is used as the structured output.
CFactorGraphObservation * m_outputs
Definition: MAPInference.h:86
virtual void inference()
Class CMAPInference performs MAP inference on a factor graph. Briefly, given a factor graph model...
Definition: MAPInference.h:46
all of classes and functions are contained in the shogun namespace
Definition: class_list.h:18
Class CFactorGraph a factor graph is a structured input in general.
Definition: FactorGraph.h:27
virtual const char * get_name() const
Definition: MAPInference.h:114
virtual const char * get_name() const
Definition: MAPInference.h:63
CFactorGraphObservation * get_structured_outputs() const
CMAPInferImpl * m_infer_impl
Definition: MAPInference.h:92

SHOGUN Machine Learning Toolbox - Documentation