Skip to main content

MELODY: Model EvaLuation across subgroups for cOnsistent Decision accuracY

Project description

MIDRC MELODY (Model EvaLuation across subgroups for cOnsistent Decision accuracY)

Overview | Installation | CLI Commands | Configuration | License

📱 Visit MIDRC Website

MIDRC MELODY is a tool designed to assess the performance and subgroup-level reliability and robustness of AI models developed for medical imaging analysis tasks, such as the estimation of disease severity. It enables consistent evaluation of models across predefined subgroups (e.g. manufacturer, race, scanner type) by computing intergroup performance metrics and corresponding confidence intervals.

The tool supports two types of evaluation:

  • Ordinal Estimation Task Evaluation:
    • Uses an ordinal reference standard ("truth") and ordinal AI model outputs.
    • Performance in terms of agreement of AI output with the reference standard "truth" is quantified using the quadratic weighted kappa (QWK) metric.
  • Binary Decision Task Evaluation:
    • Converts scores into binary decisions based on a threshold.
    • Computes Equal Opportunity Difference (EOD) and Average Absolute Odds Difference (AAOD) metrics using bootstrapping across various groups.
  • Generates spider plots comparing these metrics.
  • Saves the generated data for further analysis.

Data Processing and Visualization

  • Bootstrapping: Both scripts perform bootstrapping to compute confidence intervals for the respective metrics using NumPy's percentile method.
  • Plotting: Spider charts provide a visual overview of how each model's metrics vary across different groups and categories.
  • Utilities: Shared functionality is available in common utility modules (e.g., data_tools.py and plot_tools.py), ensuring easier maintenance and testing.

Overview

MIDRC MELODY is a lightweight toolkit for stress‑testing medical‑imaging AI models across clinical and demographic sub‑groups. It supports both command‑line and GUI workflows, enabling rapid quantification of performance disparities (QWK, EOD, AAOD, etc.) and intuitive radar‑chart visualisation.

  • Console‑first – core metrics and plots run with no GUI dependencies.
  • Opt‑in GUI – an optional PySide6 interface for interactive configuration and result browsing.
  • Config‑driven – YAML files keep experiments reproducible and shareable.

Installation

# Standard console install from PyPI
pip install midrc-melody

# (Alternative) Install in editable/development mode from source code
pip install -e .

Quick Start

# Run analysis (reads default config.yaml in current directory)
melody

# Launch the GUI
melody_gui

CLI Commands

Running melody opens a Command‑Line Interface (CLI), which presents a text‑based menu of interactive commands. Here’s what you can do:

Available Commands

  • Calculate QWK metrics: Computes delta QWK values for different subgroups and generates spider plots.
  • Calculate EOD and AAOD metrics: Computes EOD and AAOD metrics for binary decision tasks and generates spider plots.
  • Print config file contents: Displays the contents of the current YAML configuration file.
  • Change config file: Prompts you to enter and set a different configuration file path.
  • Launch GUI: Opens the Graphical User Interface (GUI) using PySide6 (requires PySide6).
  • Exit: Exits the program.

GUI (Optional)

Launching the graphical interface only requires that PySide6 is installed. If you used pip, the melody_gui command is available.

# Launch the GUI:
melody_gui

Configuration

Experiments are described in a single YAML file. Below is a minimal example that keeps storage light and avoids plotting custom order metadata.

input data:
  truth file: data/demo_truthNdemographics.csv
  test scores: data/demo_scores.csv
  uid column: case_name
  truth column: truth

# Scores ≥ binary threshold are counted as positive
binary threshold: 4
min count per category: 10

bootstrap:
  iterations: 1000
  seed: 42  # set to null for random entropy

output:
  qwk:  { save: false, file prefix: output/delta_kappas_ }
  eod:  { save: false, file prefix: output/eod_ }
  aaod: { save: false, file prefix: output/aaod_ }

numeric_cols:
  age_binned:
    raw column: age
    bins: [0, 18, 30, 40, 50, 65, 75, 85, .inf]

plot:
  clockwise: true            # rotate clockwise instead of CCW
  start: top                 # starting angle: top, bottom, left, right (t/b/l/r)

Input Data

File Required Columns Purpose Example
Truth file uid, truth, attributes… Ground‑truth labels and subgroup columns. demo_truth.csv
Score file uid, score Model predictions keyed to the same UID. demo_scores.csv

UID values must match between truth and score files.

License

Distributed under the Apache 2.0 License.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

midrc_melody-0.3.3.tar.gz (64.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

midrc_melody-0.3.3-py3-none-any.whl (74.4 kB view details)

Uploaded Python 3

File details

Details for the file midrc_melody-0.3.3.tar.gz.

File metadata

  • Download URL: midrc_melody-0.3.3.tar.gz
  • Upload date:
  • Size: 64.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.2

File hashes

Hashes for midrc_melody-0.3.3.tar.gz
Algorithm Hash digest
SHA256 11d91e6e37801ab621a09e1135da10c2bc8c66a62385c26d4393951b17cafd0f
MD5 bd7f817b43134419a3f64adebb86a199
BLAKE2b-256 766f3e864458ac171daec22bd43f3a9e5d2e278aa6ef790fa928bd7dc80ae356

See more details on using hashes here.

File details

Details for the file midrc_melody-0.3.3-py3-none-any.whl.

File metadata

  • Download URL: midrc_melody-0.3.3-py3-none-any.whl
  • Upload date:
  • Size: 74.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.2

File hashes

Hashes for midrc_melody-0.3.3-py3-none-any.whl
Algorithm Hash digest
SHA256 54b84ad7b309283cf8e37e6ae7eddfbebdda89cd2728e252f6b5d26ffbf35c64
MD5 71693c67927b8c0a0c511715bba98057
BLAKE2b-256 bff1106d2fa10e4233708a8ac3a551cd5b1f42a478b17352e276b70f2b1c0615

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page