AFISP: Software to identify patient characteristics and data acquisition parameters associated with high error rates in predictive AI/ML models
This repository contains code for the Regulatory Science Tool titled AFISP. The tool allows users to probe a trained machine learning (ML) or AI model for subgroups on which it underperforms.
Full documentation can be viewed at https://afisp.readthedocs.io/.
Installation
AFISP is a pure-Python package (Python 3.10+). Its rule-extraction step uses the
pure-Python sirus package, so no R
installation is required. Install it with pip:
pip install afisp
To install the latest version from source (e.g. for development):
git clone https://github.com/asubbaswamy/AFISP.git
cd AFISP
pip install -e ".[test]"
The optional torch extra (pip install "afisp[torch]") is only needed for the
torch_roc_auc_surrogate loss in afisp.utils.
Run the test suite with pytest.
Repo Organization
The /afisp directory contains the source code for the tool.
A demo jupyter notebook showcasing the core functionality of the tool can be found in 'demo.ipynb'.
Tool Description
AFISP is a tool used to evaluate predictive AI models for patient subgroups with high error rates. The tool is applied after AI models have been trained and is applicable across many types of diagnostic and prognostic AI applications and modalities. Specifically, for a given AI model, AFISP requires three inputs: First, it requires per-sample loss function values (i.e., per-sample error values) for an independent test dataset (i.e., a dataset consisting of data samples that were not used to train or tune the AI model). Second, it requires meta-data such as measured patient characteristics (e.g., demographic information, comorbidities, etc.) or data acquisition parameters (e.g., X-ray radiation dose, scanner type) for each sample in the evaluation dataset. Third, it uses a performance threshold, which can be selected using prior knowledge or using a reference model. Given these inputs, AFISP identifies the worst-performing data subset: the largest subset of the evaluation dataset that produces performance below the threshold. The worst-performing data subset contains samples with the highest expected error rates (based on the meta-data features) and will have a different distribution of the meta-data features than the full evaluation dataset.
After selecting the worst-performing data subset, AFISP identifies interpretable subgroups (combinations of meta-data values such as “male patients with dementia”) present within the subset. This allows the user to understand specific characteristics of the data subset that are associated with the model’s lower performance. AFISP outputs a table of subgroups with low AI model performance, along with their sizes and performance values.
Purpose
AFISP is a software tool intended for exploratory analysis of patient subgroups to help identify which subgroups the predictive AI model is inaccurate. After a predictive AI model has been trained, model developers can use AFISP to test their models for the existence of subgroups on whom their model performs poorly. This is important for understanding the range of populations and data acquisition parameters for which the model may be unreliable. When AFISP identifies a subgroup, this can prompt model developers to perform further analysis to better understand the subgroup and to update or improve their model (for example, by collecting additional data from the underperforming subgroup and fine-tuning).
Metadata
Release files for afisp 0.2.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| afisp-0.2.1.tar.gz | 17.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| afisp-0.2.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 32.1 kB
Release files / afisp-0.2.1.tar.gz
| Download URL | afisp-0.2.1.tar.gz |
|---|---|
| Size | 17.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9aabf771b77013aff49b626011f83dd72342f46c47bf8d20080189ab17228d71
|
|
BLAKE2b-256 checksum How to use checksums |
1ae8a301d520a005c899c8987b8f39599a742cdcf036ce7613f508a2fcd93df2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jul 14, 2026.
Transparency logRelease files / afisp-0.2.1-py3-none-any.whl
| Download URL | afisp-0.2.1-py3-none-any.whl |
|---|---|
| Size | 14.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ec4e8db7a056b93d60f84de9b680ea60f2c1e212854a88e02958f8eb35717c1f
|
|
BLAKE2b-256 checksum How to use checksums |
40c635fbfe1db9d93efb3ce2ee87dc8c24f68d1ddbd130c849fd577e24c4c779
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jul 14, 2026.
Transparency log