AIM-CU documentation¶
A CUSUM-based tool for AI Monitoring
Monitoring a clinically deployed AI device to detect performance drift is an essential step to ensure the safety and effectiveness of AI.
AIM-CU is a statistical tool for AI monitoring using cumulative sum (AIM-CU).
AIM-CU computes:
The parameter choices for change-point detection based on an acceptable false alarm rate
Detection delay estimates for a given displacement of the performance metric from the target for those parameter choices.
System setup¶
Make sure R is installed in the system. Instructions for linux (the below setup is only performed in linux):
wget -qO- https://cloud.r-project.org/bin/linux/ubuntu/marutter_pubkey.asc | tee -a /etc/apt/trusted.gpg.d/cran_ubuntu_key.asc
add-apt-repository "deb https://cloud.r-project.org/bin/linux/ubuntu $(lsb_release -cs)-cran40/"
apt-get install -y --no-install-recommends r-base r-base-dev
# setup R configs
echo "r <- getOption('repos'); r['CRAN'] <- 'http://cran.us.r-project.org'; options(repos = r);" > ~/.Rprofile
Rscript -e "install.packages('ggplot2')"
Rscript -e "install.packages('hexbin')"
Rscript -e "install.packages('lazyeval')"
Rscript -e "install.packages('cusumcharter')"
Rscript -e "install.packages('RcppCNPy')"
Rscript -e "install.packages('spc')"
Code execution¶
Clone AIM-CU repository.
git clone https://github.com/DIDSR/AIM-CU.git
Run the following commands to install required dependencies (Python = 3.10 is used).
apt-get -y install python3
apt-get -y install pip
cd AIM-CU
pip install -r requirements.txt
Run AIM-CU.
cd src/package
python3 app.py
Open the URL http://0.0.0.0:7860 that is running the AIM-CU locally.
Example code execution¶
Example code can be run in a Jupyter Notebook after opening it with jupyter notebook
command from /src/package/
directory. The tool is designed to used through UI, not from console.
Demo¶
AIM-CU can also be run through the demo available at https://huggingface.co/spaces/didsr/AIM-CU. If Space is paused, click on Restart button.
Usability¶
Example AI output CSV file is available as config/spec-60-60.csv to be uploaded in monitoring phase.
Workflow instruction to run the tool is available at bottom-left of UI.
Sample UI output is available at assets/ui.png.
Setting
control:save_figure
totrue
from config.toml will save tables and plots in figure/.Running AIM-CU does not take time longer than a few seconds, and it does not require GPU.
AIM-CU¶
Disclaimer¶
This software and documentation was developed at the Food and Drug Administration (FDA) by employees of the Federal Government in the course of their official duties. Pursuant to Title 17, Section 105 of the United States Code, this work is not subject to copyright protection and is in the public domain. Permission is hereby granted, free of charge, to any person obtaining a copy of the Software, to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, or sell copies of the Software or derivatives, and to permit persons to whom the Software is furnished to do so. FDA assumes no responsibility whatsoever for use by other parties of the Software, its source code, documentation or compiled executables, and makes no guarantees, expressed or implied, about its quality, reliability, or any other characteristic. Further, use of this code in no way implies endorsement by the FDA or confers any advantage in regulatory decisions. Although this software can be redistributed and/or modified freely, we ask that any derivative works bear some notice that they are derived from it, and any modified versions bear some notice that they have been modified.