SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 1610.02413 · 2016

Equality of Opportunity in Supervised Learning

Moritz Hardt, Nathan Srebro, Eric Price

arXiv · PDF · Open in the Atlas

Code that ran

9 of 11 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; 1 honoured the contract we drafted, 2 violated it and 1 has no contract verdict; 5 failures of our instrument; 2 no recorded run), measured 2026-11-22; 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/1610.02413.json · badge: /api/ran/1610.02413.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
scotthlee/fairness community
Papers with Code archive
6 ran · 2 no recorded run
lydiatliu/delayedimpact community
Papers with Code archive
2 ran · 0 no recorded run
gpleiss/equalized_odds_and_calibration community
Papers with Code archive
1 ran · 0 no recorded run
FunctionStatusWhere it lives
Model Ran
ran on a synthesized input
gpleiss/equalized_odds_and_calibration/eq_odds.py
code served (permissive licence) · get_code("b3f6ee5cae0ea128")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, class construct-then-call prompt, model not recorded) and returned ndarray, 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 cvxpy as cvx
import numpy as np
from collections import namedtuple

class Model(namedtuple('Model', 'pred label')):

    def logits(self):
        raw_logits = np.clip(np.log(self.pred / (1 - self.pred)), -100, 100)
        return raw_logits

    def num_samples(self):
        return len(self.pred)

    def base_rate(self):
        """
        Percentage of samples belonging to the positive class
        """
        return np.mean(self.label)

    def accuracy(self):
        return self.accuracies().mean()

    def precision(self):
        return self.label[self.pred.round() == 1].mean()

    def recall(self):
        return self.label[self.label == 1].round().mean()

    def tpr(self):
        """
        True positive rate
        """
        return np.mean(np.logical_and(self.pred.round() == 1, self.label == 1))

    def fpr(self):
        """
        False positive rate
        """
        return np.mean(np.logical_and(self.pred.round() == 1, self.label == 0))

    def tnr(self):
        """
        True negative rate
        """
        return np.mean(np.logical_and(self.pred.round() == 0, self.label == 0))

    def fnr(self):
        """
        False negative rate
        """
        return np.mean(np.logical_and(self.pred.round() == 0, self.label == 1))

    def fn_cost(self):
        """
        Generalized false negative cost
        """
        return 1 - self.pred[self.label == 1].mean()

    def fp_cost(self):
        """
        Generalized false positive cost
        """
        return self.pred[self.label == 0].mean()

    def accuracies(self):
        return self.pred.round() == self.label

    def eq_odds_optimal_mix_rates(self, othr):
        sbr = float(self.base_rate())
        obr = float(othr.base_rate())
        sp2p = cvx.Variable(1)
        sp2n = cvx.Variable(1)
        sn2p = cvx.Variable(1)
        sn2n = cvx.Variable(1)
        op2p = cvx.Variable(1)
        op2n = cvx.Variable(1)
        on2p = cvx.Variable(1)
        on2n = cvx.Variable(1)
        sfpr = self.fpr() * sp2p + self.tnr() * sn2p
        sfnr = self.fnr() * sn2n + self.tpr() * sp2n
        ofpr = othr.fpr() * op2p + othr.tnr() * on2p
        ofnr = othr.fnr() * on2n + othr.tpr() * op2n
        error = sfpr + sfnr + ofpr + ofnr
        constraints = [
            sp2p + sp2n == 1, sn2p + sn2n == 1,
            op2p + op2n == 1, on2p + on2n == 1,
            sp2p >= 0, sp2n >= 0, sn2p >= 0, sn2n >= 0,
            op2p >= 0, op2n >= 0, on2p >= 0, on2n >= 0,
        ]
        problem = cvx.Problem(cvx.Minimize(error), constraints)
        problem.solve()
        return np.array([sp2p.value[0], sn2p.value[0], op2p.value[0], on2p.value[0]])


INIT_ARGS = {
    'pred': np.array([0.1, 0.9, 0.3, 0.7]),
    'label': np.array([0, 1, 0, 1])
}

ARGS = {
    'othr': Model(
        pred=np.array([0.2, 0.8, 0.4, 0.6]),
        label=np.array([0, 1, 0, 1])
    )
}

METHOD = 'eq_odds_optimal_mix_rates'

