Skip to main content

# 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:

  1. Loading and preprocessing the Adult Census Income dataset
  2. Calculating feature relevance using MIC, Pearson, and Mahalanobis methods
  3. Applying differential privacy with different noise scaling strategies
  4. Evaluating and comparing the utility of each approach
  5. 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.

Feature MAE comparison for MIC-DP vs. state-of-art approaches Prediction MAE comparison for MIC-DP vs. state-of-art approaches

API Reference

Core Functions

  • noise_scaling_MIC(target, features, factor): Calculate noise scaling factors based on Maximum Information Coefficient
  • noise_scaling_pearson(target, features, factor): Calculate noise scaling factors based on Pearson correlation
  • noise_scaling_mahalanobis_distances(target, features, factor): Calculate noise scaling factors based on Mahalanobis distances
  • calculate_sensitivity(features): Calculate sensitivity for each feature based on its range
  • correlated_dp_gaussian(X, noise_factors, sensitivity, epsilon, delta): Apply Gaussian differential privacy with custom noise scaling
  • correlated_dp_laplace(X, noise_factors, sensitivity, epsilon, delta): Apply Laplace differential privacy with custom noise scaling
  • feature_selection(percentage, X, noise_scaling_factor): Select features based on their noise scaling factors
  • mean_absolute_error(y_true, y_pred): Calculate mean absolute error between true and predicted values
  • cluster_and_evaluate(df, name, n_clusters): Perform clustering and evaluate the results
  • calculate_ari(labels1, labels2): Calculate Adjusted Rand Index between two cluster labelings
  • calculate_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.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for mic-dp 0.3.1
File Size Uploaded Provenance Actions
mic_dp-0.3.1.tar.gz 4.1 kB Without provenance Details for mic_dp-0.3.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for mic-dp 0.3.1
File Interpreter ABI Platform Actions
mic_dp-0.3.1-py3-none-any.whl Python 3 none any Details for mic_dp-0.3.1-py3-none-any.whl

Total release size: 8.0 kB

Release files / mic_dp-0.3.1.tar.gz

Download URL mic_dp-0.3.1.tar.gz
Size 4.1 kB
Tags Source
SHA-256 checksum
How to use checksums
5275068bdfbd96f4777f45044de8cdc6afcd9d5d880f368fb2d8d3ee78b545d6
BLAKE2b-256 checksum
How to use checksums
c4634afad3048a10420cc8f1425923372445738b8773c9d244f90ec9692b22b2
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.1-py3-none-any.whl

Download URL mic_dp-0.3.1-py3-none-any.whl
Size 3.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3969eb08714f44440e3c4ef713fab0d2f1d4c906821c72aae64f8696afe48d8c
BLAKE2b-256 checksum
How to use checksums
8800748d42728cd39d742a37f301aba7005c3134dd4261a18faf8a506e4d4978
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.1

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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page