From 9443837a185fcc0345425a549e74b41380bb05c0 Mon Sep 17 00:00:00 2001 From: Sharan Yalburgi Date: Thu, 2 Aug 2018 17:58:04 +0530 Subject: [PATCH 1/3] Edit Readme --- README.md | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/README.md b/README.md index c4a647f2..9218d9a9 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,44 @@ 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 git+https://github.com/pymc-devs/pymc4.git + ``` + +## 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 +# Add code here +``` + + +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). From 9155e5df75017d72826dff1cf11e82bb992dd0c9 Mon Sep 17 00:00:00 2001 From: Sharan Yalburgi Date: Sun, 5 Aug 2018 20:44:42 +0530 Subject: [PATCH 2/3] Edit Readme1 --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 9218d9a9..30c1978d 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ Pre-release development of high-level probabilistic programming interface for Te ## Installation Instructions - Install using `pip` ``` bash - pip install git+https://github.com/pymc-devs/pymc4.git + pip install --user git+https://github.com/pymc-devs/pymc4.git@functional#egg=pymc4 ``` ## Simple Example From 04b003e68b9f3c0cd561b51cf1281522e6ce4393 Mon Sep 17 00:00:00 2001 From: Sharan Yalburgi Date: Mon, 6 Aug 2018 10:35:28 +0530 Subject: [PATCH 3/3] Edit Readme --- README.md | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 30c1978d..535a6a3d 100644 --- a/README.md +++ b/README.md @@ -24,7 +24,7 @@ The model has to be defined in a single function with `@[model-name].define` dec ``` python @model.define def simple(cfg): - normal = ed.Normal(loc=0. scale=1., name='normal') + normal = ed.Normal(loc=0., scale=1., name='normal') ``` ### Sampling @@ -34,7 +34,12 @@ trace = pm.sample(model) ### Visualize the trace using arviz ``` python -# Add code here +# 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); ```