python-dp


Namepython-dp JSON
Version 1.1.4 PyPI version JSON
download
home_pagehttps://github.com/OpenMined/PyDP
SummaryPython API for Google's Differential Privacy library
upload_time2023-08-15 18:08:14
maintainer
docs_urlNone
authorChinmay Shah
requires_python>=3.8
licenseApache-2.0
keywords pydp
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage
            | |Tests| |Version| |License|

Introduction to PyDP
====================

In today's data-driven world, more and more researchers and data
scientists use machine learning to create better models or more innovative
solutions for a better future.

These models often tend to handle sensitive or personal data, which
can cause privacy issues. For example, some AI models can memorize details about the data they've been trained on and could potentially leak these
details later on.

To help measure sensitive data leakage and reduce the possibility of
it happening, there is a mathematical framework called differential
privacy.

In 2020, OpenMined created a Python wrapper for Google's `Differential
Privacy <https://github.com/google/differential-privacy>`_ project
called PyDP. The library provides a set of ε-differentially private algorithms,
which can be used to produce aggregate statistics over numeric data sets containing
private or sensitive information. Therefore, with PyDP you can control the
privacy guarantee and accuracy of your model written in Python.

**Things to remember about PyDP:**

-  ::rocket: Features differentially private algorithms including: BoundedMean, BoundedSum, Max, Count Above, Percentile, Min, Median, etc.

  -  All the computation methods mentioned above use Laplace noise only (other noise mechanisms will be added soon! :smiley:).

-  ::fire: Currently supports Linux and macOS (Windows support coming soon :smiley:)
-  ::star: Use Python 3.6+. Support for Python 3.5 and below is deprecated.

Installation
------------

To install PyDP, use the `PiPy <https://pip.pypa.io/en/stable/>`__
package manager:

.. code:: bash

    pip install python-dp

(If you have ``pip3`` separately for Python 3.x, use ``pip3 install python-dp``.)

Examples
--------

Refer to the `curated list <https://github.com/OpenMined/PyDP/tree/dev/examples>`__ of tutorials and sample code to learn more about the PyDP library.

You can also get started with `an introduction to
PyDP <https://github.com/OpenMined/PyDP/blob/dev/examples/Tutorial_1-carrots_demo/carrots_demo.ipynb>`__ (a Jupyter notebook) and `the carrots demo <https://github.com/OpenMined/PyDP/blob/dev/examples/Tutorial_1-carrots_demo/carrots.py>`__ (a Python file).

Example: calculate the Bounded Mean

.. code:: python

    # Import PyDP
    import pydp as dp
    # Import the Bounded Mean algorithm
    from pydp.algorithms.laplacian import BoundedMean

    # Calculate the Bounded Mean
    # Basic Structure: `BoundedMean(epsilon: float, lower_bound: Union[int, float, None], upper_bound: Union[int, float, None])`
    # `epsilon`: a Double, between 0 and 1, denoting the privacy threshold,
    #            measures the acceptable loss of privacy (with 0 meaning no loss is acceptable)
    x = BoundedMean(epsilon=0.6, lower_bound=1, upper_bound=10)

    # If the lower and upper bounds are not specified,
    # PyDP automatically calculates these bounds
    # x = BoundedMean(epsilon: float)
    x = BoundedMean(0.6)

    # Calculate the result
    # Currently supported data types are integers and floats
    # Future versions will support additional data types
    # (Refer to https://github.com/OpenMined/PyDP/blob/dev/examples/carrots.py)
    x.quick_result(input_data: list)

Learning Resources
------------------

Go to `resources <https://github.com/OpenMined/PyDP/blob/dev/resources.md>`__ to learn more about differential privacy.

Support and Community on Slack
------------------------------

If you have questions about the PyDP library, join `OpenMined's Slack <https://slack.openmined.org>`__ and check the **#lib\_pydp** channel. To follow the code source changes, join **#code\_dp\_python**.

Contributing
------------

To contribute to the PyDP project, read the `guidelines <https://github.com/OpenMined/PyDP/blob/dev/contributing.md>`__.

Pull requests are welcome. If you want to introduce major changes,
please open an issue first to discuss what you would like to change.

Please make sure to update tests as appropriate.


   <!-- ## Contributors -->

License
-------

`Apache License 2.0 <https://choosealicense.com/licenses/apache-2.0/>`__

.. |Tests| image:: https://img.shields.io/github/workflow/status/OpenMined/PyDP/Tests
.. |Version| image:: https://img.shields.io/github/v/tag/OpenMined/PyDP?color=green&label=pypi
.. |License| image:: https://img.shields.io/github/license/OpenMined/PyDP

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/OpenMined/PyDP",
    "name": "python-dp",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": "",
    "keywords": "pydp",
    "author": "Chinmay Shah",
    "author_email": "chinmayshah3899@gmail.com",
    "download_url": "",
    "platform": null,
    "description": "| |Tests| |Version| |License|\n\nIntroduction to PyDP\n====================\n\nIn today's data-driven world, more and more researchers and data\nscientists use machine learning to create better models or more innovative\nsolutions for a better future.\n\nThese models often tend to handle sensitive or personal data, which\ncan cause privacy issues. For example, some AI models can memorize details about the data they've been trained on and could potentially leak these\ndetails later on.\n\nTo help measure sensitive data leakage and reduce the possibility of\nit happening, there is a mathematical framework called differential\nprivacy.\n\nIn 2020, OpenMined created a Python wrapper for Google's `Differential\nPrivacy <https://github.com/google/differential-privacy>`_ project\ncalled PyDP. The library provides a set of \u03b5-differentially private algorithms,\nwhich can be used to produce aggregate statistics over numeric data sets containing\nprivate or sensitive information. Therefore, with PyDP you can control the\nprivacy guarantee and accuracy of your model written in Python.\n\n**Things to remember about PyDP:**\n\n-  ::rocket: Features differentially private algorithms including: BoundedMean, BoundedSum, Max, Count Above, Percentile, Min, Median, etc.\n\n  -  All the computation methods mentioned above use Laplace noise only (other noise mechanisms will be added soon! :smiley:).\n\n-  ::fire: Currently supports Linux and macOS (Windows support coming soon :smiley:)\n-  ::star: Use Python 3.6+. Support for Python 3.5 and below is deprecated.\n\nInstallation\n------------\n\nTo install PyDP, use the `PiPy <https://pip.pypa.io/en/stable/>`__\npackage manager:\n\n.. code:: bash\n\n    pip install python-dp\n\n(If you have ``pip3`` separately for Python 3.x, use ``pip3 install python-dp``.)\n\nExamples\n--------\n\nRefer to the `curated list <https://github.com/OpenMined/PyDP/tree/dev/examples>`__ of tutorials and sample code to learn more about the PyDP library.\n\nYou can also get started with `an introduction to\nPyDP <https://github.com/OpenMined/PyDP/blob/dev/examples/Tutorial_1-carrots_demo/carrots_demo.ipynb>`__ (a Jupyter notebook) and `the carrots demo <https://github.com/OpenMined/PyDP/blob/dev/examples/Tutorial_1-carrots_demo/carrots.py>`__ (a Python file).\n\nExample: calculate the Bounded Mean\n\n.. code:: python\n\n    # Import PyDP\n    import pydp as dp\n    # Import the Bounded Mean algorithm\n    from pydp.algorithms.laplacian import BoundedMean\n\n    # Calculate the Bounded Mean\n    # Basic Structure: `BoundedMean(epsilon: float, lower_bound: Union[int, float, None], upper_bound: Union[int, float, None])`\n    # `epsilon`: a Double, between 0 and 1, denoting the privacy threshold,\n    #            measures the acceptable loss of privacy (with 0 meaning no loss is acceptable)\n    x = BoundedMean(epsilon=0.6, lower_bound=1, upper_bound=10)\n\n    # If the lower and upper bounds are not specified,\n    # PyDP automatically calculates these bounds\n    # x = BoundedMean(epsilon: float)\n    x = BoundedMean(0.6)\n\n    # Calculate the result\n    # Currently supported data types are integers and floats\n    # Future versions will support additional data types\n    # (Refer to https://github.com/OpenMined/PyDP/blob/dev/examples/carrots.py)\n    x.quick_result(input_data: list)\n\nLearning Resources\n------------------\n\nGo to `resources <https://github.com/OpenMined/PyDP/blob/dev/resources.md>`__ to learn more about differential privacy.\n\nSupport and Community on Slack\n------------------------------\n\nIf you have questions about the PyDP library, join `OpenMined's Slack <https://slack.openmined.org>`__ and check the **#lib\\_pydp** channel. To follow the code source changes, join **#code\\_dp\\_python**.\n\nContributing\n------------\n\nTo contribute to the PyDP project, read the `guidelines <https://github.com/OpenMined/PyDP/blob/dev/contributing.md>`__.\n\nPull requests are welcome. If you want to introduce major changes,\nplease open an issue first to discuss what you would like to change.\n\nPlease make sure to update tests as appropriate.\n\n\n   <!-- ## Contributors -->\n\nLicense\n-------\n\n`Apache License 2.0 <https://choosealicense.com/licenses/apache-2.0/>`__\n\n.. |Tests| image:: https://img.shields.io/github/workflow/status/OpenMined/PyDP/Tests\n.. |Version| image:: https://img.shields.io/github/v/tag/OpenMined/PyDP?color=green&label=pypi\n.. |License| image:: https://img.shields.io/github/license/OpenMined/PyDP\n",
    "bugtrack_url": null,
    "license": "Apache-2.0",
    "summary": "Python API for Google's Differential Privacy library",
    "version": "1.1.4",
    "project_urls": {
        "Homepage": "https://github.com/OpenMined/PyDP"
    },
    "split_keywords": [
        "pydp"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "b522619c96a7c6c951898064b4acd19db2c82e5c20ef35a933dde1c41fe58144",
                "md5": "fb1fc76f269545d4d696735cb38adacb",
                "sha256": "778a770d166f29ba8ff9fe028a24af7c04f51299227d0ed6dfe02fca209ed484"
            },
            "downloads": -1,
            "filename": "python_dp-1.1.4-cp310-cp310-macosx_10_14_x86_64.whl",
            "has_sig": false,
            "md5_digest": "fb1fc76f269545d4d696735cb38adacb",
            "packagetype": "bdist_wheel",
            "python_version": "cp310",
            "requires_python": ">=3.8",
            "size": 4220065,
            "upload_time": "2023-08-15T18:08:14",
            "upload_time_iso_8601": "2023-08-15T18:08:14.170169Z",
            "url": "https://files.pythonhosted.org/packages/b5/22/619c96a7c6c951898064b4acd19db2c82e5c20ef35a933dde1c41fe58144/python_dp-1.1.4-cp310-cp310-macosx_10_14_x86_64.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "1534824811b0eaad9a6c9001b8c6d427bb5d922b8a570f208aefecedf2308e3d",
                "md5": "d5b7681d9e4c81c81999ecfd1b869a38",
                "sha256": "a152c8e7ec0b72f0a6ec4ed6b542ab43899815ea8b2d04f3ed2e0d3678cefa51"
            },
            "downloads": -1,
            "filename": "python_dp-1.1.4-cp310-cp310-manylinux1_x86_64.whl",
            "has_sig": false,
            "md5_digest": "d5b7681d9e4c81c81999ecfd1b869a38",
            "packagetype": "bdist_wheel",
            "python_version": "cp310",
            "requires_python": ">=3.8",
            "size": 3804492,
            "upload_time": "2023-08-15T17:44:57",
            "upload_time_iso_8601": "2023-08-15T17:44:57.472504Z",
            "url": "https://files.pythonhosted.org/packages/15/34/824811b0eaad9a6c9001b8c6d427bb5d922b8a570f208aefecedf2308e3d/python_dp-1.1.4-cp310-cp310-manylinux1_x86_64.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "eb08ae5a062673ed1ab2b5ee7974cfefa6164d3efae443b9a1c39a02e132020b",
                "md5": "8fceb22907ef4d390306d2b818ed79b8",
                "sha256": "e97f8581d92d02caaaf9fee4b0a0b5fdaec594544c54aa9dd9d7cbdf9200cc83"
            },
            "downloads": -1,
            "filename": "python_dp-1.1.4-cp310-cp310-win_amd64.whl",
            "has_sig": false,
            "md5_digest": "8fceb22907ef4d390306d2b818ed79b8",
            "packagetype": "bdist_wheel",
            "python_version": "cp310",
            "requires_python": ">=3.8",
            "size": 2118797,
            "upload_time": "2023-08-15T17:53:02",
            "upload_time_iso_8601": "2023-08-15T17:53:02.767095Z",
            "url": "https://files.pythonhosted.org/packages/eb/08/ae5a062673ed1ab2b5ee7974cfefa6164d3efae443b9a1c39a02e132020b/python_dp-1.1.4-cp310-cp310-win_amd64.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "1da4b72e153d28fc206c5b057c7205508c5f7832a562514a18de453521f4ebf0",
                "md5": "2a14071adca1a9a04bd0f71e04d86547",
                "sha256": "2eba0f70ae8705dc0682e901d4227dc3eaab880f2cd02db6954a394ccdadfedf"
            },
            "downloads": -1,
            "filename": "python_dp-1.1.4-cp311-cp311-macosx_10_14_x86_64.whl",
            "has_sig": false,
            "md5_digest": "2a14071adca1a9a04bd0f71e04d86547",
            "packagetype": "bdist_wheel",
            "python_version": "cp311",
            "requires_python": ">=3.8",
            "size": 4224185,
            "upload_time": "2023-08-15T17:52:36",
            "upload_time_iso_8601": "2023-08-15T17:52:36.635512Z",
            "url": "https://files.pythonhosted.org/packages/1d/a4/b72e153d28fc206c5b057c7205508c5f7832a562514a18de453521f4ebf0/python_dp-1.1.4-cp311-cp311-macosx_10_14_x86_64.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "38ba03034770175ef141e1a6f4fca6bd0d89410d0610dfa0ab373009ae4e36f4",
                "md5": "58f13ebf2ca45708881fc81eeea8cd61",
                "sha256": "a9ccf3724cbd74460a3d8baf610d9068a3eb6071eeabfeb69653565b0c2cc9cc"
            },
            "downloads": -1,
            "filename": "python_dp-1.1.4-cp311-cp311-manylinux1_x86_64.whl",
            "has_sig": false,
            "md5_digest": "58f13ebf2ca45708881fc81eeea8cd61",
            "packagetype": "bdist_wheel",
            "python_version": "cp311",
            "requires_python": ">=3.8",
            "size": 3807478,
            "upload_time": "2023-08-15T17:44:52",
            "upload_time_iso_8601": "2023-08-15T17:44:52.192106Z",
            "url": "https://files.pythonhosted.org/packages/38/ba/03034770175ef141e1a6f4fca6bd0d89410d0610dfa0ab373009ae4e36f4/python_dp-1.1.4-cp311-cp311-manylinux1_x86_64.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "1a8b7a9feaebbccd590038a5947967ffd1d4b2ad76b2dd2326d13cd37b2c4a83",
                "md5": "d927f076af3448ed22da96a8e3be5f3c",
                "sha256": "238abc763ffdc94accd792d53f825b58f4a99bf7153e72f3af2153e9282871d2"
            },
            "downloads": -1,
            "filename": "python_dp-1.1.4-cp311-cp311-win_amd64.whl",
            "has_sig": false,
            "md5_digest": "d927f076af3448ed22da96a8e3be5f3c",
            "packagetype": "bdist_wheel",
            "python_version": "cp311",
            "requires_python": ">=3.8",
            "size": 2126336,
            "upload_time": "2023-08-15T17:50:29",
            "upload_time_iso_8601": "2023-08-15T17:50:29.969666Z",
            "url": "https://files.pythonhosted.org/packages/1a/8b/7a9feaebbccd590038a5947967ffd1d4b2ad76b2dd2326d13cd37b2c4a83/python_dp-1.1.4-cp311-cp311-win_amd64.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "dccce5ea4cd643f5fd3983435a7ef50f31db9db57a0bacea1c669221149c875c",
                "md5": "37984f51f729693cdfdc5aba8d20504a",
                "sha256": "80c9a0ad277d8eacbc850b1869d5cb91d14c078fa18584d749078abd415fe2a4"
            },
            "downloads": -1,
            "filename": "python_dp-1.1.4-cp38-cp38-macosx_10_14_x86_64.whl",
            "has_sig": false,
            "md5_digest": "37984f51f729693cdfdc5aba8d20504a",
            "packagetype": "bdist_wheel",
            "python_version": "cp38",
            "requires_python": ">=3.8",
            "size": 4216899,
            "upload_time": "2023-08-15T17:53:19",
            "upload_time_iso_8601": "2023-08-15T17:53:19.900852Z",
            "url": "https://files.pythonhosted.org/packages/dc/cc/e5ea4cd643f5fd3983435a7ef50f31db9db57a0bacea1c669221149c875c/python_dp-1.1.4-cp38-cp38-macosx_10_14_x86_64.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "458146c0b62740210612cfcbbb3e938f58e7a7464581a8f95c4e4730f9a5bfb4",
                "md5": "52e64c51ca7856e401d8478a09f432ce",
                "sha256": "3ed50ec62c55674a25f93cb7a69b55631923d5e3d23c1811ff1a70692558f33f"
            },
            "downloads": -1,
            "filename": "python_dp-1.1.4-cp38-cp38-manylinux1_x86_64.whl",
            "has_sig": false,
            "md5_digest": "52e64c51ca7856e401d8478a09f432ce",
            "packagetype": "bdist_wheel",
            "python_version": "cp38",
            "requires_python": ">=3.8",
            "size": 3802750,
            "upload_time": "2023-08-15T17:47:36",
            "upload_time_iso_8601": "2023-08-15T17:47:36.955835Z",
            "url": "https://files.pythonhosted.org/packages/45/81/46c0b62740210612cfcbbb3e938f58e7a7464581a8f95c4e4730f9a5bfb4/python_dp-1.1.4-cp38-cp38-manylinux1_x86_64.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "b96e741e3b084c950243a2094a0955f8c3b90df8125d1d748f5a04451345703c",
                "md5": "d82f34a469a7a8ffa883a9d8a07c5f3a",
                "sha256": "65a8599c0c3c139e27c5714aeb03732dbde9017465aa34e334a3f403b1b52d77"
            },
            "downloads": -1,
            "filename": "python_dp-1.1.4-cp38-cp38-win_amd64.whl",
            "has_sig": false,
            "md5_digest": "d82f34a469a7a8ffa883a9d8a07c5f3a",
            "packagetype": "bdist_wheel",
            "python_version": "cp38",
            "requires_python": ">=3.8",
            "size": 2117400,
            "upload_time": "2023-08-15T17:51:15",
            "upload_time_iso_8601": "2023-08-15T17:51:15.961767Z",
            "url": "https://files.pythonhosted.org/packages/b9/6e/741e3b084c950243a2094a0955f8c3b90df8125d1d748f5a04451345703c/python_dp-1.1.4-cp38-cp38-win_amd64.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "4f04344a848154f1a8a7b638a24fdbb522bad98b18525e5f37678fca6fd26bd6",
                "md5": "2acd3d0c9fcb457d8f9ac6e68f722c8d",
                "sha256": "80f1e6872015624684cba619cdbf2fda2981d5462c314a87f20b0ff50aa889ed"
            },
            "downloads": -1,
            "filename": "python_dp-1.1.4-cp39-cp39-macosx_10_14_x86_64.whl",
            "has_sig": false,
            "md5_digest": "2acd3d0c9fcb457d8f9ac6e68f722c8d",
            "packagetype": "bdist_wheel",
            "python_version": "cp39",
            "requires_python": ">=3.8",
            "size": 4219499,
            "upload_time": "2023-08-15T17:53:15",
            "upload_time_iso_8601": "2023-08-15T17:53:15.722476Z",
            "url": "https://files.pythonhosted.org/packages/4f/04/344a848154f1a8a7b638a24fdbb522bad98b18525e5f37678fca6fd26bd6/python_dp-1.1.4-cp39-cp39-macosx_10_14_x86_64.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "dd7ae479f0ec706d3a007a9c0c4bff33709c59e530951717dca6e48f96a70dfd",
                "md5": "f5015c3523f90a11a396b8561a0a493d",
                "sha256": "33ef3484ea87f404053ab1ef1dc8c3d4de1bfa8a6d1ab31ea0264f965a08ce61"
            },
            "downloads": -1,
            "filename": "python_dp-1.1.4-cp39-cp39-manylinux1_x86_64.whl",
            "has_sig": false,
            "md5_digest": "f5015c3523f90a11a396b8561a0a493d",
            "packagetype": "bdist_wheel",
            "python_version": "cp39",
            "requires_python": ">=3.8",
            "size": 3804592,
            "upload_time": "2023-08-15T17:44:50",
            "upload_time_iso_8601": "2023-08-15T17:44:50.766061Z",
            "url": "https://files.pythonhosted.org/packages/dd/7a/e479f0ec706d3a007a9c0c4bff33709c59e530951717dca6e48f96a70dfd/python_dp-1.1.4-cp39-cp39-manylinux1_x86_64.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "d7b9ec14af08ddfb0e9758fca693357c8e6f924b4a4652c9c8fbb1cf8698e01f",
                "md5": "84ad633cc585f7a0d3ee6e7996f7d1a8",
                "sha256": "c3099c37dcfc06a8d2218521495508b020944b4764ca06b80455386a7860a641"
            },
            "downloads": -1,
            "filename": "python_dp-1.1.4-cp39-cp39-win_amd64.whl",
            "has_sig": false,
            "md5_digest": "84ad633cc585f7a0d3ee6e7996f7d1a8",
            "packagetype": "bdist_wheel",
            "python_version": "cp39",
            "requires_python": ">=3.8",
            "size": 2118591,
            "upload_time": "2023-08-15T17:51:50",
            "upload_time_iso_8601": "2023-08-15T17:51:50.696802Z",
            "url": "https://files.pythonhosted.org/packages/d7/b9/ec14af08ddfb0e9758fca693357c8e6f924b4a4652c9c8fbb1cf8698e01f/python_dp-1.1.4-cp39-cp39-win_amd64.whl",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-08-15 18:08:14",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "OpenMined",
    "github_project": "PyDP",
    "travis_ci": false,
    "coveralls": true,
    "github_actions": true,
    "lcname": "python-dp"
}
        
Elapsed time: 0.70647s