SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2206.05050 · 2022

Improved Approximation for Fair Correlation Clustering

arXiv · PDF · Open in the Atlas

Code that ran

11 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; 0 honoured the contract we drafted, 0 violated it and 11 have no contract verdict; 0 failures of our instrument; 0 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/2206.05050.json · badge: /api/ran/2206.05050.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
moonin12/improved_fair_correlation_clustering canonical (classifier label)
classifier basis not recorded on the link
11 ran · 0 no recorded run
FunctionStatusWhere it lives
clean_data Ran
ran on a synthesized input
moonin12/improved_fair_correlation_clustering/utils/old_read_write_utils.py
code served (permissive licence) · get_code("37e838e6c3aa3fed")
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 sample dataframe with numeric and text features
np.random.seed(0)
df = pd.DataFrame({
    'numeric_1': np.random.randn(5),
    'numeric_2': np.random.randn(5) * 10,
    'text_1': ['cat', 'dog', 'cat', 'bird', 'dog'],
    'text_2': ['red', 'blue', 'red', 'green', 'blue']
})

numeric_features = ['numeric_1', 'numeric_2']
text_features = ['text_1', 'text_2']

ARGS = {
    'df': df,
    'numeric_features': numeric_features,
    'text_features': text_features
}
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
create_graph_form_vectors Ran
ran on a synthesized input
moonin12/improved_fair_correlation_clustering/utils/read_write_utils.py
code served (permissive licence) · get_code("992b382711ab07fd")
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 logging
import random
import numpy as np
import pandas as pd

logging.basicConfig(level=logging.DEBUG)

# Create a small dataframe with the required columns
df = pd.DataFrame({
    'color_col_1': [1, 2, 1, 2, 1],
    'color_col_2': [1, 1, 2, 2, 1],
    'vector_col_1': [1.0, 2.0, 3.0, 4.0, 5.0],
    'vector_col_2': [0.5, 1.5, 2.5, 3.5, 4.5],
    'vector_col_3': [0.1, 0.2, 0.3, 0.4, 0.5],
})

ARGS = {
    'df': df,
    'theta': 0.5,
    'max_nr_color': 2,
    'min_nr_color': 1,
    'color_columns': ['color_col_1', 'color_col_2'],
    'vector_columns': ['vector_col_1', 'vector_col_2', 'vector_col_3'],
    'sample_per_color': None,
}
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 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
get_cluster_inds_from_clusters Ran
ran on a synthesized input
moonin12/improved_fair_correlation_clustering/utils/clustering_utils.py
code served (permissive licence) · get_code("19c529a03d910b6b")
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 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

torch.manual_seed(0)

# The function takes:
# 1. clusters: a list of lists/iterables, where each inner list contains node indices
# 2. nr_nodes: an integer representing the total number of nodes

# Construct valid arguments
clusters = [
    [0, 1],      # cluster 0 contains nodes 0 and 1
    [2, 3, 4],   # cluster 1 contains nodes 2, 3, and 4
    [5]          # cluster 2 contains node 5
]

nr_nodes = 6

ARGS = {
    "clusters": clusters,
    "nr_nodes": nr_nodes
}
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 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
get_constraints Ran
ran on a synthesized input
moonin12/improved_fair_correlation_clustering/fair_corr_lp_solver.py
code served (permissive licence) · get_code("d6c772a336f6d06a")
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 logging

logging.basicConfig(level=logging.DEBUG)

# Construct the graph dict with required keys
graph = {
    'nr_nodes': 4,
    'nodes_by_color': {
        0: [0, 1],
        1: [2],
        2: [3]
    },
    'color_dist': {
        0: 2,
        1: 1,
        2: 1
    },
    'min_nr_color': 0,
    'max_nr_color': 2
}

# Construct alphas dict mapping color indices to alpha values
alphas = {
    0: 0.5,
    1: 0.3,
    2: 0.2
}

ARGS = {
    'graph': graph,
    'alphas': alphas
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
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 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
get_corr_clustering_error Ran
ran on a synthesized input
moonin12/improved_fair_correlation_clustering/utils/clustering_utils.py
code served (permissive licence) · get_code("eba6dc095e1032ab")
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)

# Construct a valid graph dict with positive edges
# The graph needs:
# - 'nr_nodes': int
# - 'positive_edges': list of [u, v] pairs

graph = {
    'nr_nodes': 5,
    'positive_edges': [
        [0, 1],
        [1, 2],
        [3, 4],
        [0, 2]
    ]
}

# Construct clusters - a list of lists where each inner list contains node indices
# These clusters partition the nodes
clusters = [
    [0, 1, 2],  # cluster 0: nodes 0, 1, 2
    [3, 4]      # cluster 1: nodes 3, 4
]

ARGS = {
    'clusters': clusters,
    'graph': graph
}
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
get_corr_clustering_fairness_viol Ran
ran on a synthesized input
moonin12/improved_fair_correlation_clustering/utils/clustering_utils.py
code served (permissive licence) · get_code("d86464f4962ad6f5")
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 logging

logging.basicConfig(level=logging.DEBUG)

ARGS = {
    "nr_nodes": 10,
    "nondegen_clusters": [
        [0, 1, 2],
        [3, 4],
        [5, 6, 7, 8]
    ],
    "nondegen_color_dists": [
        {"0": 2, "1": 1},
        {"0": 1, "1": 1},
        {"0": 2, "1": 1, "2": 1}
    ],
    "alphas": {0: 0.5, 1: 0.3, 2: 0.2}
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
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
get_edge_name Ran
ran on a synthesized input
moonin12/improved_fair_correlation_clustering/fair_corr_lp_solver.py
code served (permissive licence) · get_code("233410e319cfffd4")
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 str. 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

torch.manual_seed(0)

ARGS = {
    'u': 1,
    'v': 3
}
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 str — a str output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a str 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
get_variables Ran
ran on a synthesized input
moonin12/improved_fair_correlation_clustering/fair_corr_lp_solver.py
code served (permissive licence) · get_code("c92255ff35176f3a")
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 logging

# Set up logging to see debug output
logging.basicConfig(level=logging.DEBUG)

# Create a minimal graph structure that satisfies the function's requirements
graph = {
    'nr_nodes': 4,
    'positive_edges': [
        (0, 1),
        (1, 2),
        (2, 3)
    ]
}

ARGS = {
    'graph': graph
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
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 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
int_list_to_str Ran
ran on a synthesized input
moonin12/improved_fair_correlation_clustering/utils/read_write_utils.py
code served (permissive licence) · get_code("5ca43db53fdaf602")
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 str. 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

ARGS = {
    'list': [1, 2, 3, 4, 5]
}
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 str — a str output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a str 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
read_csv_data Ran
ran on a synthesized input
moonin12/improved_fair_correlation_clustering/utils/read_write_utils.py
code served (permissive licence) · get_code("ec0f235a9e16f087")
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 tempfile
import os

# Create a temporary directory and CSV file for testing
temp_dir = tempfile.mkdtemp()
dataset_name = "test_data"
csv_file_path = os.path.join(temp_dir, dataset_name + ".csv")

# Create a sample CSV file with index and header
data = {
    "col1": [1, 2, 3],
    "col2": [4, 5, 6],
    "col3": [7, 8, 9]
}
df = pd.DataFrame(data)
df.index.name = "idx"
df.to_csv(csv_file_path)

ARGS = {
    "dataset_name": dataset_name,
    "input_dir": temp_dir + "/",
    "has_index": True,
    "has_header": True,
    "separator": ","
}
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 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
read_list Ran
ran on a synthesized input
moonin12/improved_fair_correlation_clustering/utils/configutil.py
code served (permissive licence) · get_code("838cefd5b43af5fa")
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 torch
import numpy as np

torch.manual_seed(0)

# Analyze the function:
# - config_string: a string that will be split by delimiter
# - delimiter: a string used to split config_string (default ',')
# The function replaces newlines, splits by delimiter, and strips whitespace from each element

ARGS = {
    'config_string': 'item1, item2,\nitem3, item4',
    'delimiter': ','
}
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 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 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

Correlation clustering is a ubiquitous paradigm in unsupervised machine learning where addressing unfairness is a major challenge. Motivated by this, we study Fair Correlation Clustering where the data points may belong to different protected groups and the goal is to ensure fair representation of all groups across clusters. Our paper significantly generalizes and improves on the quality guarantees of previous work of Ahmadi et al. and Ahmadian et al. as follows. - We allow the user to specify an arbitrary upper bound on the representation of each group in a cluster. - Our algorithm allows individuals to have multiple protected features and ensure fairness simultaneously across them all. - We prove guarantees for clustering quality and fairness in this general setting. Furthermore, this improves on the results for the special cases studied in previous work. Our experiments on real-world data demonstrate that our clustering quality compared to the optimal solution is much better than what our theoretical result suggests.

For agents

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

get_harvested_code_for_paper("2206.05050")
get_code_for_paper("2206.05050")
have("2206.05050")

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

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

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

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

Connect an agent — have() is free.