Skip to content

Remove PyMC adapter #89

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 7 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ isinstance(backend, mcbackend.Backend)
```

### Part 3: PPL adapters
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.
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.

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

with pm.Model():
# 3. Create your model
# 2. Create your model
...
# 4. Wrap the PyMC adapter around an `mcbackend.Backend`
# This generates and prints a short `trace.run_id` by which
# this MCMC run is identified in the (database) backend.
trace = mcbackend.pymc.TraceBackend(backend)

# 5. Hit the inference button ™
pm.sample(trace=trace)
# 3. Hit the inference button ™ while passing the backend!
pm.sample(trace=backend)
```

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),
so all you need to do is pass any `mcbackend.Backend` via the `pm.sample(trace=...)` parameter!

Instead of using PyMC's built-in NumPy backend, the MCMC draws now end up in ClickHouse.

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

Expand Down
2 changes: 1 addition & 1 deletion mcbackend/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@
except ModuleNotFoundError:
pass

__version__ = "0.4.0"
__version__ = "0.5.0"
Empty file removed mcbackend/adapters/__init__.py
Empty file.
260 changes: 0 additions & 260 deletions mcbackend/adapters/pymc.py

This file was deleted.

Loading