Skip to content

Plan, apply and roll back changes to a production ontology, with a blast radius report and a proof an auditor can re-check.

assure-health: add Colab demo notebook

FABIOTESSf7d3b1e22295
diff --git a/case-studies/assure-health/demo.ipynb b/case-studies/assure-health/demo.ipynb
new file mode 100644
index 00000000..cb06db6c
--- /dev/null
+++ b/case-studies/assure-health/demo.ipynb
@@ -0,0 +1,64 @@
+{
+ "cells": [
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "# assure-health: one report card for privacy AND fairness\n",
+ "\n",
+ "Differential privacy degrades the smallest patient subgroups the most. This runs membership inference AND per-subgroup equity on one clinical model across a DP sweep, on the real UCI Diabetes readmission data.\n",
+ "\n",
+ "**Runtime -> Run all.** Installs a few packages, fetches the data, prints the report card.\n",
+ "\n",
+ "Repo: https://github.com/fabio-rovai/open-ontologies/tree/main/case-studies/assure-health\n"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "metadata": {},
+ "execution_count": null,
+ "outputs": [],
+ "source": [
+ "!pip -q install numpy pandas scikit-learn ucimlrepo\n",
+ "!mkdir -p src data results\n",
+ "!wget -q https://raw.githubusercontent.com/fabio-rovai/open-ontologies/main/case-studies/assure-health/src/assure.py -O src/assure.py\n",
+ "from ucimlrepo import fetch_ucirepo\n",
+ "import pandas as pd\n",
+ "d=fetch_ucirepo(id=296)\n",
+ "pd.concat([d.data.features,d.data.targets],axis=1).to_csv('data/diabetic_data.csv',index=False)\n",
+ "print('data ready')\n"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "metadata": {},
+ "execution_count": null,
+ "outputs": [],
+ "source": [
+ "!python src/assure.py\n"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "---\n",
+ "At epsilon=0.25 the DP costs minority subgroups ~2.6x more accuracy than the majority, while membership-inference advantage stays near zero on this model: almost all equity cost, little privacy gain. Write-up: https://gov.tesseract.academy/research/health-ai-privacy-fairness-assurance\n"
+ ]
+ }
+ ],
+ "metadata": {
+ "kernelspec": {
+ "display_name": "Python 3",
+ "name": "python3"
+ },
+ "language_info": {
+ "name": "python"
+ },
+ "colab": {
+ "provenance": []
+ }
+ },
+ "nbformat": 4,
+ "nbformat_minor": 5
+}
\ No newline at end of file