A node in a belief network that represents a categorical distribution. Instances of this class can serve as parent-nodes to any GBNVariable node. The child node must specify distribution parameters for every category that the parent node supports (or for every combination of categories if there are multiply categorical parents).
|
| GBNCategorical (size_t categories, GBNNode *pDefaultWeight) |
| General-purpose constructor. All of the categories will initially be given a weight of pDefaultWeight. Typically, you will want to change these (by calling setWeights) after you construct a node. More...
|
|
virtual | ~GBNCategorical () |
|
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 setWeights) after you call this method. More...
|
|
size_t | categories () |
| Returns the number of categories supported by this distribution. More...
|
|
virtual double | currentValue () |
| Returns the most recent value sampled from this node. More...
|
|
virtual double | likelihood (double x) |
| Computes the likelihood that the specified value (after being truncated to an integer) would be drawn from this categorical distribution given the current values of all the parent nodes of this class. More...
|
|
virtual void | sample (GRand *pRand) |
| Draws a new Gibbs sample for this node given the current values of all other nodes it its Markov blanket. More...
|
|
void | setWeights (size_t cat, GBNNode *pW1, GBNNode *pW2, GBNNode *pW3=NULL, GBNNode *pW4=NULL, GBNNode *pW5=NULL, GBNNode *pW6=NULL, GBNNode *pW7=NULL, GBNNode *pW8=NULL) |
| Set the weights for one of the categorical distributions of this node. If there are n categories in this node, then the first n parameters should be non-NULL. "cat" specifies the index of the combination of values (in little-endian order) in the categorical parent distributions for which this categorical distribution is being specified. More...
|
|
| 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...
|
|
| GBNNode () |
|
virtual | ~GBNNode () |
|