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.

1.9 KB
Raw Blame
{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# certicoupla: joint-valid uncertainty certificates on real DFT data\n",
    "\n",
    "Independent conformal prediction gives the right per-target coverage and the **wrong joint coverage** when scientific outputs are correlated. This runs the demonstration on real OQMD materials: a frozen regressor, then independent vs coupled vs Gaussian-copula certificates, all calibrated to 90% joint coverage.\n",
    "\n",
    "**Runtime -> Run all.** Code and the fetched dataset are pulled from GitHub; nothing else to set up.\n",
    "\n",
    "Repo: https://github.com/fabio-rovai/open-ontologies/tree/main/case-studies/certicoupla\n"
   ]
  },
  {
   "cell_type": "code",
   "metadata": {},
   "execution_count": null,
   "outputs": [],
   "source": [
    "!pip -q install numpy scipy scikit-learn requests\n",
    "!mkdir -p src data results\n",
    "!wget -q https://raw.githubusercontent.com/fabio-rovai/open-ontologies/main/case-studies/certicoupla/src/certicoupla.py -O src/certicoupla.py\n",
    "!wget -q https://raw.githubusercontent.com/fabio-rovai/open-ontologies/main/case-studies/certicoupla/data/oqmd.json -O data/oqmd.json\n",
    "print('ready')\n"
   ]
  },
  {
   "cell_type": "code",
   "metadata": {},
   "execution_count": null,
   "outputs": [],
   "source": [
    "!python src/certicoupla.py\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "---\n",
    "Independent conformal: ~90% marginal but only ~79% joint coverage. The coupled certificate restores ~90% joint; the copula certificate matches it in a much smaller region. Write-up: https://gov.tesseract.academy/research/copula-coupled-uncertainty-certificates\n"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "name": "python3"
  },
  "language_info": {
   "name": "python"
  },
  "colab": {
   "provenance": []
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}