|
Frog TutorialThe Big Picture
Important Classes
RVs (Random Variables): there is a large hierarchy for random variables,
this will be described later. The main types are: RVs, that contain a name,
unique id and type; Instantiations, that also contain values, and; Sample,
which in addition contains a weight and a probability. |
Measures: these are unnormalized densities or probability functions,
for example: density trees, Gaussians and CPTs. |
BNs (Bayes Nets): this is a special type of measure, inheriting also from
directed graph with nodes being random variables. This class constains
methods such as: add edge and sample. |
Inference: this is performed using a join tree, which is an undirected
graph, this is also a measure. The most vanilla type of inference implemented
is the exact with discrete variables. Other types of inference implemented
are: condition Gaussians exact inference and approximate inference as described
in Uri & Daphne's paper. |
DBNs: this is currently a subclass of BNs, but in future they will
both inherit from a common parent. A DBN doesn't contain CPTs for every
node, since nodes at time t have no CPTs. For performing inference as described
in Xavier & Daphne's paper, the distribution from time t+1 can be translated
to time t. |
Parser: the parser reads a file and calls the BN API to create a
network. There is documentation available about adding new parameters to
the parser, thus, allowing the addition of new parameters to the BN file. |
Learn: a general greedy search algorithm has been implemented to
learn BN structure. Learning has been implemented for comple data and table
CPTs. In future, this will be improved, allowing for incomplete data and
implementing SEM. |
PRMs (Probabilistic Relational Models): this extension of Bayes
Nets permits the creation of a more structured model, but it is still flat
(as opposed to Object Oriented Bayesian Networks). This class implements
learning with complete data and is able to interface with an existing database
(PGSQL). |
SPOOK: this system for implementing Object Oriented Bayes Nets performs
inference by transforming them into a Bayes Net and then uses Frog to perform
the inference step. |
Design DecisionsSmart Pointers
For every class that can be smart pointed, there is a class file (suffix "_cl"), which contains the code for the class itself, and a smart pointer class (suffix "_sptr"). The smart pointer class contains a pointer to the class and an integer to maintain the reference count. All the standard operators are overloaded in the smart pointer class, including: =, -> and new. For example, consider the class Name_cl, which contains a string, and the class Name_sptr which is a smart pointer to Name_cl. The following code is examplifies typical operations using smart pointers: Name_sptr a,b;
NOTE: a is a smart pointer object, it should not be deleted! Now consider a subclass of Name_cl called Surname_cl, the following
code is valid:
In this case, "a" is a superclass of "c", thus there are no problems
in the assignment. On the other hand, if we were trying to assign "a" to
"c", we would normaly have to typecast "a" when doing the assignment. With
smart pointers, we can't use a typecasting, because we don't have a reference
to the object. Thus, we must apply a conversion method:
In general, there exists a method Conv2Type(...), for every
Type
of smart pointer.
Observations:
Some naming conventions:
Random Variables
A Random Variable, Rv, includes:
RecalculateIndex(void), this method must be called when there is a
chance that a different object altered the current index of a variable
in this instantiation. |
|
Comments, questions and suggestions, please contact guestrin@cs.stanford.edu. |