Skip to content

Commit

Permalink
Merge branch 'development' into new_datasets
Browse files Browse the repository at this point in the history
Signed-off-by: yolaj-nhs <[email protected]>
  • Loading branch information
yolaj-nhs authored Feb 6, 2024
2 parents f70a300 + fa6c4d6 commit 7244e79
Show file tree
Hide file tree
Showing 78 changed files with 5,416 additions and 1,524 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ jobs:
- name: Checkout
uses: actions/checkout@v3

- name: Install dependencies
- name: Install
run: |
python -m pip install --upgrade pip
pip install pylint pytest pytest-cov
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
pip install pytest pytest-cov
pip install .
- name: pytest and report coverage
run: |
Expand Down
30 changes: 30 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
---
name: Tests Manually Run

on: workflow_dispatch

jobs:
build:
name: ${{ matrix.os }}-Python${{ matrix.python-version }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: ["3.8", "3.9", "3.10"]

steps:
- name: Checkout
uses: actions/checkout@v3

- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}

- name: Install and pytest
run: pip install . pytest

- name: Run pytest
run: pytest .
...
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,9 @@ ipython_config.py
# pyenv
.python-version

# development files
development_files/

# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
Expand Down
12 changes: 6 additions & 6 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ repos:

# Standard hooks
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
rev: v4.5.0
hooks:
- id: check-added-large-files
- id: check-merge-conflict
Expand All @@ -21,7 +21,7 @@ repos:

# Check for spelling
- repo: https://github.com/codespell-project/codespell
rev: v2.2.5
rev: v2.2.6
hooks:
- id: codespell
args: ["-L", "fpr, tre, sav, provid"]
Expand All @@ -33,27 +33,27 @@ repos:
# Autoremoves unused imports
- repo: https://github.com/hadialqattan/pycln
rev: "v2.2.2"
rev: "v2.4.0"
hooks:
- id: pycln
stages: [manual]

# Sort includes
- repo: https://github.com/asottile/pyupgrade
rev: v3.10.1
rev: v3.15.0
hooks:
- id: pyupgrade

# Upgrade old Python syntax
- repo: https://github.com/PyCQA/isort
rev: 5.12.0
rev: 5.13.2
hooks:
- id: isort
args: ["--profile", "black"]

# Black format Python and notebooks
- repo: https://github.com/psf/black
rev: 23.9.1
rev: 23.12.1
hooks:
- id: black-jupyter

Expand Down
23 changes: 23 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,28 @@
# Changelog

## Version 1.1.2 (Oct 30, 2023)

Changes:
* Fix a bug related to the `rules.json` path when running from package ([#247](https://github.com/AI-SDC/AI-SDC/pull/247))
* Update user stories ([#247](https://github.com/AI-SDC/AI-SDC/pull/247))

## Version 1.1.1 (Oct 19, 2023)

Changes:
* Update notebook example paths ([#237](https://github.com/AI-SDC/AI-SDC/pull/237))
* Fix AdaBoostClassifier structural attack ([#242](https://github.com/AI-SDC/AI-SDC/pull/242))
* Move experiments module and configs to separate repository ([#229](https://github.com/AI-SDC/AI-SDC/pull/229))

## Version 1.1.0 (Oct 11, 2023)

Changes:
* Add automatic formatting of docstrings ([#210](https://github.com/AI-SDC/AI-SDC/pull/210))
* Update user stories ([#217](https://github.com/AI-SDC/AI-SDC/pull/217))
* Add module to run experiments with attacks and gather data ([#224](https://github.com/AI-SDC/AI-SDC/pull/224))
* Fix bug in report.py: error removing a file that does not exist ([#227](https://github.com/AI-SDC/AI-SDC/pull/227))
* Add structural attack for traditional and other risk measures ([#232](https://github.com/AI-SDC/AI-SDC/pull/232))
* Fix package installation for Python 3.8, 3.9, 3.10 ([#234](https://github.com/AI-SDC/AI-SDC/pull/234))

## Version 1.0.6 (Jul 21, 2023)

Changes:
Expand Down
15 changes: 12 additions & 3 deletions CITATION.cff
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
cff-version: 1.2.0
title: AI-SDC
version: 1.0.6
doi: 10.5281/zenodo.8172371
date-released: 2023-07-21
version: 1.1.2
doi: 10.5281/zenodo.10055182
date-released: 2023-10-30
license: MIT
repository-code: https://github.com/AI-SDC/AI-SDC
languages:
Expand Down Expand Up @@ -74,3 +74,12 @@ identifiers:
- type: doi
value: 10.5281/zenodo.8172371
description: This is the archived snapshot of AI-SDC v.1.0.6.
- type: doi
value: 10.5281/zenodo.8430143
description: This is the archived snapshot of AI-SDC v.1.1.0.
- type: doi
value: 10.5281/zenodo.10021954
description: This is the archived snapshot of AI-SDC v.1.1.1.
- type: doi
value: 10.5281/zenodo.10055182
description: This is the archived snapshot of AI-SDC v.1.1.2.
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@

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)](https://doi.org/10.48550/arXiv.2212.01233).

### 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`](./user_stories) folder.

## Content

* `aisdc`
Expand Down Expand Up @@ -82,6 +86,7 @@ $ pip install .

---

This work was funded by UK Research and Innovation Grant Number MC_PC_21033 as part of Phase 1 of the DARE UK (Data and Analytics Research Environments UK) programme (https://dareuk.org.uk/), delivered in partnership with HDR UK and ADRUK. The specific project was Guidelines and Resources for AI Model Access from TrusTEd Research environments (GRAIMATTER).­ This project has also been supported by MRC and EPSRC [grant number MR/S010351/1]: PICTURES.

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.

<img src="docs/source/images/UK_Research_and_Innovation_logo.svg" width="20%" height="20%" padding=20/> <img src="docs/source/images/health-data-research-uk-hdr-uk-logo-vector.png" width="10%" height="10%" padding=20/> <img src="docs/source/images/logo_print.png" width="15%" height="15%" padding=20/>
6 changes: 5 additions & 1 deletion aisdc/attacks/attack_report_formatter.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
"""Generate report for TREs from JSON file."""

from __future__ import annotations

import json
import os
import pathlib
import pprint
import shutil
from datetime import date
Expand Down Expand Up @@ -151,7 +154,8 @@ def _is_instance_based_model(self, instance_based_model_score):

def _tree_min_samples_leaf(self, min_samples_leaf_score):
# Find min samples per leaf requirement
risk_appetite_path = "./aisdc/safemodel/rules.json"
base_path = pathlib.Path(__file__).parents[1]
risk_appetite_path = os.path.join(base_path, "safemodel", "rules.json")
min_samples_leaf_appetite = None

with open(risk_appetite_path, "r+", encoding="utf-8") as f:
Expand Down
Loading

0 comments on commit 7244e79

Please sign in to comment.