OpenMined / PyDP

The Python Differential Privacy Library. Built on top of: https://github.com/google/differential-privacy
Apache License 2.0
500 stars 138 forks source link

Naive Bayes with Differential Privacy #337

Closed grilhami closed 3 years ago

grilhami commented 3 years ago

Description

Proof of concept of machine learning with differential privacy. Current implementation involves a differentially private Naive Bayes with Laplace and Geometric mechanism. Further functionalities are added such as validation for epsilon and delta values and privacy budget.

Affected Dependencies

Scikit-learn is one of the primary requirements for the implementation since it involves inheriting from scikit-learn's Naive Bayes class.

How has this been tested?

The best way to see if the implementation works are by the following example, which is similar to Scikit-learn's example :

from sklearn import datasets
from sklearn.model_selection import train_test_split

from pydp.ml.naive_bayes import GaussianNB

dataset = datasets.load_iris()
X_train, X_test, y_train, y_test = train_test_split(dataset.data, dataset.target, test_size=0.2)

clf = GaussianNB()
clf.fit(X_train, y_train)

Checklist

chinmayshah99 commented 3 years ago

Merging it into the branch as the draft is ready and we can do a further development on this.