class CBNSProbTable

BNSProbTable class is used to store the Conditional probability table of the node

Public Fields

static int m_nCounter
This variable is used to check for the memory leak in the program

Public

Constructors and Destructor
CBNSProbTable ()
Default Construtor
CBNSProbTable (CBNSNode* pNode)
Construtor with a pointer to the node
CBNSProbTable (CBNSProbTable& cBNSProbTable)
Copy constructor
virtual ~CBNSProbTable ()
Destructor
Out Functions
int GetNoOfStates ()
Returns the number of states of the node, the dimension of vector
int GetNoOfParents ()
Returns the number of parents of the node, the number of parents can be the subset of the parents of the node
int GetSize ()
Returns the size of each CBNSProbVector in vector
bool GetProbVector (CBNSProbVector &vProbVector, int index)
The probability values of a particular state of the node given by index is returned in vProbvector that is passed by reference
void GetParentSet (CBNSSet<CBNSNode*>& cParentSet)
Returns the parent set in cParentSet that is passed by reference
double GetValue (int nState, vector &vParentStates)
Returns the probability value of the state of the node given the states of the parents in vParensStates
CBNSNode* GetNode ()
Returns the node for which this table is valid
vector <CBNSProbVector*> GetProbTable ()
Returns the probability table of the node as vector of pointers to CBNSProbVector objects
In Functions
void SetNode (CBNSNode* pNode)
Sets the node for the table to pNode
void SetParentSet (CBNSSet<CBNSNode*>& cParentSet)
Sets the parent set to cParentSet
void SetProbTable (vector<CBNSProbVector* >& vProbVector)
Sets the probability table to vProbVector
bool SetProbVector (CBNSProbVector& probVector, int nIndex)
Sets the probability values of state nIndex to the values in probVector and returns true if succeeded
bool SetProbTable (CBNSProbTable& cBNSProbTable)
Sets the probability table cBNSProbTable by copying the contents
bool SetProbTable (int nSize, int nStates, double dFirst, ...)
Sets the values in the probability table by using this variable argument list function
Update and Utility Functions
void InitializeTable ()
Initializes the table
void DeleteTable ()
Frees the memory by deleting the CBNSProbVectors in vector
void Reset ()
Resets the table based on the parent set
void NormalizeTable ()
Normailizes the probability table (Could be incorrect <\em>)
void PrintBNSProbTable ()
Prints the probability table to the console
bool ValidateTableValues ()
Validates the values in the probability table by checking for negative values in the table
void ComputeMarginal (CBNSSet<CBNSNode*> &cNodeSet, CBNSProbTable &cProbTable)
Computes Marginal probability for a node given a set of nodes
void ComputeMarginal (CBNSProbVector &vProbVector)
Computes the belief vector and returns it in vProbVector
bool ComputeMarginal (CBNSNode* pNode, CBNSProbTable &cTable)
Computes Marginal Probability given a Node
Friend Functions
friend ostream& operator << (ostream &stream, CBNSProbTable &cTable)
Stream insertion operator

Private

Private member variables
CBNSNode* m_pcBNSNode
Probability Table corresponds to this node.
vector <CBNSProbVector*> m_vProbTable
Contents stored in a vector of CBNSProbVectors
CBNSSet <CBNSNode*> m_vParentSet
Set or subset of the parent set of the m_pcBNSNode

Documentation

BNSProbTable class is used to store the Conditional probability table of the node. Each node has a BNSProbTable to store the conditional probability values.
static int m_nCounter
This variable is used to check for the memory leak in the program

Constructors and Destructor

CBNSProbTable()
Default Construtor

CBNSProbTable(CBNSNode* pNode)
Construtor with a pointer to the node
Parameters:
pNode - pointer to the node for which this table belongs

CBNSProbTable(CBNSProbTable& cBNSProbTable)
Copy constructor
Parameters:
cBNSProbTable - a reference to CBNSProbTable

virtual ~CBNSProbTable()
Destructor

Out Functions

int GetNoOfStates()
Returns the number of states of the node, the dimension of vector
Returns:
int

int GetNoOfParents()
Returns the number of parents of the node, the number of parents can be the subset of the parents of the node
Returns:
int

int GetSize()
Returns the size of each CBNSProbVector in vector. This number is equal to the product of states of the parents
Returns:
int

