Direct Graphical Models  v.1.5.1
DirectGraphicalModels::CInferTRW Class Reference

Tree-reweighted inference class. More...

#include <InferTRW.h>

Inheritance diagram for DirectGraphicalModels::CInferTRW:
Collaboration diagram for DirectGraphicalModels::CInferTRW:

Public Member Functions

 CInferTRW (CGraph *pGraph)
 Constructor. More...
 
virtual ~CInferTRW (void)
 
virtual void infer (unsigned int nIt=1)
 Inference. More...
 
- Public Member Functions inherited from DirectGraphicalModels::CMessagePassing
 CMessagePassing (CGraph *pGraph)
 Constructor. More...
 
virtual ~CMessagePassing (void)
 
- Public Member Functions inherited from DirectGraphicalModels::CInfer
 CInfer (CGraph *pGraph)
 Constructor. More...
 
virtual ~CInfer (void)
 
virtual vec_byte_t decode (unsigned int nIt=0, Mat &lossMatrix=Mat())
 Approximate decoding. More...
 
vec_float_t getConfidence (void) const
 Returns the confidence of the prediction. More...
 
vec_float_t getPotentials (byte state) const
 Returns the potnetials for the selected state (class) More...
 

Protected Member Functions

virtual void calculateMessages (unsigned int nIt)
 Calculates messages, associated with the edges of corresponding graphical model. More...
 
void calculateMessage (Edge &edge, float *temp, float *data)
 
- Protected Member Functions inherited from DirectGraphicalModels::CMessagePassing
void calculateMessage (Edge *edge, float *temp, float *&dst, bool maxSum=false)
 Calculates one message for the specified edge edge. More...
 
void createMessages (void)
 Allocates memory for Edge::msg and Edge::msg_temp containers for all edges in the graph. More...
 
void deleteMessages (void)
 Deletes memory for Edge::msg and Edge::msg_temp containers for all edges in the graph. More...
 
void swapMessages (void)
 Swaps Edge::msg and Edge::msg_temp for all edges in the graph. More...
 
- Protected Member Functions inherited from DirectGraphicalModels::CDecode
 CDecode (CGraph *pGraph)
 Constructor. More...
 
void setState (vec_byte_t &state, qword configuration) const
 Sets the state according to the configuration index configuration. More...
 
void incState (vec_byte_t &state) const
 Increases the state by one, i.e. switches the state array to the consequent configuration. More...
 
vec_float_t calculatePotentials (void) const
 Calculates potentials for all possible configurations. More...
 
virtual ~CDecode (void)
 
virtual vec_byte_t decode (unsigned int nIt=0, Mat &lossMatrix=Mat()) const
 Approximate decoding. More...
 

Additional Inherited Members

- Static Protected Member Functions inherited from DirectGraphicalModels::CMessagePassing
static float MatMul (const Mat &M, const float *v, float *&dst, bool maxSum=false)
 Specific matrix multiplication. More...
 
- Static Protected Member Functions inherited from DirectGraphicalModels::CDecode
static vec_byte_t decode (const CGraph *pGraph, Mat &lossMatrix=Mat())
 Approximate decoding. More...
 
static Mat getDefaultLossMatrix (byte nStates)
 Returns a default loss matrix \(L\). More...
 
- Protected Attributes inherited from DirectGraphicalModels::CDecode
CGraphm_pGraph
 Pointer to the graph. More...
 

Detailed Description

Tree-reweighted inference class.

This class is based on the Tree-reweighted message passing algorithm (a modification of a max-poduct LBP algorithm), described in the paper Convergent Tree-reweighted Message Passing for Energy Minimization

Author
Sergey G. Kosov, serge.nosp@m.y.ko.nosp@m.sov@p.nosp@m.roje.nosp@m.ct-10.nosp@m..de

Definition at line 19 of file InferTRW.h.

Constructor & Destructor Documentation

DirectGraphicalModels::CInferTRW::CInferTRW ( CGraph pGraph)
inline

Constructor.

Parameters
pGraphThe graph

Definition at line 26 of file InferTRW.h.

virtual DirectGraphicalModels::CInferTRW::~CInferTRW ( void  )
inlinevirtual

Definition at line 27 of file InferTRW.h.

Member Function Documentation

void DirectGraphicalModels::CInferTRW::calculateMessage ( Edge edge,
float *  temp,
float *  data 
)
protected

Definition at line 132 of file InferTRW.cpp.

Here is the caller graph for this function:

void DirectGraphicalModels::CInferTRW::calculateMessages ( unsigned int  nIt)
protectedvirtual

Calculates messages, associated with the edges of corresponding graphical model.

This function may modify Edge::msg and Edge::msg_temp containers of graph edges

Parameters
nItNumber of iterations

Implements DirectGraphicalModels::CMessagePassing.

Definition at line 51 of file InferTRW.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void DirectGraphicalModels::CInferTRW::infer ( unsigned int  nIt = 1)
virtual

Inference.

This function estimates the marginal potentials for each graph node, and stores them as node potentials

This function modifies Node::Pot containers of graph nodes

Parameters
nItNumber of iterations
Note
This function must not to be linear, i.e. \( infer(\alpha\times N)\not\equiv\alpha\times infer(N) \)
This function substitutes the graph nodes' potentials with estimated marginal potentials

Reimplemented from DirectGraphicalModels::CMessagePassing.

Definition at line 7 of file InferTRW.cpp.

Here is the call graph for this function:


The documentation for this class was generated from the following files: