SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2105.12195 · 2021

Bias in Machine Learning Software: Why? How? What to do?

arXiv · PDF · Open in the Atlas

Code that ran

10 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; 5 honoured the contract we drafted, 0 violated it and 0 have no contract verdict; 5 failures of our instrument; 1 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/2105.12195.json · badge: /api/ran/2105.12195.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
joymallyac/Fair-SMOTE canonical (classifier label)
classifier basis: classifier_2025
4 ran · 1 no recorded run
anonymous12138/biasmitigation reimplementation (classifier label)
classifier basis: classifier_2025
6 ran · 0 no recorded run
FunctionStatusWhere it lives
calculate_Disparate_Impact Ran
ran, honoured the contract we drafted
anonymous12138/biasmitigation/Measure.py
code served (permissive licence) · get_code("e69404826f3a9814")
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 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 takes 8 integer/float parameters representing confusion matrix values
# for two groups (male and female). These are used in simple arithmetic operations.
# We'll create realistic confusion matrix values.

TP_male = 45
TN_male = 30
FN_male = 10
FP_male = 15

TP_female = 50
TN_female = 25
FN_female = 12
FP_female = 13

ARGS = {
    "TP_male": TP_male,
    "TN_male": TN_male,
    "FN_male": FN_male,
    "FP_male": FP_male,
    "TP_female": TP_female,
    "TN_female": TN_female,
    "FN_female": FN_female,
    "FP_female": FP_female,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
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
calculate_Disparate_Impact Ran
ran, honoured the contract we drafted
joymallyac/Fair-SMOTE/Measure.py
code served (permissive licence) · get_code("ee14e6181f99a49f")
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 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 takes 8 integer/float parameters representing confusion matrix values
# for two groups (male and female). Each group has: TP, TN, FN, FP

# Create realistic confusion matrix values for male group
TP_male = 45
TN_male = 30
FN_male = 10
FP_male = 15

# Create realistic confusion matrix values for female group
TP_female = 40
TN_female = 35
FN_female = 12
FP_female = 13

ARGS = {
    "TP_male": TP_male,
    "TN_male": TN_male,
    "FN_male": FN_male,
    "FP_male": FP_male,
    "TP_female": TP_female,
    "TN_female": TN_female,
    "FN_female": FN_female,
    "FP_female": FP_female,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
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
calculate_average_odds_difference Ran
ran, honoured the contract we drafted
anonymous12138/biasmitigation/Measure.py
code served (permissive licence) · get_code("75802a7987de5c29")
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 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)

# These are confusion matrix counts for male and female groups
# Using small integer values that represent classification results
TP_male = 45
TN_male = 30
FN_male = 15
FP_male = 10

TP_female = 50
TN_female = 28
FN_female = 12
FP_female = 8

ARGS = {
    "TP_male": TP_male,
    "TN_male": TN_male,
    "FN_male": FN_male,
    "FP_male": FP_male,
    "TP_female": TP_female,
    "TN_female": TN_female,
    "FN_female": FN_female,
    "FP_female": FP_female,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
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
calculate_average_odds_difference Ran
ran, honoured the contract we drafted
joymallyac/Fair-SMOTE/Measure.py
code served (permissive licence) · get_code("e15b568227d6c7af")
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 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.

# Setup code for calculate_average_odds_difference function

# Define arguments for the function
# These represent confusion matrix values for male and female groups
TP_male = 45
TN_male = 30
FN_male = 15
FP_male = 10

TP_female = 50
TN_female = 25
FN_female = 10
FP_female = 15

ARGS = {
    "TP_male": TP_male,
    "TN_male": TN_male,
    "FN_male": FN_male,
    "FP_male": FP_male,
    "TP_female": TP_female,
    "TN_female": TN_female,
    "FN_female": FN_female,
    "FP_female": FP_female,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
Imports
none outside the standard library — 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
calculate_flip Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
anonymous12138/biasmitigation/Baseline/FairSMOTE.py
code served (permissive licence) · get_code("b453a82cad0f3255")
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, 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 numpy as np
from sklearn.ensemble import RandomForestClassifier

# Create a simple classifier that has a predict method
clf = RandomForestClassifier(n_estimators=2, random_state=42)

# Create training data to fit the classifier
X_train = np.array([
    [0, 1, 0, 1],
    [1, 0, 1, 0],
    [0, 1, 1, 0],
    [1, 0, 0, 1]
])
y_train = np.array([0, 1, 0, 1])
clf.fit(X_train, y_train)

# Create test data with binary values (0 or 1)
X_test = np.array([
    [0, 1, 0, 1],
    [1, 0, 1, 0]
])

# The keyword parameter should be a column name/index that exists in X_test
# Since X_test is a numpy array, we need to use integer indexing
# But the function uses X_flip[keyword], so keyword should work as an index
# For numpy arrays, we can use integer column indices
keyword = 0

ARGS = {
    'clf': clf,
    'X_test': X_test,
    'keyword': keyword
}
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 float64, 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
flip Ran
ran, honoured the contract we drafted
anonymous12138/biasmitigation/Baseline/FairSMOTE.py
code served (permissive licence) · get_code("b8275eca81364591")
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

# Create a small test dataframe with a binary column
X_test = pd.DataFrame({
    'feature_1': [1, 0, 1, 0],
    'feature_2': [0, 1, 1, 0],
    'feature_3': [1, 1, 0, 1]
})

# Define ARGS with the required parameters
ARGS = {
    'X_test': X_test,
    'keyword': 'feature_1'
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
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 int 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_counts Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
anonymous12138/biasmitigation/Measure.py
code served (permissive licence) · get_code("096471a0530ac365")
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, 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 numpy as np
import pandas as pd
from sklearn.metrics import confusion_matrix

# Create minimal test data
np.random.seed(0)

# Small sample sizes
n_train = 10
n_test = 8

# Create training data
x_train = np.random.randn(n_train, 4)
y_train = np.random.randint(0, 2, n_train)

# Create test data
x_test = np.random.randn(n_test, 4)
y_test = np.random.randint(0, 2, n_test)

# Create test dataframe with required columns
test_df = pd.DataFrame({
    'Probability': np.random.randint(0, 2, n_test),
    'gender': np.random.randint(0, 2, n_test),  # biased column
})

# Create predictions
y_pred = np.random.randint(0, 2, n_test)

# Create confusion matrix from y_test and y_pred
cm = confusion_matrix(y_test, y_pred, labels=[0, 1])

# Ensure cm is 2x2
if cm.shape != (2, 2):
    cm = np.array([[5, 1], [1, 1]])

ARGS = {
    'y_pred': y_pred,
    'cm': cm,
    'x_train': x_train,
    'y_train': y_train,
    'x_test': x_test,
    'y_test': y_test,
    'test_df': test_df,
    'biased_col': 'gender',
    'metric': 'aod'
}
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 float64, 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
get_counts Ran
ran; our contract draft was wrong, not the code
joymallyac/Fair-SMOTE/Measure.py
code served (permissive licence) · get_code("97ef180ed3177f3f")
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, 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 numpy as np
import pandas as pd
from sklearn.linear_model import LogisticRegression

# Create a simple classifier
clf = LogisticRegression(random_state=42)

# Create synthetic training data
np.random.seed(42)
n_train = 20
n_test = 10
n_features = 4

x_train = np.random.randn(n_train, n_features)
y_train = np.random.randint(0, 2, n_train)

x_test = np.random.randn(n_test, n_features)
y_test = np.random.randint(0, 2, n_test)

# Create test dataframe with required columns
test_df = pd.DataFrame({
    'Probability': np.random.randint(0, 2, n_test),
    'gender': np.random.randint(0, 2, n_test),  # biased_col will be 'gender'
})

biased_col = 'gender'
metric = 'aod'

ARGS = {
    'clf': clf,
    'x_train': x_train,
    'y_train': y_train,
    'x_test': x_test,
    'y_test': y_test,
    'test_df': test_df,
    'biased_col': biased_col,
    'metric': metric
}
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 float64, 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
get_ngbr Ran
ran; our contract draft was wrong, not the code
joymallyac/Fair-SMOTE/Generate_Samples.py
code served (permissive licence) · get_code("814857a19ce23980")
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 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 random
import pandas as pd
import numpy as np
from sklearn.neighbors import NearestNeighbors

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

# Create a small DataFrame with 5 rows and 4 columns
data = np.array([
    [1.0, 2.0, 3.0, 4.0],
    [1.1, 2.1, 3.1, 4.1],
    [1.2, 2.2, 3.2, 4.2],
    [5.0, 6.0, 7.0, 8.0],
    [5.1, 6.1, 7.1, 8.1]
])
df = pd.DataFrame(data, columns=['a', 'b', 'c', 'd'])

# Create and fit a KNN model
knn = NearestNeighbors(n_neighbors=3)
knn.fit(df.values)

ARGS = {
    'df': df,
    'knn': knn
}
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 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 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
reg2clf Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
anonymous12138/biasmitigation/Baseline/FairSMOTE.py
code served (permissive licence) · get_code("db204bc45c8cd85a")
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 list, ndim 1, dtype family int; 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

torch.manual_seed(0)

# The function reg2clf takes:
# 1. protected_pred: an iterable of numeric values (compared with threshold)
# 2. threshold: a numeric value (default 0.5)

# Create a small list of regression predictions (floats)
protected_pred = [0.2, 0.7, 0.4, 0.9, 0.5]

# Define threshold
threshold = 0.5

ARGS = {
    "protected_pred": protected_pred,
    "threshold": threshold,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
Imports
numpy, torch — 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 int — 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
generate_samples Not yet run
unverified (harvested, no recorded run)
joymallyac/Fair-SMOTE/Generate_Samples.py
code served (permissive licence) · get_code("c7d03937e3c8925b")
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 10 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 10 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

Increasingly, software is making autonomous decisions in case of criminal sentencing, approving credit cards, hiring employees, and so on. Some of these decisions show bias and adversely affect certain social groups (e.g. those defined by sex, race, age, marital status). Many prior works on bias mitigation take the following form: change the data or learners in multiple ways, then see if any of that improves fairness. Perhaps a better approach is to postulate root causes of bias and then applying some resolution strategy. This paper postulates that the root causes of bias are the prior decisions that affect- (a) what data was selected and (b) the labels assigned to those examples. Our Fair-SMOTE algorithm removes biased labels; and rebalances internal distributions such that based on sensitive attribute, examples are equal in both positive and negative classes. On testing, it was seen that this method was just as effective at reducing bias as prior approaches. Further, models generated via Fair-SMOTE achieve higher performance (measured in terms of recall and F1) than other state-of-the-art fairness improvement algorithms. To the best of our knowledge, measured in terms of number of analyzed learners and datasets, this study is one of the largest studies on bias mitigation yet presented in the literature.

For agents

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

get_harvested_code_for_paper("2105.12195")
get_code_for_paper("2105.12195")
have("2105.12195")

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

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

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

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

Connect an agent — have() is free.