Skip to main content

A differentially private data synthesizer and fairness intervention benchmark framework

Project description

DP+Fair Benchmarking Framework

This repository provides a Python framework for benchmarking fairness mechanisms on Differentially Private Synthetic Data.


Features

  • ⚡ Simple, reproducible setup for benchmarking algorithms
  • 🧩 Flexible API to plug in any classifier implementing fit, predict, and predict_proba
  • 📊 Pre-offered datasets included under data/
  • 🔬 Configurable experiment settings: dataset schema, dataset synthesizer, seeds, privacy-budget, input/outputs, classifier, data pre-processing.

Installation

To install, clone the repository and install dependencies:

git clone https://github.com/vinicius-verona/dp-fair-intervention-benchmark.git
cd dp-fair-intervention-benchmark
pip install -e .

Alternatively, you can install from PyPI (Yet to be made available):

pip install dp-fair-intervention-benchmark

Repository Structure

├── data/         # Pre-offered datasets
├── src/          # Core source code
├── examples/     # Some demo
├── tests/        # Unit tests
└── README.md

Quick Start

Here is a minimal usage example:

from BenchmarkDPFair.DataGenerator import generate_data, DatasetGeneratorConfig
from BenchmarkDPFair.Benchmark import BenchmarkDatasetConfig, BenchmarkInfo

from sklearn.ensemble import RandomForestClassifier

# Generate Data
data_conf = DatasetGeneratorConfig(
    name = "Adult",
    target= "...",
    synthesizer = "aim",
    root_dir="./data",
    sensitive_attr = "...",
    categorical_cols = [...],
    sensitive_cols = [...],
    privacy_budgets=[...],
    binary_encoder=...
)

generate_data("adult.csv", data_conf, verbose=True) # Saves as CSV

# Dataset configuration
benchmark_config = BenchmarkInfo(
    dp_method="aim",
    output_dir="./data/Adult/output/",
    seeds = [...],
    eps = [...]
)

benchmark_dataset = BenchmarkDatasetConfig(
    name = "Adult",
    target= "income",
    root_dir="./data",
    sensitive_attr = "...",
    index_col="...",
    categorical_cols = [...],
    sensitive_cols = [...],
)

benchmark(benchmark_info=benchmark_config, data_conf=benchmark_dataset)

More detailed examples can be found in the example/ directory.


License

License: MIT


Contributing

Contributions are welcome:

  • Open an issue for bug reports or feature requests
  • Submit a pull request to the main branch for code contributions

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

benchmarkdpfair-0.1.0.tar.gz (22.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

benchmarkdpfair-0.1.0-py3-none-any.whl (26.8 kB view details)

Uploaded Python 3

File details

Details for the file benchmarkdpfair-0.1.0.tar.gz.

File metadata

  • Download URL: benchmarkdpfair-0.1.0.tar.gz
  • Upload date:
  • Size: 22.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for benchmarkdpfair-0.1.0.tar.gz
Algorithm Hash digest
SHA256 02510305de3fa1ecffc4e5d40772d474594b5edc27c32024be12be8fad2487ca
MD5 f0b257224ecd3c1cfe5912ecb1dc0df6
BLAKE2b-256 b70206792850e6d35ea2f01782f8c8671ffeadea42ecdec4e8c79288afcafb7f

See more details on using hashes here.

File details

Details for the file benchmarkdpfair-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for benchmarkdpfair-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 17326f83344ce89ac4e1f7e6fdd603e5dd47f5174e875507d83f7c6131c19dc6
MD5 157d0546b0e8935d47f4908d991ef0bc
BLAKE2b-256 62e11611cdba53f15f6783a4bef0bda6c7dcedb9ddfa293cdeab90e503dd7d6b

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page