SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2205.14116 · 2022

Don't Explain Noise: Robust Counterfactuals for Randomized Ensembles

arXiv · PDF · Open in the Atlas

Code that ran

7 of 7 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 7 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/2205.14116.json · badge: /api/ran/2205.14116.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
alexforel/robustcf4rf canonical (classifier label)
classifier basis not recorded on the link
7 ran · 0 no recorded run
FunctionStatusWhere it lives
feature_permutation_importance Ran
ran on a synthesized input
alexforel/robustcf4rf/src/feature_importance.py
code served (permissive licence) · get_code("44a951437a470c44")
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 list, ndim 3, dtype family float; no output shape is stated. The image it ran in was not recorded. If your copy returns the same type and ndim 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 sklearn.ensemble import RandomForestClassifier
from sklearn.model_selection import train_test_split
from sklearn.inspection import permutation_importance

np.random.seed(0)

# Create small synthetic dataset
# x: 10 samples, 4 features
# y: binary classification labels
x = np.random.randn(10, 4).astype(np.float32)
y = np.array([0, 1, 0, 1, 0, 1, 0, 1, 0, 1])

# Parameters
nbRepeats = 2
maxDepth = 3
m_n = 5  # number of estimators

ARGS = {
    'x': x,
    'y': y,
    'nbRepeats': nbRepeats,
    'maxDepth': maxDepth,
    'm_n': m_n
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, sklearn — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type list, ndim 3, dtype family float — a list output has no array shape of its own; none is stated
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
forest_probability Ran
ran on a synthesized input
alexforel/robustcf4rf/illustrate_p_star_b_alpha.py
code served (permissive licence) · get_code("2165223921ed2bfd")
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 float64, ndim 0, dtype family float; no output shape is stated. The image it ran in was not recorded. If your copy returns the same type and ndim 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 scipy.stats import binom

torch.manual_seed(0)

# The function forest_probability takes two parameters:
# - N: an integer representing the number of trials
# - p: a float representing the probability of success
# 
# The function uses:
# - binom.cdf(N / 2, N, p) which requires N (int), N/2 (float), and p (float)
# 
# Valid arguments would be:
# N: a positive integer (e.g., 100)
# p: a probability value between 0 and 1 (e.g., 0.5)

ARGS = {
    "N": 100,
    "p": 0.5
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, scipy, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type float64, ndim 0, dtype family float — no output shape is stated: observe_signature.py recorded float ndim 0, which disagrees with the fixture run
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
p_agresti_coull Ran
ran on a synthesized input
alexforel/robustcf4rf/src/binomial_confidence.py
code served (permissive licence) · get_code("03f5d8d3886c797d")
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 float, ndim 0, dtype family float, shape () 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 torch
import numpy as np

torch.manual_seed(0)

# p_agresti_coull takes two parameters:
# T: number of observations (likely a scalar or array)
# p: empirical success rate (likely a scalar or array)

# The function performs arithmetic operations: (T * p + 2) / (T + 4)
# So both T and p should be numeric types that support multiplication and addition

# Create simple numeric arguments
T = 100  # number of observations
p = 0.6  # empirical success rate

ARGS = {
    "T": T,
    "p": p
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type float, ndim 0, dtype family float, shape () — shape () 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
p_star_threshold Ran
ran on a synthesized input
alexforel/robustcf4rf/src/binomial_confidence.py
code served (permissive licence) · get_code("7006f4bc78ccbd08")
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 list, ndim 1, dtype family float; no output shape is stated. The image it ran in was not recorded. If your copy returns the same type and ndim 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.stats import norm, binom

# Construct arguments for p_star_threshold function
# The function takes:
# - m_n: number of trees (should be a positive integer)
# - alpha: significance level (should be between 0 and 1)

ARGS = {
    "m_n": 100,
    "alpha": 0.05
}
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 list, ndim 1, dtype family float — a list output has no array shape of its own; none is stated
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
read_full_results_df Ran
ran on a synthesized input
alexforel/robustcf4rf/src/result_analysis.py
code served (permissive licence) · get_code("2bbc6ace9afc547c")
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 os
import pandas as pd
import tempfile
import shutil

# Create a temporary directory structure with CSV files
temp_dir = tempfile.mkdtemp()
dataset_name = "test_dataset"
dataset_path = os.path.join(temp_dir, dataset_name)
os.makedirs(dataset_path, exist_ok=True)

# Create sample CSV files
df1 = pd.DataFrame({
    'col1': [1, 2, 3],
    'col2': ['a', 'b', 'c']
})
df1.to_csv(os.path.join(dataset_path, 'results_1.csv'), index=False)

df2 = pd.DataFrame({
    'col1': [4, 5, 6],
    'col2': ['d', 'e', 'f']
})
df2.to_csv(os.path.join(dataset_path, 'results_2.csv'), index=False)

ARGS = {
    'datasetName': 'test_dataset',
    'subPath': temp_dir + '/'
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
pandas — 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
restricted_training_set_with_target_class Ran
ran on a synthesized input
alexforel/robustcf4rf/src/local_outlier_factor.py
code served (permissive licence) · get_code("ee0cc739cc4ab2a8")
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 list, ndim 2, dtype family float; no output shape is stated. The image it ran in was not recorded. If your copy returns the same type and ndim 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 sklearn.neighbors import NearestNeighbors

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

# Create sample data
# x_targetClass: a 2D array of target class samples (shape: n_samples x n_features)
x_targetClass = np.random.randn(15, 4).astype(np.float32)

# x_init: a 1D array representing a single sample to query (shape: n_features,)
x_init = np.random.randn(4).astype(np.float32)

ARGS = {
    "x_targetClass": x_targetClass,
    "x_init": x_init,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, sklearn — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type list, ndim 2, dtype family float — a list output has no array shape of its own; none is stated
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
robust_p_star_threshold Ran
ran on a synthesized input
alexforel/robustcf4rf/src/binomial_confidence.py
code served (permissive licence) · get_code("03910e4b1db029cf")
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 list, ndim 1, dtype family float; no output shape is stated. The image it ran in was not recorded. If your copy returns the same type and ndim 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.stats import norm, binom

# Read the function signature:
# robust_p_star_threshold(m_n, alpha, beta)
#
# From the function body:
# - m_n: used as int in np.linspace and binom.cdf(m_n / 2, m_n, ...)
#   It represents number of trials/observations
# - alpha: used as float, compared with <= 1, and in binom.cdf
#   It's a probability/threshold
# - beta: used as float, passed to robust_agresti_coull_p_estimate as beta parameter
#   It's a confidence level parameter

# Valid test values:
ARGS = {
    "m_n": 100,           # number of observations (should be > 0)
    "alpha": 0.05,        # significance level (between 0 and 1)
    "beta": 0.05,         # confidence parameter (between 0 and 1)
}
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 list, ndim 1, dtype family float — a list output has no array shape of its own; none is stated
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

Also present in other papers' code

Of 7 samples lifted from this paper's linked repositories, 7 carry a function identity and 0 do not. Of the 7 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 7 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

Counterfactual explanations describe how to modify a feature vector in order to flip the outcome of a trained classifier. Obtaining robust counterfactual explanations is essential to provide valid algorithmic recourse and meaningful explanations. We study the robustness of explanations of randomized ensembles, which are always subject to algorithmic uncertainty even when the training data is fixed. We formalize the generation of robust counterfactual explanations as a probabilistic problem and show the link between the robustness of ensemble models and the robustness of base learners. We develop a practical method with good empirical performance and support it with theoretical guarantees for ensembles of convex base learners. Our results show that existing methods give surprisingly low robustness: the validity of naive counterfactuals is below $50\%$ on most data sets and can fall to $20\%$ on problems with many features. In contrast, our method achieves high robustness with only a small increase in the distance from counterfactual explanations to their initial observations.

For agents

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

get_harvested_code_for_paper("2205.14116")
get_code_for_paper("2205.14116")
have("2205.14116")

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

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

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

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

Connect an agent — have() is free.