Skip to content

Add margin score_type to NaiveCP (BaseConformal) - #1220

Open
lehendo wants to merge 1 commit into
sunlabuiuc:masterfrom
lehendo:basecpfix
Open

Add margin score_type to NaiveCP (BaseConformal)#1220
lehendo wants to merge 1 commit into
sunlabuiuc:masterfrom
lehendo:basecpfix

Conversation

@lehendo

@lehendo lehendo commented Aug 30, 2026

Copy link
Copy Markdown
Collaborator

Title is self explanatory.

… 2007), keep threshold as the uniform default across all CP classes

BaseConformal's docstring claimed to implement 'naive' split conformal
prediction per Papadopoulos, Vovk, and Gammerman (2007), but its only
score_type="threshold" computed 1 - p(true class) -- Sadinle, Lei, and
Wasserman's (2019) exact LABEL/LAC formula -- with no way to actually get
that paper's own method through this class.

Verified against the primary source (Papadopoulos's 2008 InTech chapter,
which explicitly restates the ICTAI 2007 paper's Section 4 content): the
paper's actual nonconformity measure for neural-network classifiers is a
margin, max_{j!=k} p(j) - p(k) ("the natural nonconformity measure").
Added this as a new score_type="margin" in scores.py, available on
BaseConformal alongside the existing "threshold"/"aps" options.

score_type="threshold" remains BaseConformal's default, consistent with
every other score-then-quantile class in the package (LABEL, ClusterLabel,
CovariateLabel, NeighborhoodLabel) -- coverage validity never depended on
score choice (Vovk, Gammerman, and Shafer 2005), so this is purely about
giving BaseConformal a real, working way to reproduce Papadopoulos et
al.'s specific paper on request, without changing any class's default
behavior.
@fbonc

fbonc commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

lgtm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants