Tools for the statistical disclosure control of machine learning models
Project description
AI-SDC
A collection of tools and resources for managing the statistical disclosure control of trained machine learning models. For a brief introduction, see Smith et al. (2022).
User Guides
A collection of user guides can be found in the 'user_stories' folder of this repository. These guides include configurable examples from the perspective of both a researcher and a TRE, with separate scripts for each. Instructions on how to use each of these scripts and which scripts to use are included in the README of the user_stories
folder.
Content
aisdc
attacks
Contains a variety of privacy attacks on machine learning models, including membership and attribute inference.preprocessing
Contains preprocessing modules for test datasets.safemodel
The safemodel package is an open source wrapper for common machine learning models. It is designed for use by researchers in Trusted Research Environments (TREs) where disclosure control methods must be implemented. Safemodel aims to give researchers greater confidence that their models are more compliant with disclosure control.
docs
Contains Sphinx documentation files.example_notebooks
Contains short tutorials on the basic concept of "safe_XX" versions of machine learning algorithms, and examples of some specific algorithms.examples
Contains examples of how to run the code contained in this repository:- How to simulate attribute inference attacks
attribute_inference_example.py
. - How to simulate membership inference attacks:
- Worst case scenario attack
worst_case_attack_example.py
. - LIRA scenario attack
lira_attack_example.py
.
- Worst case scenario attack
- Integration of attacks into safemodel classes
safemodel_attack_integration_bothcalls.py
.
- How to simulate attribute inference attacks
risk_examples
Contains hypothetical examples of data leakage through machine learning models as described in the Green Paper.tests
Contains unit tests.
Documentation
Documentation is hosted here: https://ai-sdc.github.io/AI-SDC/
Installation / End-user
Install aisdc
(safest in a virtual env) and manually copy the examples
and example_notebooks
.
To install only the base package, which includes the attacks used for assessing privacy:
$ pip install aisdc
To install the base package and the safemodel package, which includes defensive wrappers for popular ML frameworks including scikit-learn and Keras:
$ pip install aisdc[safemodel]
Running
To run an example, simply execute the desired script or start up jupyter notebook
and run one of the notebooks.
For example, to run the lira_attack_example.py
:
$ python -m lira_attack_example
Development
Clone the repository and install the local package including all dependencies (safest in a virtual env):
$ git clone https://github.com/AI-SDC/AI-SDC.git
$ cd AI-SDC
$ pip install .[test]
Then run the tests:
$ pytest .
This work was funded by UK Research and Innovation under Grant Numbers MC_PC_21033 and MC_PC_23006 as part of Phase 1 of the DARE UK (Data and Analytics Research Environments UK) programme (https://dareuk.org.uk/), delivered in partnership with Health Data Research UK (HDR UK) and Administrative Data Research UK (ADR UK). The specific projects were Semi-Automatic checking of Research Outputs (SACRO -MC_PC_23006) and Guidelines and Resources for AI Model Access from TrusTEd Research environments (GRAIMATTER - MC_PC_21033). This project has also been supported by MRC and EPSRC [grant number MR/S010351/1]: PICTURES.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file aisdc-1.1.3.tar.gz
.
File metadata
- Download URL: aisdc-1.1.3.tar.gz
- Upload date:
- Size: 107.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7b82c9f42faccfedfd04af5c0b8ab6bc5b5fdf3e3a7bf73eb528b61442e8991a |
|
MD5 | fde1b09aeaf8d91bc6473faf387c811c |
|
BLAKE2b-256 | 51f08b1375600bf36aec2c1d557ed5cb900695fdfce0d49081049ebd80fded4d |
File details
Details for the file aisdc-1.1.3-py3-none-any.whl
.
File metadata
- Download URL: aisdc-1.1.3-py3-none-any.whl
- Upload date:
- Size: 88.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0a168803c2704136462824b224352155a3a85c9684d677b37f5d89d5d4f9e4e6 |
|
MD5 | e1f84f49d0e7ce5faa9a9219c034df8d |
|
BLAKE2b-256 | abc29054a8ba968a77267109a2c40016d002c8087ee5466712f849282a2075ce |