bool GetProbVector(CBNSProbVector &vProbVector, int index)
The probability values of a particular state of the node given by index is returned in vProbvector that is passed by reference. If the index exceeds the number of states then the function returns false
Returns:
bool
Parameters:
vProbVector - a reference to CBNSProbVector
index - the state number of the node (states start from zero)

void GetParentSet(CBNSSet<CBNSNode*>& cParentSet)
Returns the parent set in cParentSet that is passed by reference
Parameters:
cParentSet - a reference to a CBNSSet of pointers to CBNSNode objects

double GetValue(int nState, vector &vParentStates)
Returns the probability value of the state of the node given the states of the parents in vParensStates
Returns:
double
Parameters:
nState - the state of the node
vParentStates - the vector containing the states of the parents

CBNSNode* GetNode()
Returns the node for which this table is valid
Returns:
a pointer to CBNSNode object

vector <CBNSProbVector*> GetProbTable()
Returns the probability table of the node as vector of pointers to CBNSProbVector objects
Returns:
vector

In Functions

void SetNode(CBNSNode* pNode)
Sets the node for the table to pNode
Parameters:
pNode - a pointer to CBNSNode

void SetParentSet(CBNSSet<CBNSNode*>& cParentSet)
Sets the parent set to cParentSet
Parameters:
cParentSet - a reference to CBNSSet of CBNSNodes

void SetProbTable(vector<CBNSProbVector* >& vProbVector)
Sets the probability table to vProbVector
Parameters:
vProbVector - a reference to vector

bool SetProbVector(CBNSProbVector& probVector, int nIndex)
Sets the probability values of state nIndex to the values in probVector and returns true if succeeded
Returns:
bool
Parameters:
probVector - a reference to CBNSProbVector
nIndex - the state of the node

bool SetProbTable(CBNSProbTable& cBNSProbTable)
Sets the probability table cBNSProbTable by copying the contents
Parameters:
cBNSProbTable - a reference to CBNSProbTable

bool SetProbTable(int nSize, int nStates, double dFirst, ...)
Sets the values in the probability table by using this variable argument list function. Remember to input dFirst parameter in the function with a decimal, ie., 3.4 or 3.0 or 0.34 etc
Returns:
bool
Parameters:
nSize - the product of the states of the parents of the node
nStates - the number of states of the node
dFirst - the first probability value

Update and Utility Functions

void InitializeTable()
Initializes the table

void DeleteTable()
Frees the memory by deleting the CBNSProbVectors in vector

void Reset()
Resets the table based on the parent set

void NormalizeTable()
Normailizes the probability table (Could be incorrect <\em>)

void PrintBNSProbTable()
Prints the probability table to the console

bool ValidateTableValues()
Validates the values in the probability table by checking for negative values in the table. The function returns false if any value is negative
Returns:
bool

void ComputeMarginal(CBNSSet<CBNSNode*> &cNodeSet, CBNSProbTable &cProbTable)
Computes Marginal probability for a node given a set of nodes. cNodeSet is subtracted from the parent set of the node and the probability table is returned in cProbTable
Parameters:
cNodeSet - a reference to set of nodes
cProbTable - the marginal distribution is returned in this table

void ComputeMarginal(CBNSProbVector &vProbVector)
Computes the belief vector and returns it in vProbVector
Parameters:
vProbVector - a reference to CBNSProbVector

bool ComputeMarginal(CBNSNode* pNode, CBNSProbTable &cTable)
Computes Marginal Probability given a Node. The node is subtracted from the parent set and the probability table is returned in cTable. If the node doesnt exist in the set of parents then the function returns false
Returns:
bool
Parameters:
pNode - a pointer to the node object
cTable - a reference to CBNSProbTable where the table is returned

Friend Functions

friend ostream& operator << (ostream &stream, CBNSProbTable &cTable)
Stream insertion operator
Returns:
a reference to ostream
Parameters:
stream - an ostream object
cTable - a reference to CBNSProbTable

Private member variables

CBNSNode* m_pcBNSNode
Probability Table corresponds to this node.

vector <CBNSProbVector*> m_vProbTable
Contents stored in a vector of CBNSProbVectors

CBNSSet <CBNSNode*> m_vParentSet
Set or subset of the parent set of the m_pcBNSNode


This class has no child classes.

alphabetic index hierarchy of classes


this page has been generated automatically by doc++

(c)opyright by Malte Zöckler, Roland Wunderling
contact: doc++@zib.de