if __name__ == '__main__':
    model = Model(**INIT_ARGS)
    result = getattr(model, METHOD)(**ARGS)
    print("Result:", result)
    print("Model accuracy:", model.accuracy())
    print("Model base_rate:", model.base_rate())
Setup block drafted by
a language model, class construct-then-call prompt, model not recorded
Imports
cvxpy, 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 — no output shape is stated: observe_signature.py observed this class with its constructor sizes canonicalised where it could, which the node does not record, so its shape is not stated as this setup block's
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: torch and numpy seeded to 0 by the harness immediately before the class was constructed from INIT_ARGS (fixture_check.py)
a_max Ran
ran; our contract draft was wrong, not the code
lydiatliu/delayedimpact/solve_credit.py
code served (permissive licence) · get_code("690e476f9b6f53a3")
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 numpy as np

torch.manual_seed(0)

# The function a_max takes:
# - f: a callable that takes an element and returns a comparable value
# - lst: a list of elements to search through

# Define a simple function that computes some scalar value
def scoring_function(x):
    """Example scoring function that returns a scalar"""
    if isinstance(x, torch.Tensor):
        return x.sum().item()
    elif isinstance(x, (int, float)):
        return float(x)
    else:
        return 0.0

# Create a list of different types of elements to compare
# Using small tensors as the elements
tensor_list = [
    torch.randn(2, 4),
    torch.randn(2, 4),
    torch.randn(2, 4),
]

ARGS = {
    "f": scoring_function,
    "lst": tensor_list,
}
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, 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
from_top Ran
ran, violated the contract we drafted
scotthlee/fairness/balancers.py
code served (permissive licence) · get_code("3cd87c311caf010b")
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) 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 numpy as np

# The function from_top takes:
# - roc_point: a sequence/array with at least 2 elements (indexed as [0] and [1])
# - round: an integer parameter (default 4)

# Construct a valid roc_point as a numpy array or list
roc_point = np.array([0.5, 0.3])

ARGS = {
    "roc_point": roc_point,
    "round": 4
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
Imports
numpy — 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
group_roc_coords Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
scotthlee/fairness/balancers.py
code served (permissive licence) · get_code("9125aa73770b76bb")
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) 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

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

# Create small sample data for the function
# y: true binary labels
y = np.array([0, 1, 0, 1, 0, 1, 1, 0])

# y_: predicted binary labels
y_ = np.array([0, 1, 0, 0, 0, 1, 1, 1])

# a: group assignments (categorical variable)
a = np.array([1, 1, 2, 2, 1, 2, 1, 2])

ARGS = {
    'y': y,
    'y_': y_,
    'a': a,
    'round': 4
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
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 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
loss_from_roc Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
scotthlee/fairness/balancers.py
code served (permissive licence) · get_code("6cae82fd6dc77f96")
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 dict. 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
from sklearn.metrics import accuracy_score, confusion_matrix

# Construct valid arguments for loss_from_roc function

# y: ground truth labels (binary classification, small batch)
y = np.array([0, 1, 1, 0, 1])

# probs: predicted probabilities (same length as y)
probs = np.array([0.1, 0.8, 0.9, 0.2, 0.7])

# roc: a tuple of (fpr_array, tpr_array, thresholds_array)
# These represent ROC curve data
roc = (
    np.array([0.0, 0.2, 0.5, 1.0]),      # false positive rates
    np.array([0.0, 0.6, 0.8, 1.0]),      # true positive rates
    np.array([1.0, 0.7, 0.5, 0.0])       # thresholds for classification
)

ARGS = {
    'y': y,
    'probs': probs,
    'roc': roc
}
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 dict — a dict output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a dict output the recorded ndim 0 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
pred_from_pya Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
scotthlee/fairness/balancers.py
code served (permissive licence) · get_code("f8eabab481e38552")
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 int, shape (8,) 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 copy import deepcopy

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

# Create small test data
# y_: binary labels (0 or 1)
y_ = np.array([0, 1, 0, 1, 0, 1, 0, 1], dtype=np.uint8)

# a: group assignments
a = np.array([0, 0, 0, 0, 1, 1, 1, 1], dtype=np.int32)

# pya: probability matrix [p0_group, p1_group] for each group
# Shape should be (num_groups, 2)
# p[0] = fraction of negatives to keep, p[1] = fraction of positives to keep
pya = np.array([
    [0.5, 0.8],  # for group 0: keep 50% of negatives, 80% of positives
    [0.6, 0.7]   # for group 1: keep 60% of negatives, 70% of positives
], dtype=np.float32)

# binom parameter (boolean flag)
binom_flag = False

ARGS = {
    "y_": y_,
    "a": a,
    "pya": pya,
    "binom": binom_flag
}
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 int, shape (8,) — shape (8,) 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
roc_coords Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
scotthlee/fairness/balancers.py
code served (permissive licence) · get_code("9dfb7f154d5a44ed")
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) and returned tuple, 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 sklearn.metrics import confusion_matrix

