MIC_DP: Maximum Information Coefficient Differential Privacy
mic_dp is a Python package that enables differentially private data transformation guided by the Maximum Information Coefficient (MIC), with application to both supervised and unsupervised learning tasks. Traditional differential privacy (DP) mechanisms often degrade utility uniformly across features. In contrast, mic_dp uses MIC to scale the noise injection, preserving more utility in informative features.
Summary
This package includes functions for:
- Calculating MIC, Pearson, and Mahalanobis-based feature relevance
- Feature selection based on scaled importance
- Applying Gaussian or Laplace DP mechanisms using custom noise scaling
- Evaluating MAE, clustering scores, and plotting results
Our experiments show that MIC-guided DP mechanisms consistently outperform Pearson, Mahalanobis, and baseline DP in terms of feature and prediction accuracy under privacy constraints. In unsupervised settings, MIC-DP preserves cluster structures better, as shown by silhouette score, ARI, and V-measure.
Installation
You can install the package directly from PyPI:
pip install mic-dp
Or install from source:
git clone https://github.com/merlery/mic_dp.git
cd mic_dp
pip install -e .
Quick Start
Here's a simple example of how to use mic_dp for supervised learning:
import pandas as pd
import numpy as np
from sklearn.preprocessing import MinMaxScaler
from core import (
noise_scaling_MIC,
calculate_sensitivity,
correlated_dp_gaussian,
mean_absolute_error
)
# Load and preprocess your data
df = pd.read_csv('your_dataset.csv')
df.dropna(inplace=True)
X = df.select_dtypes(include=['number'])
X_norm = pd.DataFrame(MinMaxScaler().fit_transform(X), columns=X.columns)
y = df['target_column'] # Your target variable
# Calculate MIC-based noise scaling factors
noise_factors = noise_scaling_MIC(y, X_norm, amplification_factor=5)
# Calculate sensitivity for each feature
sensitivity = calculate_sensitivity(X_norm)
# Apply differential privacy with MIC-guided noise scaling
private_X = correlated_dp_gaussian(
X_norm.copy(),
noise_factors,
sensitivity,
epsilon=0.5, # Privacy budget
delta=1e-5 # Privacy relaxation parameter
)
# Evaluate the utility loss
mae = mean_absolute_error(X_norm, private_X)
print(f"Mean Absolute Error: {mae:.4f}")
Detailed Example
For a more comprehensive example, see the supervised_experiment.py script, which demonstrates:
- Loading and preprocessing the Adult Census Income dataset
- Calculating feature relevance using MIC, Pearson, and Mahalanobis methods
- Applying differential privacy with different noise scaling strategies
- Evaluating and comparing the utility of each approach
- Visualizing the results
To run the example:
python examples/supervised_experiment.py
Experimental Results
MIC-guided noise scaling consistently outperforms conventional approaches in preserving prediction accuracy and clustering structure under differential privacy constraints.
API Reference
Core Functions
noise_scaling_MIC(target, features, factor): Calculate noise scaling factors based on Maximum Information Coefficientnoise_scaling_pearson(target, features, factor): Calculate noise scaling factors based on Pearson correlationnoise_scaling_mahalanobis_distances(target, features, factor): Calculate noise scaling factors based on Mahalanobis distancescalculate_sensitivity(features): Calculate sensitivity for each feature based on its rangecorrelated_dp_gaussian(X, noise_factors, sensitivity, epsilon, delta): Apply Gaussian differential privacy with custom noise scalingcorrelated_dp_laplace(X, noise_factors, sensitivity, epsilon, delta): Apply Laplace differential privacy with custom noise scalingfeature_selection(percentage, X, noise_scaling_factor): Select features based on their noise scaling factorsmean_absolute_error(y_true, y_pred): Calculate mean absolute error between true and predicted valuescluster_and_evaluate(df, name, n_clusters): Perform clustering and evaluate the resultscalculate_ari(labels1, labels2): Calculate Adjusted Rand Index between two cluster labelingscalculate_v_measure(labels1, labels2): Calculate V-measure between two cluster labelings
Citation
If you use this package in your research, please cite:
@article{yang2025micdp,
title = {MIC-DP: A Scalable Correlation-Aware Differential Privacy Framework for High-Dimensional Data},
author = {Yang, Wenjun and Al-Masri, Eyhab and Kotevska, Olivera},
journal = {IEEE Transactions on Privacy},
volume = {2},
pages = {131--143},
year = {2025},
doi = {10.1109/TP.2025.3620376}
}
License
This project is licensed under the MIT License - see the LICENSE file for details.
Acknowledgements
We acknowledge the creators of the ACI and HED datasets for making their data publicly available.
References
Metadata
Release files for mic-dp 0.3.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| mic_dp-0.3.2.tar.gz | 4.1 kB | Without provenance | Details for mic_dp-0.3.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| mic_dp-0.3.2-py3-none-any.whl | Python 3 | none | any | Details for mic_dp-0.3.2-py3-none-any.whl |
Total release size: 7.9 kB
Release files / mic_dp-0.3.2.tar.gz
| Download URL | mic_dp-0.3.2.tar.gz |
|---|---|
| Size | 4.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
cbea2e9f9e9432399d21e7bb7481df1c4c67194330495e1f20f48b050a28d9e2
|
|
BLAKE2b-256 checksum How to use checksums |
9e7bf9fb06826e7808370f518e4e75eb4fdfd6199ab873648b40955dd8c66926
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.10.2
|
Release files / mic_dp-0.3.2-py3-none-any.whl
| Download URL | mic_dp-0.3.2-py3-none-any.whl |
|---|---|
| Size | 3.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
485f7c5b1dc54370349f328ca5be1431d84b5c0a530f28a5864b0d05e4a27cf2
|
|
BLAKE2b-256 checksum How to use checksums |
1f992225e6de919e30af501030930af836861576e88cdeee5686ff5e7b6e5ef8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.10.2
|
Security for mic-dp 0.3.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.