mic-dp 0.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of mic-dp might be problematic. Click here for more details.

mic_dp-0.1/LICENSE ADDED
@@ -0,0 +1,5 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy...
mic_dp-0.1/PKG-INFO ADDED
@@ -0,0 +1,160 @@
1
+ Metadata-Version: 2.1
2
+ Name: mic_dp
3
+ Version: 0.1
4
+ Summary: A Python package for maximum information coefficient differential privacy
5
+ Home-page: https://github.com/uwtintres/mic-dp
6
+ Author: Wenjun Yang, Eyhab Al-masri, Olivera Kotevska
7
+ Author-email: wy927@uw.edu, ealmasri@uw.edu, kotevskao@ornl.gov
8
+ Keywords: differential-privacy mic machine-learning privacy-preserving feature-selection
9
+ Classifier: Programming Language :: Python :: 3
10
+ Classifier: License :: OSI Approved :: MIT License
11
+ Classifier: Intended Audience :: Science/Research
12
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
13
+ Classifier: Topic :: Security :: Cryptography
14
+ Classifier: Development Status :: 4 - Beta
15
+ Requires-Python: >=3.7
16
+ Description-Content-Type: text/markdown
17
+ License-File: LICENSE
18
+ Requires-Dist: diffprivlib
19
+ Requires-Dist: scikit-learn
20
+ Requires-Dist: pandas
21
+ Requires-Dist: numpy
22
+ Requires-Dist: matplotlib
23
+ Requires-Dist: seaborn
24
+ Requires-Dist: scipy
25
+ Requires-Dist: lifelines
26
+ Requires-Dist: statsmodels
27
+
28
+ # MIC_DP: Maximum Information Coefficient Differential Privacy
29
+
30
+ `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.
31
+
32
+ ## Summary
33
+
34
+ This package includes functions for:
35
+ - Calculating MIC, Pearson, and Mahalanobis-based feature relevance
36
+ - Feature selection based on scaled importance
37
+ - Applying Gaussian or Laplace DP mechanisms using custom noise scaling
38
+ - Evaluating MAE, clustering scores, and plotting results
39
+
40
+ 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.
41
+
42
+ ## Installation
43
+
44
+ You can install the package directly from PyPI:
45
+
46
+ ```bash
47
+ pip install micdp
48
+ ```
49
+
50
+ Or install from source:
51
+
52
+ ```bash
53
+ git clone https://github.com/merlery/mic_dp.git
54
+ cd mic_dp
55
+ pip install -e .
56
+ ```
57
+
58
+ ## Quick Start
59
+
60
+ Here's a simple example of how to use `mic_dp` for supervised learning:
61
+
62
+ ```python
63
+ import pandas as pd
64
+ import numpy as np
65
+ from sklearn.preprocessing import MinMaxScaler
66
+ from mic_dp.core import (
67
+ noise_scaling_MIC,
68
+ calculate_sensitivity,
69
+ correlated_dp_gaussian,
70
+ mean_absolute_error
71
+ )
72
+
73
+ # Load and preprocess your data
74
+ df = pd.read_csv('your_dataset.csv')
75
+ df.dropna(inplace=True)
76
+ X = df.select_dtypes(include=['number'])
77
+ X_norm = pd.DataFrame(MinMaxScaler().fit_transform(X), columns=X.columns)
78
+ y = df['target_column'] # Your target variable
79
+
80
+ # Calculate MIC-based noise scaling factors
81
+ noise_factors = noise_scaling_MIC(y, X_norm, amplification_factor=5)
82
+
83
+ # Calculate sensitivity for each feature
84
+ sensitivity = calculate_sensitivity(X_norm)
85
+
86
+ # Apply differential privacy with MIC-guided noise scaling
87
+ private_X = correlated_dp_gaussian(
88
+ X_norm.copy(),
89
+ noise_factors,
90
+ sensitivity,
91
+ epsilon=0.5, # Privacy budget
92
+ delta=1e-5 # Privacy relaxation parameter
93
+ )
94
+
95
+ # Evaluate the utility loss
96
+ mae = mean_absolute_error(X_norm, private_X)
97
+ print(f"Mean Absolute Error: {mae:.4f}")
98
+ ```
99
+
100
+ ## Detailed Example
101
+
102
+ For a more comprehensive example, see the [supervised_experiment.py](examples/supervised_experiment.py) script, which demonstrates:
103
+
104
+ 1. Loading and preprocessing the Adult Census Income dataset
105
+ 2. Calculating feature relevance using MIC, Pearson, and Mahalanobis methods
106
+ 3. Applying differential privacy with different noise scaling strategies
107
+ 4. Evaluating and comparing the utility of each approach
108
+ 5. Visualizing the results
109
+
110
+ To run the example:
111
+
112
+ ```bash
113
+ python examples/supervised_experiment.py
114
+ ```
115
+
116
+ ## Experimental Results
117
+
118
+ MIC-guided noise scaling consistently outperforms conventional approaches in preserving prediction accuracy and clustering structure under differential privacy constraints.
119
+
120
+ ![Feature MAE comparison for MIC-DP vs. state-of-art approaches](MAE.png)
121
+ ![Prediction MAE comparison for MIC-DP vs. state-of-art approaches](MAE_pred.png)
122
+
123
+ ## API Reference
124
+
125
+ ### Core Functions
126
+
127
+ - `noise_scaling_MIC(target, features, factor)`: Calculate noise scaling factors based on Maximum Information Coefficient
128
+ - `noise_scaling_pearson(target, features, factor)`: Calculate noise scaling factors based on Pearson correlation
129
+ - `noise_scaling_mahalanobis_distances(target, features, factor)`: Calculate noise scaling factors based on Mahalanobis distances
130
+ - `calculate_sensitivity(features)`: Calculate sensitivity for each feature based on its range
131
+ - `correlated_dp_gaussian(X, noise_factors, sensitivity, epsilon, delta)`: Apply Gaussian differential privacy with custom noise scaling
132
+ - `correlated_dp_laplace(X, noise_factors, sensitivity, epsilon, delta)`: Apply Laplace differential privacy with custom noise scaling
133
+ - `feature_selection(percentage, X, noise_scaling_factor)`: Select features based on their noise scaling factors
134
+ - `mean_absolute_error(y_true, y_pred)`: Calculate mean absolute error between true and predicted values
135
+ - `cluster_and_evaluate(df, name, n_clusters)`: Perform clustering and evaluate the results
136
+ - `calculate_ari(labels1, labels2)`: Calculate Adjusted Rand Index between two cluster labelings
137
+ - `calculate_v_measure(labels1, labels2)`: Calculate V-measure between two cluster labelings
138
+
139
+ ## Citation
140
+
141
+ If you use this package in your research, please cite:
142
+
143
+ ```
144
+ @article{yang2025micdp,
145
+ title={mic\_dp: A Python package for maximum information coefficient differential privacy},
146
+ author={Yang, Wenjun and Al-masri, Eyhab and Kotevska, Olivera},
147
+ journal={Journal of Open Source Software},
148
+ year={2025}
149
+ }
150
+ ```
151
+
152
+ ## License
153
+
154
+ This project is licensed under the MIT License - see the LICENSE file for details.
155
+
156
+ ## Acknowledgements
157
+
158
+ We acknowledge the creators of the ACI and HED datasets for making their data publicly available.
159
+
160
+ ## References
mic_dp-0.1/README.md ADDED
@@ -0,0 +1,133 @@
1
+ # MIC_DP: Maximum Information Coefficient Differential Privacy
2
+
3
+ `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.
4
+
5
+ ## Summary
6
+
7
+ This package includes functions for:
8
+ - Calculating MIC, Pearson, and Mahalanobis-based feature relevance
9
+ - Feature selection based on scaled importance
10
+ - Applying Gaussian or Laplace DP mechanisms using custom noise scaling
11
+ - Evaluating MAE, clustering scores, and plotting results
12
+
13
+ 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.
14
+
15
+ ## Installation
16
+
17
+ You can install the package directly from PyPI:
18
+
19
+ ```bash
20
+ pip install micdp
21
+ ```
22
+
23
+ Or install from source:
24
+
25
+ ```bash
26
+ git clone https://github.com/merlery/mic_dp.git
27
+ cd mic_dp
28
+ pip install -e .
29
+ ```
30
+
31
+ ## Quick Start
32
+
33
+ Here's a simple example of how to use `mic_dp` for supervised learning:
34
+
35
+ ```python
36
+ import pandas as pd
37
+ import numpy as np
38
+ from sklearn.preprocessing import MinMaxScaler
39
+ from mic_dp.core import (
40
+ noise_scaling_MIC,
41
+ calculate_sensitivity,
42
+ correlated_dp_gaussian,
43
+ mean_absolute_error
44
+ )
45
+
46
+ # Load and preprocess your data
47
+ df = pd.read_csv('your_dataset.csv')
48
+ df.dropna(inplace=True)
49
+ X = df.select_dtypes(include=['number'])
50
+ X_norm = pd.DataFrame(MinMaxScaler().fit_transform(X), columns=X.columns)
51
+ y = df['target_column'] # Your target variable
52
+
53
+ # Calculate MIC-based noise scaling factors
54
+ noise_factors = noise_scaling_MIC(y, X_norm, amplification_factor=5)
55
+
56
+ # Calculate sensitivity for each feature
57
+ sensitivity = calculate_sensitivity(X_norm)
58
+
59
+ # Apply differential privacy with MIC-guided noise scaling
60
+ private_X = correlated_dp_gaussian(
61
+ X_norm.copy(),
62
+ noise_factors,
63
+ sensitivity,
64
+ epsilon=0.5, # Privacy budget
65
+ delta=1e-5 # Privacy relaxation parameter
66
+ )
67
+
68
+ # Evaluate the utility loss
69
+ mae = mean_absolute_error(X_norm, private_X)
70
+ print(f"Mean Absolute Error: {mae:.4f}")
71
+ ```
72
+
73
+ ## Detailed Example
74
+
75
+ For a more comprehensive example, see the [supervised_experiment.py](examples/supervised_experiment.py) script, which demonstrates:
76
+
77
+ 1. Loading and preprocessing the Adult Census Income dataset
78
+ 2. Calculating feature relevance using MIC, Pearson, and Mahalanobis methods
79
+ 3. Applying differential privacy with different noise scaling strategies
80
+ 4. Evaluating and comparing the utility of each approach
81
+ 5. Visualizing the results
82
+
83
+ To run the example:
84
+
85
+ ```bash
86
+ python examples/supervised_experiment.py
87
+ ```
88
+
89
+ ## Experimental Results
90
+
91
+ MIC-guided noise scaling consistently outperforms conventional approaches in preserving prediction accuracy and clustering structure under differential privacy constraints.
92
+
93
+ ![Feature MAE comparison for MIC-DP vs. state-of-art approaches](MAE.png)
94
+ ![Prediction MAE comparison for MIC-DP vs. state-of-art approaches](MAE_pred.png)
95
+
96
+ ## API Reference
97
+
98
+ ### Core Functions
99
+
100
+ - `noise_scaling_MIC(target, features, factor)`: Calculate noise scaling factors based on Maximum Information Coefficient
101
+ - `noise_scaling_pearson(target, features, factor)`: Calculate noise scaling factors based on Pearson correlation
102
+ - `noise_scaling_mahalanobis_distances(target, features, factor)`: Calculate noise scaling factors based on Mahalanobis distances
103
+ - `calculate_sensitivity(features)`: Calculate sensitivity for each feature based on its range
104
+ - `correlated_dp_gaussian(X, noise_factors, sensitivity, epsilon, delta)`: Apply Gaussian differential privacy with custom noise scaling
105
+ - `correlated_dp_laplace(X, noise_factors, sensitivity, epsilon, delta)`: Apply Laplace differential privacy with custom noise scaling
106
+ - `feature_selection(percentage, X, noise_scaling_factor)`: Select features based on their noise scaling factors
107
+ - `mean_absolute_error(y_true, y_pred)`: Calculate mean absolute error between true and predicted values
108
+ - `cluster_and_evaluate(df, name, n_clusters)`: Perform clustering and evaluate the results
109
+ - `calculate_ari(labels1, labels2)`: Calculate Adjusted Rand Index between two cluster labelings
110
+ - `calculate_v_measure(labels1, labels2)`: Calculate V-measure between two cluster labelings
111
+
112
+ ## Citation
113
+
114
+ If you use this package in your research, please cite:
115
+
116
+ ```
117
+ @article{yang2025micdp,
118
+ title={mic\_dp: A Python package for maximum information coefficient differential privacy},
119
+ author={Yang, Wenjun and Al-masri, Eyhab and Kotevska, Olivera},
120
+ journal={Journal of Open Source Software},
121
+ year={2025}
122
+ }
123
+ ```
124
+
125
+ ## License
126
+
127
+ This project is licensed under the MIT License - see the LICENSE file for details.
128
+
129
+ ## Acknowledgements
130
+
131
+ We acknowledge the creators of the ACI and HED datasets for making their data publicly available.
132
+
133
+ ## References
@@ -0,0 +1,160 @@
1
+ Metadata-Version: 2.1
2
+ Name: mic_dp
3
+ Version: 0.1
4
+ Summary: A Python package for maximum information coefficient differential privacy
5
+ Home-page: https://github.com/uwtintres/mic-dp
6
+ Author: Wenjun Yang, Eyhab Al-masri, Olivera Kotevska
7
+ Author-email: wy927@uw.edu, ealmasri@uw.edu, kotevskao@ornl.gov
8
+ Keywords: differential-privacy mic machine-learning privacy-preserving feature-selection
9
+ Classifier: Programming Language :: Python :: 3
10
+ Classifier: License :: OSI Approved :: MIT License
11
+ Classifier: Intended Audience :: Science/Research
12
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
13
+ Classifier: Topic :: Security :: Cryptography
14
+ Classifier: Development Status :: 4 - Beta
15
+ Requires-Python: >=3.7
16
+ Description-Content-Type: text/markdown
17
+ License-File: LICENSE
18
+ Requires-Dist: diffprivlib
19
+ Requires-Dist: scikit-learn
20
+ Requires-Dist: pandas
21
+ Requires-Dist: numpy
22
+ Requires-Dist: matplotlib
23
+ Requires-Dist: seaborn
24
+ Requires-Dist: scipy
25
+ Requires-Dist: lifelines
26
+ Requires-Dist: statsmodels
27
+
28
+ # MIC_DP: Maximum Information Coefficient Differential Privacy
29
+
30
+ `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.
31
+
32
+ ## Summary
33
+
34
+ This package includes functions for:
35
+ - Calculating MIC, Pearson, and Mahalanobis-based feature relevance
36
+ - Feature selection based on scaled importance
37
+ - Applying Gaussian or Laplace DP mechanisms using custom noise scaling
38
+ - Evaluating MAE, clustering scores, and plotting results
39
+
40
+ 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.
41
+
42
+ ## Installation
43
+
44
+ You can install the package directly from PyPI:
45
+
46
+ ```bash
47
+ pip install micdp
48
+ ```
49
+
50
+ Or install from source:
51
+
52
+ ```bash
53
+ git clone https://github.com/merlery/mic_dp.git
54
+ cd mic_dp
55
+ pip install -e .
56
+ ```
57
+
58
+ ## Quick Start
59
+
60
+ Here's a simple example of how to use `mic_dp` for supervised learning:
61
+
62
+ ```python
63
+ import pandas as pd
64
+ import numpy as np
65
+ from sklearn.preprocessing import MinMaxScaler
66
+ from mic_dp.core import (
67
+ noise_scaling_MIC,
68
+ calculate_sensitivity,
69
+ correlated_dp_gaussian,
70
+ mean_absolute_error
71
+ )
72
+
73
+ # Load and preprocess your data
74
+ df = pd.read_csv('your_dataset.csv')
75
+ df.dropna(inplace=True)
76
+ X = df.select_dtypes(include=['number'])
77
+ X_norm = pd.DataFrame(MinMaxScaler().fit_transform(X), columns=X.columns)
78
+ y = df['target_column'] # Your target variable
79
+
80
+ # Calculate MIC-based noise scaling factors
81
+ noise_factors = noise_scaling_MIC(y, X_norm, amplification_factor=5)
82
+
83
+ # Calculate sensitivity for each feature
84
+ sensitivity = calculate_sensitivity(X_norm)
85
+
86
+ # Apply differential privacy with MIC-guided noise scaling
87
+ private_X = correlated_dp_gaussian(
88
+ X_norm.copy(),
89
+ noise_factors,
90
+ sensitivity,
91
+ epsilon=0.5, # Privacy budget
92
+ delta=1e-5 # Privacy relaxation parameter
93
+ )
94
+
95
+ # Evaluate the utility loss
96
+ mae = mean_absolute_error(X_norm, private_X)
97
+ print(f"Mean Absolute Error: {mae:.4f}")
98
+ ```
99
+
100
+ ## Detailed Example
101
+
102
+ For a more comprehensive example, see the [supervised_experiment.py](examples/supervised_experiment.py) script, which demonstrates:
103
+
104
+ 1. Loading and preprocessing the Adult Census Income dataset
105
+ 2. Calculating feature relevance using MIC, Pearson, and Mahalanobis methods
106
+ 3. Applying differential privacy with different noise scaling strategies
107
+ 4. Evaluating and comparing the utility of each approach
108
+ 5. Visualizing the results
109
+
110
+ To run the example:
111
+
112
+ ```bash
113
+ python examples/supervised_experiment.py
114
+ ```
115
+
116
+ ## Experimental Results
117
+
118
+ MIC-guided noise scaling consistently outperforms conventional approaches in preserving prediction accuracy and clustering structure under differential privacy constraints.
119
+
120
+ ![Feature MAE comparison for MIC-DP vs. state-of-art approaches](MAE.png)
121
+ ![Prediction MAE comparison for MIC-DP vs. state-of-art approaches](MAE_pred.png)
122
+
123
+ ## API Reference
124
+
125
+ ### Core Functions
126
+
127
+ - `noise_scaling_MIC(target, features, factor)`: Calculate noise scaling factors based on Maximum Information Coefficient
128
+ - `noise_scaling_pearson(target, features, factor)`: Calculate noise scaling factors based on Pearson correlation
129
+ - `noise_scaling_mahalanobis_distances(target, features, factor)`: Calculate noise scaling factors based on Mahalanobis distances
130
+ - `calculate_sensitivity(features)`: Calculate sensitivity for each feature based on its range
131
+ - `correlated_dp_gaussian(X, noise_factors, sensitivity, epsilon, delta)`: Apply Gaussian differential privacy with custom noise scaling
132
+ - `correlated_dp_laplace(X, noise_factors, sensitivity, epsilon, delta)`: Apply Laplace differential privacy with custom noise scaling
133
+ - `feature_selection(percentage, X, noise_scaling_factor)`: Select features based on their noise scaling factors
134
+ - `mean_absolute_error(y_true, y_pred)`: Calculate mean absolute error between true and predicted values
135
+ - `cluster_and_evaluate(df, name, n_clusters)`: Perform clustering and evaluate the results
136
+ - `calculate_ari(labels1, labels2)`: Calculate Adjusted Rand Index between two cluster labelings
137
+ - `calculate_v_measure(labels1, labels2)`: Calculate V-measure between two cluster labelings
138
+
139
+ ## Citation
140
+
141
+ If you use this package in your research, please cite:
142
+
143
+ ```
144
+ @article{yang2025micdp,
145
+ title={mic\_dp: A Python package for maximum information coefficient differential privacy},
146
+ author={Yang, Wenjun and Al-masri, Eyhab and Kotevska, Olivera},
147
+ journal={Journal of Open Source Software},
148
+ year={2025}
149
+ }
150
+ ```
151
+
152
+ ## License
153
+
154
+ This project is licensed under the MIT License - see the LICENSE file for details.
155
+
156
+ ## Acknowledgements
157
+
158
+ We acknowledge the creators of the ACI and HED datasets for making their data publicly available.
159
+
160
+ ## References
@@ -0,0 +1,9 @@
1
+ LICENSE
2
+ README.md
3
+ pyproject.toml
4
+ setup.py
5
+ mic_dp.egg-info/PKG-INFO
6
+ mic_dp.egg-info/SOURCES.txt
7
+ mic_dp.egg-info/dependency_links.txt
8
+ mic_dp.egg-info/requires.txt
9
+ mic_dp.egg-info/top_level.txt
@@ -0,0 +1,9 @@
1
+ diffprivlib
2
+ scikit-learn
3
+ pandas
4
+ numpy
5
+ matplotlib
6
+ seaborn
7
+ scipy
8
+ lifelines
9
+ statsmodels
@@ -0,0 +1 @@
1
+
@@ -0,0 +1,3 @@
1
+ [build-system]
2
+ requires = ["setuptools>=42", "wheel"]
3
+ build-backend = "setuptools.build_meta"
mic_dp-0.1/setup.cfg ADDED
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
mic_dp-0.1/setup.py ADDED
@@ -0,0 +1,35 @@
1
+ from setuptools import setup, find_packages
2
+
3
+ setup(
4
+ name="mic_dp",
5
+ version="0.1",
6
+ packages=find_packages(),
7
+ install_requires=[
8
+ "diffprivlib",
9
+ "scikit-learn",
10
+ "pandas",
11
+ "numpy",
12
+ "matplotlib",
13
+ "seaborn",
14
+ "scipy",
15
+ "lifelines",
16
+ "statsmodels"
17
+ ],
18
+ author="Wenjun Yang, Eyhab Al-masri, Olivera Kotevska",
19
+ author_email="wy927@uw.edu, ealmasri@uw.edu, kotevskao@ornl.gov",
20
+ description="A Python package for maximum information coefficient differential privacy",
21
+ long_description=open("README.md").read(),
22
+ long_description_content_type="text/markdown",
23
+ keywords="differential-privacy mic machine-learning privacy-preserving feature-selection",
24
+ url="https://github.com/uwtintres/mic-dp",
25
+ classifiers=[
26
+ "Programming Language :: Python :: 3",
27
+ "License :: OSI Approved :: MIT License",
28
+ "Intended Audience :: Science/Research",
29
+ "Topic :: Scientific/Engineering :: Artificial Intelligence",
30
+ "Topic :: Security :: Cryptography",
31
+ "Development Status :: 4 - Beta"
32
+ ],
33
+ python_requires=">=3.7",
34
+ include_package_data=True,
35
+ )