Code for NIPS'2017 paper
Switch branches/tags
Nothing to show
Clone or download
Latest commit 47c6a59 Nov 2, 2017
Failed to load latest commit information.
code first commit Nov 2, 2017
datasets first commit Nov 2, 2017
README.txt first commit Nov 2, 2017
license.txt first commit Nov 2, 2017


Code for paper "Accuracy First: Selecting a Differentially Private
                Level for Accuracy-Constrained ERM"
by Ligett, Neel, Roth, Waggoner, Wu

-- Disclaimer

This code is used for simulations of the performance of
differentially private algorithms, but should not be used in practice
to protect actual sensitive data! The theorems are proved for true
randomness and real numbers, while the code uses python's internal
random generators and floating-point numbers.

-- Requirements
1.  python3 with the numpy, matplotlib, and scikit-learn libraries.

2.  (optional) Linux, bash, and the GNU parallel utility
    available from most repositories.
    This is not mandatory, it's just that a bash script is
    used for running a whole bunch of experiments at once
    and in parallel.

-- Usage

Navigate into the code/ directory to run the code.

You will need a dataset file in plain text.
Each row of the file is a data point.
It should contain d+1 space-separated numbers
(for some d) where the first d are "x" and the last is "y".
It is assumed that the L1-norm of each x is at most 1,
and each |y| <= 1.
For logistic regression, each y should be plus or minus 1.
See data/ directories for downloading the datasets used in the
paper and processing them into this format.

You can run a single experiment at a time and print the output,
or run a set of experiments and save the outputs into folders.

-- To run a single experiment for a given data set and parameters:
     $ python3 [args]
     $ python3 [args]
Run them with no arguments for help on the args.

-- To run a set of experiments:

1. You should have a dataset file and also a file with a list of
   the alpha parameters to try, called alphalist.txt.
   E.g. you can edit '' to your liking and then run

     $ > alphalist.txt

2. Edit the file '' to set all the parameters to your
   liking. Also edit the top of the file ''
   to rename the variable 'run_file_name'.
   It should be "" if you want logistic regression
   or "" if you want ridge regression.

3. Execute the following (full explanation of what it does below):

     $ ./

4. Execute the following to read the results, print some output about
   them, and produce some plots.

     $ python3 sims-results/

This will create a folder sims-results/ and run a bunch of simulations
writing the results into that folder, along with an ''
file that specifies what all the parameters were.

It does the following:

   a. Runs python3 [args]
      which creates the folder sim-results/
      and writes into it.
      Also writes a list of commands to a temporary file.

   b. Invokes GNU parallel to run the commands in parallel.
      WARNING: for large datasets, may use up all your RAM and
      crash your computer! Use --max-procs to limit the number
      of commands to run simultaneously.
      Each command that is run is of form in step c.
   c. python3 [args]
      Runs num_trials experiments for the given parameters,
      writing the outputs into sim-results/param-i/ for the
      given i.