def roc_coords(y, y_, round=4):
    tab = confusion_matrix(y, y_)
    tn = tab[0, 0]
    fn = tab[1, 0]
    fp = tab[0, 1]
    tp = tab[1, 1]
    tpr = np.round(tp / (tp + fn), round)
    fpr = np.round(fp / (fp + tn), round)
    return (fpr, tpr)

# Create valid arguments for roc_coords
# y and y_ should be binary classification labels (0 or 1)
# They need to have enough samples to create a valid confusion matrix

y = np.array([0, 0, 1, 1, 0, 1, 1, 0])
y_ = np.array([0, 1, 1, 1, 0, 0, 1, 0])

ARGS = {
    "y": y,
    "y_": y_,
    "round": 4
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
Imports
numpy, sklearn — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type tuple, ndim 1, dtype family float — a tuple 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
ternary_maximize Ran
ran, honoured the contract we drafted
lydiatliu/delayedimpact/solve_credit.py
code served (permissive licence) · get_code("38549d21e69db555")
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)

# The function ternary_maximize takes a function f and performs ternary search
# The function f is called with float values (m_1, m_2, etc.)
# We need to provide:
# 1. f: a callable that takes a float and returns a float
# 2. left: float (default 1e-05)
# 3. right: float (default 1 - 1e-05)
# 4. tol: float (default 1e-05)

# Create a simple objective function to maximize
# Let's use a quadratic function with maximum around 0.5
def objective_function(x):
    """Simple quadratic function with maximum at x=0.5"""
    return -(x - 0.5) ** 2 + 1.0

# Define the arguments
ARGS = {
    'f': objective_function,
    'left': 1e-05,
    'right': 1 - 1e-05,
    'tol': 1e-05
}
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
threshold Ran
ran, violated the contract we drafted
scotthlee/fairness/balancers.py
code served (permissive licence) · get_code("6ca100f1e9d61248")
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 int, shape (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

# Create valid arguments for the threshold function
probs = np.array([0.2, 0.5, 0.7, 0.9])
cutoff = 0.5

ARGS = {
    "probs": probs,
    "cutoff": cutoff
}
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 int, shape (4,) — shape (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
BinaryBalancer Not yet run
unverified (harvested, no recorded run)
scotthlee/fairness/balancers.py
code served (permissive licence) · get_code("49c53740a95ae70a")
How it ran

no invocation recorded.

CLFRates Not yet run
unverified (harvested, no recorded run)
scotthlee/fairness/balancers.py
code served (permissive licence) · get_code("122378dfd8b3fe4b")
How it ran

no invocation recorded.

Also present in other papers' code

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

Repositories linked to this paper

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

Abstract

We propose a criterion for discrimination against a specified sensitive attribute in supervised learning, where the goal is to predict some target based on available features. Assuming data about the predictor, target, and membership in the protected group are available, we show how to optimally adjust any learned predictor so as to remove discrimination according to our definition. Our framework also improves incentives by shifting the cost of poor classification from disadvantaged groups to the decision maker, who can respond by improving the classification accuracy. In line with other studies, our notion is oblivious: it depends only on the joint statistics of the predictor, the target and the protected attribute, but not on interpretation of individual features. We study the inherent limits of defining and identifying biases based on such oblivious measures, outlining what can and cannot be inferred from different oblivious tests. We illustrate our notion using a case study of FICO credit scores.

For agents

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

get_harvested_code_for_paper("1610.02413")
get_code_for_paper("1610.02413")
have("1610.02413")

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

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

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

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

Connect an agent — have() is free.