SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 1803.02453 · 2018

A Reductions Approach to Fair Classification

arXiv · PDF · Open in the Atlas

Code that ran

7 of 8 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; 1 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/1803.02453.json · badge: /api/ran/1803.02453.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
xmpuspus/parity-fairness community (classifier label)
classifier basis not recorded on the link
7 ran · 1 no recorded run
FunctionStatusWhere it lives
create_feature_columns Ran
ran on a synthesized input
xmpuspus/parity-fairness/parity/pair.py
code served (permissive licence) · get_code("de97511497ab797c")
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. 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 tensorflow as tf
import pandas as pd
import numpy as np

# Create a small dataframe with mixed data types
data = {
    'numeric_int': [1, 2, 3, 4],
    'numeric_float': [1.5, 2.5, 3.5, 4.5],
    'categorical': ['a', 'b', 'a', 'c']
}
df = pd.DataFrame(data)

# Create feature_spec with tensorflow feature specifications
feature_spec = {
    'numeric_int': type('FeatureSpec', (), {'dtype': tf.int64})(),
    'numeric_float': type('FeatureSpec', (), {'dtype': tf.float32})(),
    'categorical': type('FeatureSpec', (), {'dtype': tf.string})()
}

columns = ['numeric_int', 'numeric_float', 'categorical']

