GClasses
GClasses::GBNInverseGamma Class Reference

Detailed Description

A node in a belief network that represents an inverse-gamma distribution.

#include <GBayesianNetwork.h>

Inheritance diagram for GClasses::GBNInverseGamma:
GClasses::GBNMetropolisNode GClasses::GBNVariable GClasses::GBNNode

Public Member Functions

 GBNInverseGamma (GBNNode *pDefaultVal)
 General-purpose constructor. The prior mean and deviation parameters are for the Metropolis algorithm. pDefaultVal specifies a bogus value to be used for the parameters of this distribution. Typically, you will change these values (by calling setAlphaAndBeta) after constructing this node. If the "beta" parameter is scale (typically denoted with theta) instead of rate, then betaIsScaleInsteadOfRate should be set to true. More...
 
virtual ~GBNInverseGamma ()
 
virtual void addCatParent (GBNCategorical *pNode, GBNNode *pDefaultVal)
 Adds a categorical node as a parent of this node. Calling this method will cause This node to resize its table of distribution parameters, so a default value is required to fill in new elements. Typically, you will set these new elements to something more meaningful (by calling setAlphaAndBeta) after you call this method. More...
 
virtual double initMean ()
 See the comment for GBNMetropolisNode::initMean() More...
 
virtual bool isDiscrete ()
 Returns false. More...
 
virtual double likelihood (double x)
 Returns the likelihood that the value x would be drawn from this distribution given the current values of all the parent nodes. More...
 
void setAlphaAndBeta (size_t cat, GBNNode *pAlpha, GBNNode *pBeta)
 Set the shape and scale (alpha and beta) values for one of the distributions of this node. "cat" specifies the index of the combination of values (in little-endian order) in the categorical parent distributions for which this distribution is being specified. More...
 
- Public Member Functions inherited from GClasses::GBNMetropolisNode
 GBNMetropolisNode ()
 General-purpose constructor. More...
 
virtual ~GBNMetropolisNode ()
 
virtual double currentValue ()
 Returns the most recent value sampled from this node. More...
 
void sample (GRand *pRand)
 Draws a new Gibbs sample for this node given the current values of all other nodes it its Markov blanket. Uses the Metropolis algorithm to do so. More...
 
- Public Member Functions inherited from GClasses::GBNVariable
 GBNVariable ()
 
virtual ~GBNVariable ()
 
size_t catCount ()
 Returns the total number of combinations of categorical values supported by the categorical parents of this node. This node is expected to specify a distribution for each of these categorical combinations. More...
 
const std::vector< GBNVariable * > & children ()
 Returns all nodes that are known to depend on this one. More...
 
size_t currentCatIndex ()
 Queries the categorical parent nodes to determine their current values, and combines them to produce a single index value that is unique for this combination of categorical values. The value this returns will be from 0 to catCount()-1. The values are organized in little-endian manner. That is, it cycles through all values supported by the first categorical parent before moving on to the next value of the next parent. More...
 
virtual void onNewChild (GBNVariable *pChild)
 This method links back to the child node that just added this node as a parent. More...
 
void setObserved (double value)
 Set this node to an observed value. After calling this, subsequent calls to sample will not change its value. More...
 
void setUnobserved ()
 Set this node to an unobserved value. After calling this, subsequent calls to sample will draw new values for this node. More...
 
- Public Member Functions inherited from GClasses::GBNNode
 GBNNode ()
 
virtual ~GBNNode ()
 

Protected Attributes

std::vector< GBNNode * > m_alphaAndBeta
 
- Protected Attributes inherited from GClasses::GBNMetropolisNode
double m_currentMean
 
double m_sumOfSquaredValues
 
double m_sumOfValues
 
- Protected Attributes inherited from GClasses::GBNVariable
std::vector< GBNCategorical * > m_catParents
 
std::vector< GBNVariable * > m_children
 
- Protected Attributes inherited from GClasses::GBNNode
bool m_observed
 
double m_observedValue
 

Additional Inherited Members

- Protected Member Functions inherited from GClasses::GBNMetropolisNode
double markovBlanket (double x)
 Computes the log-probability of x (as a value for this node) given the current values for the entire rest of the network (aka the complete conditional), which is equal to the log-probability of x given the Markov-Blanket of this node, which we can compute efficiently. More...
 
void metropolis (GRand *pRand)
 Sample the network in a manner that can be proven to converge to a true joint distribution for the network. More...
 

Constructor & Destructor Documentation

GClasses::GBNInverseGamma::GBNInverseGamma ( GBNNode pDefaultVal)

General-purpose constructor. The prior mean and deviation parameters are for the Metropolis algorithm. pDefaultVal specifies a bogus value to be used for the parameters of this distribution. Typically, you will change these values (by calling setAlphaAndBeta) after constructing this node. If the "beta" parameter is scale (typically denoted with theta) instead of rate, then betaIsScaleInsteadOfRate should be set to true.

virtual GClasses::GBNInverseGamma::~GBNInverseGamma ( )
inlinevirtual

Member Function Documentation

virtual void GClasses::GBNInverseGamma::addCatParent ( GBNCategorical pNode,
GBNNode pDefaultVal 
)
virtual

Adds a categorical node as a parent of this node. Calling this method will cause This node to resize its table of distribution parameters, so a default value is required to fill in new elements. Typically, you will set these new elements to something more meaningful (by calling setAlphaAndBeta) after you call this method.

Implements GClasses::GBNVariable.

virtual double GClasses::GBNInverseGamma::initMean ( )
virtual
virtual bool GClasses::GBNInverseGamma::isDiscrete ( )
inlinevirtual

Returns false.

Implements GClasses::GBNMetropolisNode.

virtual double GClasses::GBNInverseGamma::likelihood ( double  x)
virtual

Returns the likelihood that the value x would be drawn from this distribution given the current values of all the parent nodes.

Implements GClasses::GBNVariable.

void GClasses::GBNInverseGamma::setAlphaAndBeta ( size_t  cat,
GBNNode pAlpha,
GBNNode pBeta 
)

Set the shape and scale (alpha and beta) values for one of the distributions of this node. "cat" specifies the index of the combination of values (in little-endian order) in the categorical parent distributions for which this distribution is being specified.

Member Data Documentation

std::vector<GBNNode*> GClasses::GBNInverseGamma::m_alphaAndBeta
protected