Skip to content

Commit

Permalink
updated readme and package format
Browse files Browse the repository at this point in the history
  • Loading branch information
BielStela committed Nov 26, 2018
1 parent c060ac2 commit 10f6c79
Show file tree
Hide file tree
Showing 6 changed files with 104 additions and 8 deletions.
67 changes: 59 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,62 @@
# Membership Inference Attacks
Python package to create adversarial agents for membership inference attacks againts machine learning models.
Python package to create adversarial agents for membership inference attacks against machine learning models.

Implementation of the work done by Shokri _et al_: [paper](https://www.cs.cornell.edu/~shmat/shmat_oak17.pdf)
Implementation of the work done by Shokri _et al_ ([paper](https://www.cs.cornell.edu/~shmat/shmat_oak17.pdf))

## TO DO
* Basic package outline
* Shadow Model and Attack Model
* Shadow dataset generator using the data synthesis algorithm proposeb by Shokri _et al_
* Dummy example with Iris dataset
* Expand functionality and generalization of the package
# Examples
Find some examples in `notebooks/`

The main classes and functions are:

### Data Synthetiser

To synthesize data only using a black-box like model `target_model` and predictions using the algorithm proposed by Shokri _et al_

```python
from mblearn import synthetize

x = synthesize(target_model, fixed_class, k_max)
```

### Shadow models
Train $n$ shadow models on synthetic data with a given learner. The learner must be a scikit-learn estimator with the `predict_proba` method.


```python
from mblearn import ShadowModels

shadows = ShadowModels(n_models, data, target_classes, learner)

shadow_data = shadows.results
```

### Attacker models

Using the data generated with the shadow models, trains a attack models
on each label of the shadow dataset.

```python
from mblearn import AttackerModels

attacker = AttackModels(target_classes, attack_learner)

# train the attacker with the shadow data
attacker.fit(shadow_data)

# query the target model and get the predicted class prob vector
X = target_model.predict_proba(test_data)

# especulate about the class this test_data belongs to
y = 0

# get the prediction:
# True if `test_data` is classified as a member of
# the private model training set for the given class
# False otherwise
attacker.predict(X, y)
```
Will

## Warning

The maturity of the package is far from alpha. This is just a prove of concept and the whole interface and inner wheels may change constantly in the next few months.
3 changes: 3 additions & 0 deletions mblearn/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from .attack_model import AttackModels
from .data_synthesis import synthesize
from .shadow_model import ShadowModels
File renamed without changes.
File renamed without changes.
File renamed without changes.
42 changes: 42 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
from setuptools import setup

def readme():
with open('README.md') as readme_file:
return readme_file.read()

configuration = {
'name' : 'member-learn',
'version': '0.0.1',
'description' : 'Membership inference attacks with sklearn',
'long_description' : readme(),
'classifiers' : [
'Development Status :: 1 - Planning',
'Intended Audience :: Science/Research',
'Intended Audience :: Developers',
'License :: OSI Approved',
'Programming Language :: Python',
'Topic :: Software Development',
'Topic :: Scientific/Engineering',
'Operating System :: Microsoft :: Windows',
'Operating System :: POSIX',
'Operating System :: Unix',
'Operating System :: MacOS',
'Programming Language :: Python :: 3.7',
],
'keywords' : 'membership inference adversarial attack privacy machine-learning',
'url' : 'https://github.com/BielStela/membership_inference',
'maintainer' : 'Biel Stela',
'maintainer_email' : '[email protected]',
'license' : 'BSD',
'packages' : ['mblearn'],
'install_requires': ['numpy >= 1.13',
'scikit-learn >= 0.16',
'scipy >= 0.19',
'pandas',
'tqdm'],
'ext_modules' : [],
'cmdclass' : {},
'data_files' : ()
}

setup(**configuration)

0 comments on commit 10f6c79

Please sign in to comment.