Giter Site home page Giter Site logo

subangkar / evaluatingdpml Goto Github PK

View Code? Open in Web Editor NEW

This project forked from bargavj/evaluatingdpml

1.0 1.0 0.0 42.82 MB

This project's goal is to evaluate the privacy leakage of differentially private machine learning models.

License: MIT License

Shell 3.69% Python 76.54% Jupyter Notebook 19.77%

evaluatingdpml's Introduction

Analyzing the Leaky Cauldron

The goal of this project is to evaluate the privacy leakage of differential private machine learning algorithms.

The code has been adapted from the code base of membership inference attack work by Shokri et al.

Below we describe the setup and installation instructions. To run the experiments for the following projects, refer to their respective README files (hyperlinked):

Software Requirements

Installation Instructions

Assuming the system has Ubuntu 18.04 OS. The easiest way to get Python 3.8 is to install Anaconda 3 followed by installing the dependencies via pip. The following bash code installs the dependencies (including scikit_learn, tensorflow>=2.4.0 and tf-privacy) in a virtual environment:

$ python3 -m venv env
$ source env/bin/activate
$ python3 -m pip install --upgrade pip
$ python3 -m pip install --no-cache-dir -r requirements.txt

Furthermore, to use cuda-compatible nvidia gpus, the following script should be executed (copied from Tensorflow website) to install cuda-toolkit-11 and cudnn-8 as required by tensorflow-gpu:

# Add NVIDIA package repositories
$ wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/cuda-ubuntu1804.pin
$ sudo mv cuda-ubuntu1804.pin /etc/apt/preferences.d/cuda-repository-pin-600
$ sudo apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/7fa2af80.pub
$ sudo add-apt-repository "deb https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/ /"
$ sudo apt-get update

$ wget http://developer.download.nvidia.com/compute/machine-learning/repos/ubuntu1804/x86_64/nvidia-machine-learning-repo-ubuntu1804_1.0.0-1_amd64.deb

$ sudo apt install ./nvidia-machine-learning-repo-ubuntu1804_1.0.0-1_amd64.deb
$ sudo apt-get update

$ wget https://developer.download.nvidia.com/compute/machine-learning/repos/ubuntu1804/x86_64/libnvinfer7_7.1.3-1+cuda11.0_amd64.deb
$ sudo apt install ./libnvinfer7_7.1.3-1+cuda11.0_amd64.deb
$ sudo apt-get update

# Install development and runtime libraries (~4GB)
$ sudo apt-get install --no-install-recommends \
    cuda-11-0 \
    libcudnn8=8.0.4.30-1+cuda11.0  \
    libcudnn8-dev=8.0.4.30-1+cuda11.0

# Reboot. Check that GPUs are visible using the command: nvidia-smi

# Install TensorRT. Requires that libcudnn8 is installed above.
$ sudo apt-get install -y --no-install-recommends libnvinfer7=7.1.3-1+cuda11.0 \
    libnvinfer-dev=7.1.3-1+cuda11.0 \
    libnvinfer-plugin7=7.1.3-1+cuda11.0

Obtaining the Data Sets

Data sets can be obtained using the preprocess_dataset.py script provided in the extra/ folder. The script requires raw files for the respective data sets which can be found online using the following links:

$ python3 crawl_census_data.py

Once the source files for the respective data set are obtained, preprocess_dataset.py script would be able to generate the processed data set files, which are in the form of two pickle files: $DATASET_feature.p and $DATASET_labels.p (where $DATASET is a placeholder for the data set file name). For Purchase-100X, $DATASET = purchase_100. For Texas-100X, $DATASET = texas_100_v2. For Census19, $DATASET = census.

$ python3 preprocess_dataset.py $DATASET --preprocess=1

Alternatively, Census19 data set (as is used in the attribute inference paper) can also be found in the dataset/ folder in zip format.

For pre-processing other data sets, bound the L2 norm of each record to 1 and pickle the features and labels separately into $DATASET_feature.p and $DATASET_labels.p files in the dataset/ folder (where $DATASET is a placeholder for the data set file name, e.g. for Purchase-100 data set, $DATASET will be purchase_100).

evaluatingdpml's People

Contributors

bargavj avatar bargavjayaraman avatar dependabot[bot] avatar jonahweissman avatar katiekn avatar procrastimax avatar subangkar avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.