Skip to main content

APLUS ML

A Python Library for Usefulness Simulations of Machine Learning Models

⚙ Documentation • 🐍 PyPi • 📝 Paper

pip install aplusml

Installation

  1. Run the following commands to install APLUS ML:
pip install aplusml
  1. Install graphviz by downloading it here. If you're on Mac with homebrew, simply run:
brew install graphviz

Usage

Please see the documentation for usage examples.

Run tutorials/synthetic_pad.ipynb to try an example notebook which works out-of-the-box.

This simulates a utility analysis of PAD referral pathways for synthetic PAD patients.

Motivation

APLUS ML is a simulation framework for conducting usefulness assessments of machine learning models in workflows.

It aims to quantitatively answer the question: If I use this ML model within this workflow, will the benefits outweigh the costs, and by how much?

APLUS was originally developed for clinical workflows in healthcare settings, thus all of our examples are healthcare workflows. However, APLUS ML is a broadly applicable library to any workflow that involves a machine learning model making decisions on a stream of datapoints, and we encourage contributors from any domain to use and extend APLUS ML.

Tutorials

We showcase APLUS on two clinical workflows:

  1. Early detection of peripheral artery disease (PAD)
  2. Triaging patients for advanced care planning (ACP) consults

Jupyter notebooks for these use cases can be found in the tutorials/ folder.

Early Detection of PAD

The code used to generate the figures in our paper is located in the tutorials/ directory in pad.ipynb. This notebook loads de-identified patient data from Stanford Hospital, which can be provided upon request.

The workflows analyzed can be found in the workflows/ folder. The doctor-driven workflow is in pad_doctor.yaml while the nurse-driven workflow is in pad_nurse.yaml

This tutorials/pad.ipynb was used to generate the following figures from the APLUS paper:

PAD Figure 1

PAD Figure 2

Triaging Patients for ACP Consults

The code used to replicate the findings of Jung et al. 2021 can be found in the tutorials/ directory in acp_jung_replication.ipynb. This notebook loads de-identified patient data from Stanford Hospital, which can be provided upon request.

The workflows analyzed can be found in the workflows/ folder in acp_jung_replication.yaml

ACP Figure

Some additional example plots that can be generated by APLUS are included below:

Additional Plots

Development

Installation

# Download repo
git clone https://github.com/som-shahlab/aplus.git
cd aplus

# Create environment
conda create -n aplus python=3.10 -y
conda activate aplus
pip install poetry && poetry install

Tests

The file tests/run_tests.py runs all of the test[d].py files in the tests/ directory. Each test[d].py file has a corresponding test[d].yaml file that serves as its input.

To run tests:

cd tests
python3 run_tests.py

Documentation

We use Sphinx to build the documentation, and host it on Read the Docs.

To build the docs, run:

# View server
sphinx-autobuild docs/source docs/build/html

# Build for dist
make html

Deploy to PyPi

poetry build
poetry publish

Citation

@article{wornow2023aplus,
  title={APLUS: A Python Library for Usefulness Simulations of Machine Learning Models in Healthcare},
  author={Wornow, Michael and Ross, Elsie Gyang and Callahan, Alison and Shah, Nigam H},
  journal={Journal of Biomedical Informatics},
  pages={104319},
  year={2023},
  publisher={Elsevier}
}

Metadata

Release files for aplusml 0.3.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for aplusml 0.3.1
File Size Uploaded Provenance Actions
aplusml-0.3.1.tar.gz 44.0 kB Without provenance Details for aplusml-0.3.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for aplusml 0.3.1
File Interpreter ABI Platform Actions
aplusml-0.3.1-py3-none-any.whl Python 3 none any Details for aplusml-0.3.1-py3-none-any.whl

Total release size: 89.5 kB

Release files / aplusml-0.3.1.tar.gz

Download URL aplusml-0.3.1.tar.gz
Size 44.0 kB
Tags Source
SHA-256 checksum
How to use checksums
f1360f06752d1e01fe7af3e2efe4fb9d46298d80287bb1793c13d67f797509dc
BLAKE2b-256 checksum
How to use checksums
027822a4e9840e7ef78b60937c2e63293e10c1466fd303d84aa8839c8f59364c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.1.1 CPython/3.10.10 Darwin/24.4.0

Release files / aplusml-0.3.1-py3-none-any.whl

Download URL aplusml-0.3.1-py3-none-any.whl
Size 45.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3b21414362626607fe8df772630ec6df826f158439f30bbb3bfdfa473be251d2
BLAKE2b-256 checksum
How to use checksums
6daa1050cee16477a23a0c5c767ca2a9dcf95af57d81a55542f52c31711bb3ec
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.1.1 CPython/3.10.10 Darwin/24.4.0

Security for aplusml 0.3.1

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page