SHOGUN  4.0.0
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 {
36 };
37 
38 class CMAPInferImpl;
39 
45 class CMAPInference : public CSGObject
46 {
47 public:
49  CMAPInference();
50 
56  CMAPInference(CFactorGraph* fg, EMAPInferType inference_method);
57 
59  virtual ~CMAPInference();
60 
62  virtual const char* get_name() const { return "MAPInference"; }
63 
65  virtual void inference();
66 
72 
74  float64_t get_energy() const;
75 
76 private:
78  void init();
79 
80 protected:
83 
86 
89 
92 };
93 
97 class CMAPInferImpl : public CSGObject
98 {
99 public:
101  CMAPInferImpl();
102 
108 
110  virtual ~CMAPInferImpl();
111 
113  virtual const char* get_name() const { return "MAPInferImpl"; }
114 
119  virtual float64_t inference(SGVector<int32_t> assignment) = 0;
120 
121 private:
123  void register_parameters();
124 
125 protected:
128 };
129 
130 }
131 
132 #endif
virtual float64_t inference(SGVector< int32_t > assignment)=0
Class CMAPInferImpl abstract class of MAP inference implementation.
Definition: MAPInference.h:97
float64_t get_energy() const
CFactorGraph * m_fg
Definition: MAPInference.h:127
Class SGObject is the base class of all shogun objects.
Definition: SGObject.h:112
CFactorGraph * m_fg
Definition: MAPInference.h:82
double float64_t
Definition: common.h:50
Class CFactorGraphObservation is used as the structured output.
CFactorGraphObservation * m_outputs
Definition: MAPInference.h:85
virtual void inference()
Class CMAPInference performs MAP inference on a factor graph. Briefly, given a factor graph model...
Definition: MAPInference.h:45
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:113
virtual const char * get_name() const
Definition: MAPInference.h:62
CFactorGraphObservation * get_structured_outputs() const
CMAPInferImpl * m_infer_impl
Definition: MAPInference.h:91

SHOGUN Machine Learning Toolbox - Documentation