Skip to content

Getting Started

Install the DP Testing Platform and confirm it runs. When you are set up, Running the Benchmark takes your own DP algorithm through the full loop on the real dataset corpus.

Define algorithms in an importable module, not your run script

On macOS and Windows the engine runs each evaluation in a spawn subprocess, which re-imports your code. A class (an algorithm or a task) defined in your top-level script (__main__) is sent to the worker by value, which duplicates the task object and breaks the framework's task-identity checks — you will see Cannot lift: ... errors and inf results. Always put your algorithm in a separate, importable module (my_algorithm.py) and import it; never define it in the script you run. This is the single most common setup mistake, so it is worth knowing before you write any code.

Prerequisites

  • Python 3.10 or higher
  • pip (Python package manager)

Install

Install from source. A PyPI release is coming soon; until then, clone the repository and install it in editable mode:

# From PyPI (coming soon):
# pip install dp-testing-platform

# From source:
git clone https://github.com/saminulh/dp-testing-platform.git
pip install -e /path/to/dp-testing-platform

The clone can live anywhere on your filesystem — pip install -e links to the source location, so your project imports the library wherever the source resides. Working inside a virtual environment (python3 -m venv .venv && source .venv/bin/activate) keeps the install isolated.

Confirm the install

Check that the package imports and lists the built-in algorithms for a task:

dp-testing-platform list-algorithms --task linear_regression
Algorithms for task 'linear_regression' (Linear Regression):

ExponentialMechanism
  Grid-based exponential mechanism for linear regression.
  ...
OLS
  Non-private ordinary least squares (baseline).
  Hyperparameters: (none)

Each task ships a roster of DP algorithms plus a non-private reference. Swap in any task ID from the table below.

Available tasks

Task ID Description
m_estimation Generalized M-estimation (minimize an empirical loss)
mean_estimation Estimate the mean of a d-dimensional dataset
median_estimation Estimate the median of a 1-dimensional dataset
linear_regression Fit a linear model to (X, y) data
simple_linear_regression Fit a line (slope, intercept) to a single scalar covariate
single_parameter_estimation Estimate one coefficient of interest from a regression
logistic_regression Fit a binary logistic model to (X, y) data

mean_estimation, median_estimation, and linear_regression are children of m_estimation: any algorithm registered on the parent automatically runs on the child tasks (the framework lifts the data into the parent's format).

Next step

Running the Benchmark — wrap your own DP algorithm, run it over the real dataset corpus at the protocol grid, read the per-dataset results, and export a shareable, hash-verified run archive.