SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2305.10564 · NeurIPS · 2023

Counterfactually Comparing Abstaining Classifiers

Yo Choe, Aaditya Ramdas, Aditya Gangrade

arXiv · PDF · Open in the Atlas

Code that ran

9 of 9 samples (functions and classes) lifted from this paper's linked repositories executed on a synthesized input in Syntology's jail (0 of them constructed an object rather than computing a result; 0 honoured the contract we drafted, 0 violated it and 9 have no contract verdict; 0 failures of our instrument; 0 no recorded run), measured 2026-11-23; repository links from the Papers with Code archive attributed under CC BY-SA, no affiliation; bodies inline only under a permissive licence as GitHub detects it. Not a reproduction of the paper's results.

"Ran" means the function executed on a synthesized input and returned a value. It is not a reproduction of the paper's results. This record, dated, as JSON: /api/ran/2305.10564.json · badge: /api/ran/2305.10564.svg

Each repository's role is a label: a classifier's output recorded on the link, or, where no role is recorded, what the Papers with Code archive marked. The line under it names its basis. Neither says who wrote the code.

RepositoryRoleRan
yjchoe/ComparingAbstainingClassifiers canonical (classifier label)
classifier basis: census
9 ran · 0 no recorded run
FunctionStatusWhere it lives
compute_confidence Ran
ran on a synthesized input
yjchoe/ComparingAbstainingClassifiers/comparecast_causal/abstaining_predictors.py
code served (permissive licence) · get_code("7dc1be337fe9d277")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned ndarray, ndim 1, dtype family float, shape (2,) as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import numpy as np

# Create a small batch of probabilistic predictions
# Shape: (batch_size=2, num_classes=4)
pred_probs = np.array([
    [0.1, 0.2, 0.3, 0.4],
    [0.25, 0.25, 0.25, 0.25]
], dtype=np.float32)

