Skip to main content

Conformal selective prediction with general risk control.

Project description

SCoRE

SCoRE implements conformal selective prediction procedures for marginal deployment risk (MDR) and selective deployment risk (SDR) control.

This repository also contains the simulation and application code used for the paper Conformal Selective Prediction with General Risk Control.

Installation

Install the package from a local checkout:

python -m pip install -e .

Install optional dependencies for the research scripts:

python -m pip install -e ".[experiments]"

After the package is published, install it with:

python -m pip install score-select

Quickstart

import numpy as np
from SCoRE import SCoRE_MDR, SCoRE_SDR

lcalib = np.array([0, 1, 0, 1])
scalib = np.array([0.1, 0.4, 0.2, 0.8])
stest = np.array([0.15, 0.5, 0.9])

dcalib = (lcalib, scalib)
dtest = stest

mdr_selected = SCoRE_MDR(dcalib, dtest, alpha=0.5, gamma=0.5)
sdr_selected = SCoRE_SDR(dcalib, dtest, alpha=0.5, gamma=0.5)

Functions return NumPy integer index arrays, so selections can be used directly to index NumPy arrays.

When using randomized pruning, pass random_state for reproducible results:

selected = SCoRE_SDR(
    dcalib,
    dtest,
    alpha=0.5,
    gamma=1.0,
    prune="hete",
    random_state=123,
)

Public API

The top-level package exports the main procedures and utilities:

Recommended package entry points:

  • SCoRE_MDR
  • SCoRE_SDR

Additional utilities:

  • CS
  • SCoRE_MDR_bf, SCoRE_MDR_w, SCoRE_SDR_w
  • BH, eBH
  • eval_MDR, eval_SDR
  • loss_Jin2023, loss_1, loss_2
  • gen_data_Jin2023, gen_data_1, gen_data_2
  • Lpredictor

Repository Layout

  • SCoRE/: installable Python package
  • tests/: package tests
  • applications/: real-data applications
    • applications/drug/: efficient, cost-aware drug discovery
    • applications/icu/: clinical prediction error management
    • applications/llm/: flexible LLM abstention
  • simulation/: simulation experiments
  • simulation_w/: simulation experiments with covariate shifts

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

score_select-0.1.1.tar.gz (11.9 kB view details)

Uploaded Source

Built Distribution

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

score_select-0.1.1-py3-none-any.whl (10.2 kB view details)

Uploaded Python 3

File details

Details for the file score_select-0.1.1.tar.gz.

File metadata

  • Download URL: score_select-0.1.1.tar.gz
  • Upload date:
  • Size: 11.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.2

File hashes

Hashes for score_select-0.1.1.tar.gz
Algorithm Hash digest
SHA256 3255ca113cca5b1aaf98fe6e162e83d42b98803cbb717499aae2995ddf46e1b5
MD5 5be7e1c0b3bfc5a8630ba6b9b2c7a3c6
BLAKE2b-256 e6c10a31fb22f52960bdb69ed02be7744b691e5e393942e810049302c5e663d7

See more details on using hashes here.

File details

Details for the file score_select-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: score_select-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 10.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.2

File hashes

Hashes for score_select-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 b38900a4d2e30916f70b7d942929d84ba559b0017e562fb59d7f4758113fc2f3
MD5 d83270ec4764dc8b2ad1ed8c52d105e6
BLAKE2b-256 2ac5e59a8b5097f07ab9413dbb6277342af46bc8c167a15e0494400fc4d8dcc6

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