Skip to content

Commit 5dca137

Browse files
Remove PyMC adapter
It's now supported by PyMC directly, since v5.1.1. Closes #11 because adapters should no longer be located here.
1 parent 114f38d commit 5dca137

File tree

6 files changed

+8
-429
lines changed

6 files changed

+8
-429
lines changed

README.md

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ isinstance(backend, mcbackend.Backend)
4141
```
4242

4343
### Part 3: PPL adapters
44-
Anything that is a `Backend` can be wrapped by an [adapter ](https://en.wikipedia.org/wiki/Adapter_pattern) that makes it compatible with your favorite PPL.
44+
Anything that is a `Backend` can be wrapped by an [adapter](https://en.wikipedia.org/wiki/Adapter_pattern) that makes it compatible with your favorite PPL.
4545

4646
In the example below, a `ClickHouseBackend` is initialized to store MCMC draws from a PyMC model in a [ClickHouse](http://clickhouse.com/) database.
4747
See below for [how to run it in Docker](#development).
@@ -56,17 +56,15 @@ ch_client = clickhouse_driver.Client("localhost")
5656
backend = mcbackend.ClickHouseBackend(ch_client)
5757

5858
with pm.Model():
59-
# 3. Create your model
59+
# 2. Create your model
6060
...
61-
# 4. Wrap the PyMC adapter around an `mcbackend.Backend`
62-
# This generates and prints a short `trace.run_id` by which
63-
# this MCMC run is identified in the (database) backend.
64-
trace = mcbackend.pymc.TraceBackend(backend)
65-
66-
# 5. Hit the inference button ™
67-
pm.sample(trace=trace)
61+
# 3. Hit the inference button ™ while passing the backend!
62+
pm.sample(trace=backend)
6863
```
6964

65+
In case of PyMC the adapter lives in the PyMC codebase [since version 5.1.1](https://github.com/pymc-devs/pymc/releases/tag/v5.1.1),
66+
so all you need to do is pass any `mcbackend.Backend` via the `pm.sample(trace=...)` parameter!
67+
7068
Instead of using PyMC's built-in NumPy backend, the MCMC draws now end up in ClickHouse.
7169

7270
### Retrieving the `draws` & `stats`
@@ -103,7 +101,6 @@ For example:
103101
* Schema discussion: Which metadata is needed? (related: [PyMC #5160](https://github.com/pymc-devs/pymc/issues/5160))
104102
* Interface discussion: How should `Backend`/`Run`/`Chain` evolve?
105103
* Python Backends for disk storage (HDF5, `*.proto`, ...)
106-
* An `emcee` adapter (#11).
107104
* C++ `Backend`/`Run`/`Chain` interfaces
108105
* C++ ClickHouse backend (via [`clickhouse-cpp`](https://github.com/ClickHouse/clickhouse-cpp))
109106

mcbackend/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,4 @@
1212
except ModuleNotFoundError:
1313
pass
1414

15-
__version__ = "0.4.0"
15+
__version__ = "0.5.0"

mcbackend/adapters/__init__.py

Whitespace-only changes.

mcbackend/adapters/pymc.py

Lines changed: 0 additions & 260 deletions
This file was deleted.

0 commit comments

Comments
 (0)