ARGS = {
    'pred_probs': pred_probs,
    'metric': 'sr'
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type ndarray, ndim 1, dtype family float, shape (2,) — shape (2,) as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
confint_clt Ran
ran on a synthesized input
yjchoe/ComparingAbstainingClassifiers/comparecast_causal/drconfint.py
code served (permissive licence) · get_code("674c094809544cb9")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned ndarray, ndim 1, dtype family float, shape (2,) as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import numpy as np
from scipy import stats

# Set random seed for reproducibility
np.random.seed(0)

# Create a small sample array for testing
# The function requires n > 1, so we need at least 2 elements
xs = np.array([1.2, 2.3, 3.1, 2.9, 3.5, 1.8], dtype=np.float64)

# Define arguments for confint_clt
ARGS = {
    'xs': xs,
    'alpha': 0.05,
    'return_all_n': False
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, scipy — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type ndarray, ndim 1, dtype family float, shape (2,) — shape (2,) as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
convert_to_onehot Ran
ran on a synthesized input
yjchoe/ComparingAbstainingClassifiers/comparecast_causal/utils.py
code served (permissive licence) · get_code("d24633be058fec72")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned ndarray, ndim 2, dtype family float, shape (6, 4) as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import numpy as np
from numpy.typing import ArrayLike

# Create a simple integer array to convert to one-hot
xs_input = np.array([0, 1, 2, 1, 0, 3])

# Define ARGS with parameters for convert_to_onehot
ARGS = {
    "xs": xs_input,
    "n_classes": 0,  # Will be inferred from max value in xs
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type ndarray, ndim 2, dtype family float, shape (6, 4) — shape (6, 4) as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
convert_to_ordinal Ran
ran on a synthesized input
yjchoe/ComparingAbstainingClassifiers/comparecast_causal/utils.py
code served (permissive licence) · get_code("1e02678d06f7e01c")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned ndarray, ndim 2, dtype family int, shape (2, 3) as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import numpy as np

# Create a small one-hot encoded array
# Shape: (2, 3, 4) where last axis is one-hot dimension with 4 classes
# Batch size 2, sequence length 3, 4 classes
xs = np.array([
    [[1, 0, 0, 0],
     [0, 1, 0, 0],
     [0, 0, 1, 0]],
    [[0, 0, 0, 1],
     [1, 0, 0, 0],
     [0, 1, 0, 0]]
], dtype=np.float32)

ARGS = {
    "xs": xs
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type ndarray, ndim 2, dtype family int, shape (2, 3) — shape (2, 3) as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
generate_binary_mar Ran
ran on a synthesized input
yjchoe/ComparingAbstainingClassifiers/comparecast_causal/data_utils/abstaining_classifiers.py
code served (permissive licence) · get_code("f1f5e0682bdb9c8f")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned DataFrame. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import numpy as np
import pandas as pd

# Create a properly seeded random number generator
rng = np.random.default_rng(42)

# Define arguments for generate_binary_mar
ARGS = {
    'n': 100,
    'epsilon': 0.2,
    'threshold': 0.2,
    'noise_level': 0.15,
    'is_comparison': False,
    'threshold_b_mult': 0.8,
    'is_power_analysis': False,
    'power_mu': 0.1,
    'return_np_arrays': False,
    'for_plotting': False,
    'rng': rng
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, pandas, scipy — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type DataFrame — a DataFrame output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a DataFrame output the recorded ndim 2 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
generate_differently_imbalanced_data Ran
ran on a synthesized input
yjchoe/ComparingAbstainingClassifiers/comparecast_causal/data_utils/abstaining_classifiers.py
code served (permissive licence) · get_code("e3b49a725b942885")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned tuple. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import numpy as np
import pandas as pd

np.random.seed(42)

ARGS = {
    'n_train': 300,
    'n_test': 300,
    'n_classes': 3,
    'n_dim': 2,
    'base_noise': 1.0,
    'noise_scales': (1.0, 1.0, 1.0),
    'subsplits': (('subsplit_A', 2), ('subsplit_B', 1)),
    'drop_minor_label': 0.99,
    'rng': np.random.default_rng(seed=42)
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, pandas — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type tuple — a tuple output has no array shape of its own; none is stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
make_linear_classifier Ran
ran on a synthesized input
yjchoe/ComparingAbstainingClassifiers/comparecast_causal/learners.py
code served (permissive licence) · get_code("4411536d6d628e67")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned Pipeline. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import numpy as np
from sklearn.pipeline import make_pipeline
from sklearn.preprocessing import StandardScaler
from sklearn.linear_model import LogisticRegression

torch.manual_seed(0)

# Create a simple scaler instance
scaler_instance = StandardScaler()

# Create kwargs for LogisticRegression
# These are optional parameters that can be passed to LogisticRegression
kwargs = {
    'max_iter': 1000,
    'random_state': 42,
    'solver': 'lbfgs'
}

ARGS = {
    'scaler': scaler_instance,
    **kwargs
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, sklearn, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Pipeline — a Pipeline output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a Pipeline output the recorded ndim 1 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
make_linear_regressor Ran
ran on a synthesized input
yjchoe/ComparingAbstainingClassifiers/comparecast_causal/learners.py
code served (permissive licence) · get_code("03179e90b0c25205")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned Pipeline. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import numpy as np
from sklearn.preprocessing import StandardScaler
from sklearn.linear_model import Ridge

torch.manual_seed(0)

# Construct arguments for make_linear_regressor
ARGS = {
    "scaler": StandardScaler(),
    "alpha": 1.0,
    "fit_intercept": True,
    "max_iter": 1000,
    "tol": 1e-4,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, sklearn, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Pipeline — a Pipeline output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a Pipeline output the recorded ndim 1 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
predict_or_abstain Ran
ran on a synthesized input
yjchoe/ComparingAbstainingClassifiers/comparecast_causal/abstaining_predictors.py
code served (permissive licence) · get_code("b57a4f5daec383d9")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned tuple. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import numpy as np
import pandas as pd
from sklearn.ensemble import RandomForestClassifier

# Create a small scikit-learn classifier
clf = RandomForestClassifier(n_estimators=2, random_state=42)
X_train = np.random.rand(10, 4)
y_train = np.array([0, 1, 0, 1, 0, 1, 0, 1, 0, 1])
clf.fit(X_train, y_train)

# Create test data
X_test = np.random.rand(2, 4)

# Alternative: pre-computed predictions (2 samples, 3 classes)
pred_probs = np.array([
    [0.7, 0.2, 0.1],
    [0.3, 0.5, 0.2]
])

# Create RNG
rng = np.random.default_rng(seed=42)

ARGS = {
    'clf_or_preds': pred_probs,
    'X': None,
    'confidence_metric': 'sr',
    'threshold': 0.7,
    'stochastic': True,
    'eps': 0.001,
    'rng': rng
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, pandas, sklearn — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type tuple — a tuple output has no array shape of its own; none is stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block

Also present in other papers' code

Of 9 samples lifted from this paper's linked repositories, 9 carry a function identity and 0 do not. Of the 9 distinct functions with an identity, 0 are also present in other papers whose code we hold (0 with at least one paper dated earlier, 0 the same month, 0 later) and 9 are only here among the 52,977 papers whose code Syntology holds (as of 2026-09-26).

Only here means: among the 52,977 papers whose code Syntology holds (51,887 with lifted samples, 1,090 through their assemblies only), as of 2026-09-26, no other paper's lifted samples or current assembly bricks contain an identical function body after normalisation.

Presence, not direction: an identical function body in two papers' repositories does not say who wrote it, which came from which, or that either paper's method rests on it. Matching is exact after normalisation, so a renamed or edited function is not matched. Dates are when papers appeared, not when code was written. Only .py files the harvester lifted are covered; notebooks are not read. A new-style arXiv id YYMM.NNNN dates a paper to the month 20YY-MM; otherwise Paper.year dates it to the year; otherwise it is undated. Dates are when the paper appeared, not when the code was written. Read 2026-11-23.

Repositories linked to this paper

Some links come from the archived Papers with Code dataset (CC BY-SA 4.0): attribution and licence.

Abstract

Abstaining classifiers have the option to abstain from making predictions on inputs that they are unsure about. These classifiers are becoming increasingly popular in highstakes decision-making problems, as they can withhold uncertain predictions to improve their reliability and safety. When evaluating black-box abstaining classifier(s), however, we lack a principled approach that accounts for what the classifier would have predicted on its abstentions. These missing predictions matter when they can eventually be utilized, either directly or as a backup option in a failure mode. In this paper, we introduce a novel approach and perspective to the problem of evaluating and comparing abstaining classifiers by treating abstentions as missing data. Our evaluation approach is centered around defining the counterfactual score of an abstaining classifier, defined as the expected performance of the classifier had it not been allowed to abstain. We specify the conditions under which the counterfactual score is identifiable: if the abstentions are stochastic, and if the evaluation data is independent of the training data (ensuring that the predictions are missing at random), then the score is identifiable. Note that, if abstentions are deterministic, then the score is unidentifiable because the classifier can perform arbitrarily poorly on its abstentions. Leveraging tools from observational causal inference, we then develop nonparametric and doubly robust methods to efficiently estimate this quantity under identification. Our approach is examined in both simulated and real data experiments.

For agents

The same record, over MCP at https://syntology.ai/mcp:

get_harvested_code_for_paper("2305.10564")
get_code_for_paper("2305.10564")
have("2305.10564")

The run record, dated, one paper per request, free:

curl https://syntology.ai/api/ran/2305.10564.json

A badge for a README (the split and the date, never a ratio):

[![Syntology run record](https://syntology.ai/api/ran/2305.10564.svg)](https://syntology.ai/paper/2305.10564)

Connect an agent — have() is free.