Skip to content

Commit

Permalink
Merge pull request #19 from sharanry/Readme
Browse files Browse the repository at this point in the history
[WIP] Update Readme
  • Loading branch information
ColCarroll committed Aug 6, 2018
2 parents 8eb5dff + 04b003e commit 7c5cc53
Showing 1 changed file with 43 additions and 0 deletions.
43 changes: 43 additions & 0 deletions README.md
Expand Up @@ -2,6 +2,49 @@

Pre-release development of high-level probabilistic programming interface for TensorFlow. Please contribute or participate [on github](https://github.com/pymc-devs/pymc4).

## Installation Instructions
- Install using `pip`
``` bash
pip install --user git+https://github.com/pymc-devs/pymc4.git@functional#egg=pymc4
```

## Simple Example
### Import pymc4 and Edward2
``` python
import pymc4 as pm
from tensorflow_probability import edward2 as ed
```
### Model Initialization
``` python
model = pm.Model()
```

### Model Definition
The model has to be defined in a single function with `@[model-name].define` decorator.
``` python
@model.define
def simple(cfg):
normal = ed.Normal(loc=0., scale=1., name='normal')
```

### Sampling
``` python
trace = pm.sample(model)
```

### Visualize the trace using arviz
``` python
# See https://github.com/arviz-devs/arviz
# pip install git+git://github.com/arviz-devs/arviz.git
import arviz as az

posterior_data = az.convert_to_xarray(trace, chains=1)
az.posteriorplot(posterior_data, figsize=(8, 4), textsize=15, round_to=2);
```


Here is a [blog post](https://sharanry.github.io/post/eight-schools-model/) showcasing the differences between PyMC3 and PyMC4 using the Eight Schools model.

## Contributors

For a full list of code contributors based on code checkin activity, see the [GitHub contributor page](https://github.com/pymc-devs/pymc4/graphs/contributors).
Expand Down

0 comments on commit 7c5cc53

Please sign in to comment.