资 源 简 介
PyBLOG Introduction
PyBLOG is an implementation of BLOG in Python. It substitutes functions in first order logic with python functions and dependency statements in the BLOG language with Python functions which return a distribution object.
To get started, simply download the source and add the PyBayesLogic-0.1.0/ directory to your PYTHONPATH. Alternatively, you can also use python setup.py install.
A trivial PyBLOG example
Consider the following code fragment:
```
from pyblog import *
@var_dist
def X(): return Normal(100,1)
@var_dist
def Y(i): return Normal(X(), 1)
ans, = query([X()], [Y(0)==110, Y(1)==106])
print ans.mean(), ans.std_dev()
```
This defines a variable X() which has a Normal distribution and another set of variables Y(.) which have a Normal distribution with mean X(). We want to query the distrib