SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 1910.12336 · 2019

CXPlain: Causal Explanations for Model Interpretation under Uncertainty

arXiv · PDF · Open in the Atlas

Code that ran

3 of 3 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 3 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/1910.12336.json · badge: /api/ran/1910.12336.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
d909b/cxplain canonical (classifier label)
classifier basis: census
3 ran · 0 no recorded run
FunctionStatusWhere it lives
get_delta_errors Ran
ran on a synthesized input
d909b/cxplain/cxplain/backend/causal_loss.py
code served (permissive licence) · get_code("5ca060ab3383cf95")
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 Tensor, ndim 2, dtype family float, 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 torch
import torch.nn as nn
import torch.nn.functional as F
import numpy as np

torch.manual_seed(0)

# Create a minimal math_ops class that provides the required methods
class MathOps:
    def int_shape(self, tensor):
        """Return the shape of a tensor as a list"""
        return list(tensor.shape)
    
    def squeeze(self, tensor, axis=-1):
        """Squeeze a tensor along an axis"""
        return torch.squeeze(tensor, dim=axis)
    
    def maximum(self, a, b):
        """Element-wise maximum"""
        return torch.maximum(a, b)
    
    def epsilon(self):
        """Return a small epsilon value"""
        return torch.tensor(1e-7)
    
    def log(self, x):
        """Natural logarithm"""
        return torch.log(x)
    
    def stack(self, tensors, axis=-1):
        """Stack tensors along an axis"""
        return torch.stack(tensors, dim=axis)

# Create a simple loss function that returns per-sample losses
def custom_loss(y_true, y_pred):
    """MSE loss that returns per-sample losses (batch_size,)"""
    return torch.mean((y_true - y_pred) ** 2, dim=1)

# Create tensors
batch_size = 2
feature_dim = 4

y_true = torch.randn(batch_size, 1)

# error_with_all_features: shape (batch_size,) - one error per sample
error_with_all_features = torch.randn(batch_size)

# all_but_one_auxiliary_outputs: list of predictions, each shape (batch_size, 1)
# We'll create 3 alternative predictions (simulating dropping 3 features)
num_features = 3
all_but_one_auxiliary_outputs = [
    torch.randn(batch_size, 1) for _ in range(num_features)
]

# Create math_ops instance
math_ops = MathOps()

# Set parameters
log_transform = False
loss_function = custom_loss

ARGS = {
    "y_true": y_true,
    "all_but_one_auxiliary_outputs": all_but_one_auxiliary_outputs,
    "error_with_all_features": error_with_all_features,
    "loss_function": loss_function,
    "log_transform": log_transform,
    "math_ops": math_ops,
}
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 Tensor, ndim 2, dtype family float, 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
get_delta_errors_fixed_size Ran
ran on a synthesized input
d909b/cxplain/cxplain/backend/causal_loss.py
code served (permissive licence) · get_code("3fdbf877f602c3d4")
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 Tensor, ndim 2, dtype family float, shape (2, 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 torch
import torch.nn as nn

torch.manual_seed(0)

# Create a custom math_ops class that mimics TensorFlow-like operations
class MathOps:
    def int_shape(self, tensor):
        return list(tensor.shape)
    
    def squeeze(self, tensor, axis=-1):
        return torch.squeeze(tensor, dim=axis)
    
    def maximum(self, a, b):
        return torch.maximum(a, b)
    
    def epsilon(self):
        return torch.tensor(1e-7)
    
    def log(self, tensor):
        return torch.log(tensor)
    
    def stack(self, tensors, axis=-1):
        return torch.stack(tensors, dim=axis)

# Create a simple loss function
def custom_loss_function(y_true, y_pred):
    # Must return per-sample loss (batch_size,) not scalar
    return torch.mean((y_true - y_pred) ** 2, dim=-1)

# Create sample data
batch_size = 2
feature_dim = 4

y_true = torch.randn(batch_size, feature_dim)
error_with_all_features = torch.randn(batch_size)

# Create all_but_one_auxiliary_outputs - a list of outputs with one feature removed
# We'll create 4 outputs (one for each feature removed)
all_but_one_auxiliary_outputs = [
    torch.randn(batch_size, feature_dim) for _ in range(feature_dim)
]

loss_function = custom_loss_function
log_transform = True
math_ops = MathOps()

ARGS = {
    "y_true": y_true,
    "all_but_one_auxiliary_outputs": all_but_one_auxiliary_outputs,
    "error_with_all_features": error_with_all_features,
    "loss_function": loss_function,
    "log_transform": log_transform,
    "math_ops": math_ops,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Tensor, ndim 2, dtype family float, shape (2, 4) — shape (2, 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
safe_evaluate_custom_loss_function Ran
ran on a synthesized input
d909b/cxplain/cxplain/backend/causal_loss.py
code served (permissive licence) · get_code("c9df9aee94a0d8f1")
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 Tensor, 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 torch
import numpy as np

torch.manual_seed(0)

# Create a mock math_ops object that implements the required methods
class MockMathOps:
    def int_shape(self, tensor):
        """Return the shape of a tensor as a list."""
        if isinstance(tensor, torch.Tensor):
            return list(tensor.shape)
        return list(np.array(tensor).shape)
    
    def squeeze(self, tensor, axis=-1):
        """Squeeze a tensor along a specific axis."""
        return torch.squeeze(tensor, dim=axis)

# Create a simple custom loss function that returns per-sample losses
def custom_loss_function(y_true, y_pred):
    """
    Simple MSE loss that returns one value per sample.
    y_true: shape (batch_size, 1)
    y_pred: shape (batch_size, 1)
    returns: shape (batch_size, 1)
    """
    return (y_true - y_pred) ** 2

# Create test data
batch_size = 2
y_true = torch.randn(batch_size, 1)
y_pred = torch.randn(batch_size, 1)

# Create math_ops instance
math_ops = MockMathOps()

ARGS = {
    "loss_function": custom_loss_function,
    "y_true": y_true,
    "y_pred": y_pred,
    "math_ops": math_ops,
}
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 Tensor, 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

Also present in other papers' code

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

Feature importance estimates that inform users about the degree to which given inputs influence the output of a predictive model are crucial for understanding, validating, and interpreting machine-learning models. However, providing fast and accurate estimates of feature importance for high-dimensional data, and quantifying the uncertainty of such estimates remain open challenges. Here, we frame the task of providing explanations for the decisions of machine-learning models as a causal learning task, and train causal explanation (CXPlain) models that learn to estimate to what degree certain inputs cause outputs in another machine-learning model. CXPlain can, once trained, be used to explain the target model in little time, and enables the quantification of the uncertainty associated with its feature importance estimates via bootstrap ensembling. We present experiments that demonstrate that CXPlain is significantly more accurate and faster than existing model-agnostic methods for estimating feature importance. In addition, we confirm that the uncertainty estimates provided by CXPlain ensembles are strongly correlated with their ability to accurately estimate feature importance on held-out data.

For agents

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

get_harvested_code_for_paper("1910.12336")
get_code_for_paper("1910.12336")
have("1910.12336")

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

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

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

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

Connect an agent — have() is free.