Skip to content

Commit

Permalink
Start readme update to have example usage
Browse files Browse the repository at this point in the history
  • Loading branch information
thejinxters committed Nov 7, 2014
1 parent edf811d commit c3cbe6b
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 2 deletions.
24 changes: 24 additions & 0 deletions Readme.md
Expand Up @@ -11,6 +11,14 @@ PBNT Usage
-------------------
You must first have the [NumPy](http://www.numpy.org/) package installed.

###The included example network:
The example files give a simple example of how a Bayes Network can be implemented. It uses a Bayes Network created from 4 nodes, Cloudy, Rainy, Sprinkler, and WetGrass.

Here is a layout of what the network looks like
Inline-style:
![alt text](examples/bayesnet-example.jpg "Cloudy,Sprinker,Rain,WetGrass Example Network")


To run the example files navigate to the examples directory and run:
```
python exampleinference.py
Expand All @@ -21,6 +29,22 @@ The marginal probability of sprinkler=false: 0.7
The marginal probability of wetgrass=false | cloudy=False, rain=True: 0.3025
```

Creating a Model:
-------------------

**BayesNode(id,numValues,name)**

- id: Integer Identification of the node
- numValues: Number of associated values with the node
- name: name for the node in form ```name="name_of_node"```

Example:
```python
cNode = BayesNode(0, 2, name="cloudy")
```

To Be Completed...


Project information
-------------------
Expand Down
2 changes: 0 additions & 2 deletions examples/ExampleModels.py
Expand Up @@ -79,7 +79,6 @@ def water():
#cloudy distribution
cDistribution = DiscreteDistribution(cNode)
index = cDistribution.generate_index([],[])
# embed()
cDistribution[index] = 0.5
cNode.set_dist(cDistribution)

Expand Down Expand Up @@ -111,4 +110,3 @@ def water():
bnet = BayesNet(nodes)

return bnet

Binary file added examples/bayesnet-example.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit c3cbe6b

Please sign in to comment.