Skip to main content

MED3pa: Predictive Performance Precision Analysis in Medicine

Table of Contents

Overview

Overview

The MED3pa package is specifically designed to address critical challenges in deploying machine learning models, with a particular focus on the robustness and reliability of models under real-world conditions. It provides comprehensive tools for evaluating model stability and performance in the face of prediction uncertainty and disadvantaged data profiles associated with degraded model performance. This work is developed alongside the associated methodological article, published in the Journal of the American Medical Informatics Association (JAMIA): https://doi.org/10.1093/jamia/ocag034. The full code used to generate the results presented in the article is available here: https://github.com/MEDomicsLab/study_3pa.

Key Functionalities

  • Model Confidence Estimation: Through the MED3pa subpackage, the package measures the predictive confidence at both individual and group (profile) levels. This helps in understanding the reliability of model predictions and in making informed decisions based on model outputs.

  • Identification of disadvantaged Profiles: MED3pa analyzes data profiles for whom the BaseModel consistently leads to poor model performance. This capability allows developers to refine training datasets or retrain models to handle these edge cases effectively.

Subpackages

Overview

The package is structured into four distinct subpackages:

  • datasets: Stores and manages the dataset.
  • models: Handles ML models operations.
  • med3pa: Evaluates the model’s performance & extracts disadvantaged profiles.

This modularity allows users to easily integrate and utilize specific functionalities tailored to their needs without dealing with unnecessary complexities.

Getting Started with the Package

To get started with MED3pa, follow the installation instructions and usage examples provided in the documentation.

Installation

pip install MED3pa

A simple exemple

We have created a simple example of using the MED3pa package. See the full example here

from MED3pa.datasets import DatasetsManager
from MED3pa.med3pa import Med3paExperiment
from MED3pa.models import BaseModelManager
from MED3pa.visualization.mdr_visualization import visualize_mdr
from MED3pa.visualization.profiles_visualization import visualize_tree

...

# Initialize the DatasetsManager
datasets = DatasetsManager()
datasets.set_from_data(dataset_type="testing",
                       observations=x_evaluation.to_numpy(),
                       true_labels=y_evaluation,
                       column_labels=x_evaluation.columns)
# Initialize the BaseModelManager
base_model_manager = BaseModelManager(model=clf)

# Execute the MED3PA experiment
results = Med3paExperiment.run(
    datasets_manager=datasets,
    base_model_manager=base_model_manager,
    **med3pa_params
)

# Save the results to a specified directory
results.save(file_path='results/oym')

# Visualize results
visualize_mdr(result=results, filename='results/oym/mdr')
visualize_tree(result=results, filename='results/oym/profiles')

Acknowledgement

MED3pa is an open-source package developed at the MEDomicsLab laboratory. We welcome any contribution and feedback.

Authors

Supported Python Versions

The MED3pa package is developed and tested with Python 3.12.3.

Additionally, it is compatible with the following Python versions:

  • Python 3.11.x
  • Python 3.10.x
  • Python 3.9.x

While the package may work with other versions of Python, these are the versions we officially support and recommend.

Release files for MED3pa 1.0.4

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

Source distribution (sdist)

Source distribution for MED3pa 1.0.4
File Size Uploaded
med3pa-1.0.4.tar.gz 314.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for MED3pa 1.0.4
File Interpreter ABI Platform
med3pa-1.0.4-py3-none-any.whl Python 3 none any Details

Total release size: 410.1 kB

Release files / med3pa-1.0.4.tar.gz

Download URL med3pa-1.0.4.tar.gz
Size 314.6 kB
Tags Source
SHA-256 checksum
How to use checksums
a9f63f092a28bdf385021ee7dcb524cb9d4f46ef93e75f5cc0367a3e7b2739d6
BLAKE2b-256 checksum
How to use checksums
afd3620ed6aae7b4ad20da8d48862b42f3ce2c67d46d0f75b024d967635e0640
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 Jun 9, 2026.

Transparency log

Release files / med3pa-1.0.4-py3-none-any.whl

Download URL med3pa-1.0.4-py3-none-any.whl
Size 95.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9ff51a7d872ffa7ece9ddec7e2cf080354af43e9489d7b80191d20e9ab549cb4
BLAKE2b-256 checksum
How to use checksums
eca3b16f8c7ce629b396a3dbab8bbd42659d5f00635b6b73cc0ed3b0ee199c2e
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 Jun 9, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

1.0.4 This release

2 release files

1.0.3

2 release files

1.0.2

2 release files

1.0.1

2 release files

1.0.0

2 release files

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