Logistic Regression
Problem Formulation
Given covariates \(X \in \mathbb{R}^{n \times d}\) and binary responses \(y \in \{0, 1\}^n\), estimate the coefficient vector \(\theta \in \mathbb{R}^d\) of the logistic model
\[\Pr(y_i = 1 \mid x_i) = \sigma(x_i^\top \theta), \qquad \sigma(t) = \frac{1}{1 + e^{-t}}\]
The non-private estimator is the maximum-likelihood fit (minimizer of the average logistic loss). Under differential privacy we want a release \(\tilde{\theta}\) that satisfies \(\varepsilon\)-DP or \((\varepsilon, \delta)\)-DP while staying close to the MLE \(\hat{\theta}\).
API Reference
Types, algorithms (with their privacy arguments + hyperparameter defaults), instance generators, and metrics are documented from the source docstrings on the Logistic Regression API Reference page.
Usage Example
from dp_testing_platform import PureDPBudget
from dp_testing_platform.tasks.logistic_regression.instance_generators import (
GaussianCovariates,
)
from dp_testing_platform.tasks.logistic_regression.algorithms import (
LogisticRegressionNewton,
)
gen = GaussianCovariates(n_samples=500, dim=5, metric="l2_error_to_ground_truth")
metadata, input_data, metric = gen.generate(seed=0)
out = LogisticRegressionNewton().run(metadata, input_data, PureDPBudget(1.0), seed=0)
print(f"L2 error to ground truth: {metric(out):.4f}")