Coder Social home page Coder Social logo

itu-square / privugger Goto Github PK

View Code? Open in Web Editor NEW
2.0 2.0 1.0 14.23 MB

Privugger (/prɪvʌɡə(r)/) is a privacy risk analysis library for python programs. Docs and tutorials: https://itu-square.github.io/privugger/

License: Apache License 2.0

Python 100.00%
data-analytics privacy quantitative-information-flow

privugger's People

Contributors

chrisjd94 avatar pluttodk avatar rasmus-ronneberg avatar rasmuscarl avatar raulpardo avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

Forkers

nbryn

privugger's Issues

Adding support for different inference backends

So far we perform inference using pymc3. However, in some situations (e.g., in the lack of conditions) it might be more efficient to directly sample using libraries like scipy.stats. Given that we have specification datatypes for defining distribution (#5), supporting different backends can be added. The infer should use the appropriate backend depending on the analysis to perform.

requirements.txt outdated in develop branch

Simply running pip install -r requirements.txt in the develop branch does not install properly all required dependences. Here are a few details we should add (possibly others as well):

  • numpy==1.22.4
  • pymc==4.1.5

Support vectorized observations

This commit 126c7a0 adds support for 1d (integer) vector observations. This is useful for analyzing programs whose output is a 1d vector.

We must extend the enhancement to vectors of other types, e.g., float.
Additionally, we could consider extending observations to vectors of higher dimensions.

Creating unit tests

  • We should create the infrastructure for unit testing.
  • Then we should add several unit tests checking the correctness of probability queries and privacy measures (#4).
    • The tests should take into account the analytical expected value and variance of the estimators.

Installation guide in the documentation

We should have an pip based installation guide in the documentation. Then, we should remove the line sys.path.append(os.path.join("../../..")) from the notebooks.

Creating specification datatypes for the inputs of the programs

We should support the definition of the input parameters of the program to analyze using a specification format. Dictionary formats like JSON are a good candidate.

## Spec (step 1)
names= {
    'dist': Uniform,
    'range': (0,50)
    # ...    
}    
ages={
    'dist': Normal,
    'mu': 0,
    'sigma': 1,
   #  ...    
}
# ...

These specifications will be used to create input datatypes as follows:

import privug as pv

pv_ds=pv.Dataset(input_spec=[names,ages], var_names=['names','ages',...])
# or
p1=pv.float(ages)
# or
p2=pv.int(names)

These will be finally used by the inference method together with the target program, e.g.:

pv.infer(target_program,pv_ds)

Creating documentation page

We should create and make publicly available a documentation page with the document ion of the API as well as tutorials and examples. Ideally, we should use Read the docs.

Code base refactoring

  • Make sure we use serpent case everywhere
  • data_structures class split in different classes within the data_structures module
  • method.py renamed inference.py

re variable not found

Hi, I was running the examples from the tutorial.
I got to this point:

trace   = pv.infer(program, 
                   cores=4,
                   draws=10_000,
                   method='pymc3')

This runs for a while but then fails with:

/python3.8/site-packages/privugger/data_structures/program.py", line 54, in add_observation
    vals = re.search(cons, constraints)
NameError: name 're' is not defined

I guessed that it was probably regex missing, so I tried just adding it as a reference to that.
Then I ran it again, to which I got:

python3.8/site-packages/privugger/data_structures/program.py", line 121, in inner
    pm.Normal(f"cons_{i}", distribution,        precision, observed=value)
NameError: name 'pm' is not defined

Could there be missing some imports? or am I maybe doing something wrong?

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.