ARGS = {
    'df': df,
    'columns': columns,
    'feature_spec': feature_spec
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, pandas, tensorflow — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type list — a list 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
create_feature_spec Ran
ran on a synthesized input
xmpuspus/parity-fairness/parity/pair.py
code served (permissive licence) · get_code("156e8c036d1606cd")
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
import pandas as pd
import tensorflow as tf

# Create a small DataFrame with mixed dtypes
df = pd.DataFrame({
    'int_col': np.array([1, 2, 3], dtype=np.int64),
    'float_col': np.array([1.5, 2.5, 3.5], dtype=np.float64),
    'str_col': ['a', 'b', 'c']
})

# Define ARGS with all parameters
ARGS = {
    'df': df,
    'columns': None
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, pandas, tensorflow — 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
decode_dataset Ran
ran on a synthesized input
xmpuspus/parity-fairness/parity/fair.py
code served (permissive licence) · get_code("19bf08db6200e0b9")
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
from sklearn.preprocessing import StandardScaler, LabelEncoder

# Create mock encoders for numerical and categorical features
numerical_encoder = StandardScaler()
# Fit the encoder with some sample data
numerical_encoder.fit(np.array([[1.0], [2.0], [3.0]]))

categorical_encoder = LabelEncoder()
# Fit the encoder with some sample data
categorical_encoder.fit(np.array([0, 1, 2]))

# Create a sample dataframe with numerical and categorical features
df = pd.DataFrame({
    'num_feat_1': np.array([[1.5], [2.5]]).flatten(),
    'num_feat_2': np.array([[3.5], [4.5]]).flatten(),
    'cat_feat_1': np.array([0, 1]),
    'cat_feat_2': np.array([1, 2])
})

# Create encoders dictionary
encoders = {
    'num_feat_1': numerical_encoder,
    'num_feat_2': StandardScaler().fit(np.array([[1.0], [2.0], [3.0]])),
    'cat_feat_1': categorical_encoder,
    'cat_feat_2': LabelEncoder().fit(np.array([0, 1, 2]))
}

numerical_features = ['num_feat_1', 'num_feat_2']
categorical_features = ['cat_feat_1', 'cat_feat_2']

ARGS = {
    'df': df,
    'encoders': encoders,
    'numerical_features': numerical_features,
    'categorical_features': categorical_features
}
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 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
feature_importances Ran
ran on a synthesized input
xmpuspus/parity-fairness/parity/explainer.py
code served (permissive licence) · get_code("d533a63c85cc17ee")
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 pandas as pd
import numpy as np

# Create a minimal sklearn-like model with feature_importances_ attribute
class MockModel:
    def __init__(self):
        self.feature_importances_ = np.array([0.35, 0.25, 0.20, 0.15, 0.05])

# Create sample data with matching number of features
X = pd.DataFrame({
    'feature_1': [1.0, 2.0, 3.0],
    'feature_2': [4.0, 5.0, 6.0],
    'feature_3': [7.0, 8.0, 9.0],
    'feature_4': [10.0, 11.0, 12.0],
    'feature_5': [13.0, 14.0, 15.0]
})

model = MockModel()

ARGS = {
    'model': model,
    'X': X
}
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 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_counterfactual Ran
ran on a synthesized input
xmpuspus/parity-fairness/parity/counterfactual_explainer.py
code served (permissive licence) · get_code("905d54adb21c4343")
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 torch
import torch.nn as nn
import pandas as pd
from unittest.mock import Mock, MagicMock

torch.manual_seed(0)

# Create a mock DiCE class with the required methods
class MockDiCEExplanation:
    def __init__(self):
        self.data = {
            'feature_1': [1.5, 2.5, 3.5],
            'feature_2': [0.8, 1.2, 1.6],
            'feature_3': [10, 20, 30],
            'prediction': ['desired', 'desired', 'desired']
        }
    
    def visualize_as_dataframe(self):
        return pd.DataFrame(self.data)

class MockDiCEObject:
    def generate_counterfactuals(self, query_instance, total_CFs, desired_class, diversity_weight):
        # Return a mock explanation object
        return MockDiCEExplanation()

# Construct the ARGS dictionary
ARGS = {
    'ready_object': MockDiCEObject(),
    'query_instance': {
        'feature_1': 1.0,
        'feature_2': 0.5,
        'feature_3': 5
    },
    'number_CF': 3,
    'desired_pred': 'desired',
    'feature_weights': {
        'feature_1': 0.5,
        'feature_2': 0.3,
        'feature_3': 0.2
    },
    'proximity_weight': 0.7,
    'diversity_weight': 0.5,
    'feature_to_vary': ['feature_1', 'feature_2']
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
pandas, torch — 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
get_attributes Ran
ran on a synthesized input
xmpuspus/parity-fairness/parity/fair.py
code served (permissive licence) · get_code("5be8d3cc8a44d071")
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, ndim 2, dtype family float; no output shape is stated. It ran in syntology-harvest-sandbox:v5-deps (sha256:6a292aa1aed1) at 2026-09-26T21:52:49Z. 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

class StandardDataset:
    """Stand-in for aif360.datasets.standard_dataset.StandardDataset"""
    def __init__(self):
        self.protected_attribute_names = ['gender', 'race']
        self.privileged_protected_attributes = [1, 0]
        self.unprivileged_protected_attributes = [0, 1]

data = StandardDataset()

ARGS = {
    'data': data,
    'selected_attr': None
}
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 tuple, ndim 2, 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 syntology-harvest-sandbox:v5-deps (sha256:6a292aa1aed1); 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_model_performance Ran
ran on a synthesized input
xmpuspus/parity-fairness/parity/fairness_metrics.py
code served (permissive licence) · get_code("b7e042a66ba85f91")
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
from sklearn.metrics import confusion_matrix, accuracy_score, f1_score, roc_curve, auc

np.random.seed(0)

# Create small test data
n_samples = 10
n_features = 4

# X_test: feature matrix (10 samples, 4 features)
X_test = np.random.randn(n_samples, n_features)

# y_true: true binary labels (10 samples)
y_true = np.array([0, 1, 0, 1, 0, 1, 0, 1, 0, 1])

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

# probs: probability predictions for both classes (10 samples, 2 classes)
# Column 0 is prob of class 0, column 1 is prob of class 1
probs = np.random.rand(n_samples, 2)
probs = probs / probs.sum(axis=1, keepdims=True)  # normalize to sum to 1

ARGS = {
    "X_test": X_test,
    "y_true": y_true,
    "y_pred": y_pred,
    "probs": probs,
}
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 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
add_to_df_algo_metrics Not yet run
unverified (harvested, no recorded run)
xmpuspus/parity-fairness/parity/fairness_metrics.py
code served (permissive licence) · get_code("ed97275e6d1daf54")
How it ran

no invocation recorded.

Also present in other papers' code

Of 8 samples lifted from this paper's linked repositories, 8 carry a function identity and 0 do not. Of the 8 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 8 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 present a systematic approach for achieving fairness in a binary classification setting. While we focus on two well-known quantitative definitions of fairness, our approach encompasses many other previously studied definitions as special cases. The key idea is to reduce fair classification to a sequence of cost-sensitive classification problems, whose solutions yield a randomized classifier with the lowest (empirical) error subject to the desired constraints. We introduce two reductions that work for any representation of the cost-sensitive classifier and compare favorably to prior baselines on a variety of data sets, while overcoming several of their disadvantages.

For agents

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

get_harvested_code_for_paper("1803.02453")
get_code_for_paper("1803.02453")
have("1803.02453")

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

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

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

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

Connect an agent — have() is free.