MBI: Marginal-Based Estimation and Inference
(with applications to differential privacy)
Documentation can be found at https://private-pgm.readthedocs.io/en/latest/!
Consider joining the Google Differential Privacy community in Slack.
Quick Start
from mbi import Domain, estimation, marginal_loss, callbacks
# Define a domain
domain = Domain(["age", "sex", "income"], [10, 2, 5])
# Provide noisy marginal measurements
measurements = [
marginal_loss.LinearMeasurement(noisy_marginal_1, ("age", "sex")),
marginal_loss.LinearMeasurement(noisy_marginal_2, ("sex", "income")),
]
# Estimate a graphical model
model = estimation.MirrorDescent().estimate(domain, measurements, iters=1000)
# Use the model
synthetic_data = model.synthetic_data(rows=1000)
age_sex_marginal = model.project(("age", "sex")).datavector()
Estimators
All estimators share the same Estimator API:
# Mirror Descent (recommended)
model = estimation.MirrorDescent().estimate(domain, measurements)
# Dual Averaging
model = estimation.DualAveraging().estimate(domain, measurements)
# Interior Gradient
model = estimation.InteriorGradient().estimate(domain, measurements)
Extension estimators provide alternative representations:
from mbi.extensions.mixture_of_products import MixtureOfProductsEstimator
from mbi.extensions.reweighted_dataset import ReweightedDatasetEstimator
# Mixture of Products (scalable, no graphical model)
model = MixtureOfProductsEstimator(num_components=100).estimate(domain, measurements)
# Reweighted Dataset (produces a weighted dataset)
model = ReweightedDatasetEstimator(seed_data=data).estimate(domain, measurements)
Callbacks
Monitor optimization progress with callbacks:
cb = callbacks.default(measurements)
model = estimation.MirrorDescent().estimate(
domain, measurements, iters=1000, callback_fn=cb,
)
Metadata
Release files for mbi 2.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| mbi-2.0.0.tar.gz | 118.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| mbi-2.0.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 204.2 kB
Release files / mbi-2.0.0.tar.gz
| Download URL | mbi-2.0.0.tar.gz |
|---|---|
| Size | 118.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2b48dcdce4aafabaae6fa59622d0e410c017cc79fddeebd08848deba4061b0d8
|
|
BLAKE2b-256 checksum How to use checksums |
aa7633ff83f128d561110d378550077b24711849e9c9ad2265413188a1c1f26d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.7
|
Release files / mbi-2.0.0-py3-none-any.whl
| Download URL | mbi-2.0.0-py3-none-any.whl |
|---|---|
| Size | 86.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
5a335f438dd550da7d9bdeccecfaa5d58e41220d918156f96e1721d708b688cd
|
|
BLAKE2b-256 checksum How to use checksums |
aa371f40e5a869d7b3ffb7a071bba2f3549b1aca69802af3f46d1581f44089ee
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.7
|