The easiest way to get started with OpenDP is from Python.
pip to install the opendp package from PyPI.
pip install opendp
This will make the OpenDP modules available to your local environment.
The vetting process is currently underway for the code in the OpenDP Library.
Any code that has not completed the vetting process is marked as “contrib” and will not run unless you opt-in.
contrib globally with the following snippet:
>>> from opendp.mod import enable_features >>> enable_features('contrib')
Once you’ve installed OpenDP, you can write your first program.
In the example below, we’ll construct a Laplace mechanism of type
then invoke it on a scalar aggregate.
>>> import opendp.prelude as dp >>> base_laplace = dp.space_of(float) >> dp.m.then_base_laplace(scale=1.) >>> base_laplace(23.4) 22.74877695423367
This code snip uses a number of OpenDP concepts:
Defining your metric space up-front with
Chaining operators together with
Measurementon your metric space with
base_laplacemeasurement on a value to get a DP release.
If you would like to skip directly to a more complete example, see Putting It Together.
Otherwise, continue on to the User Guide, where these concepts are explained in detail.