SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 1906.03543 · 2019

apricot: Submodular selection for data summarization in Python

arXiv · PDF · Open in the Atlas

Code that ran

7 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 7 have no contract verdict; 0 failures of our instrument; 4 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/1906.03543.json · badge: /api/ran/1906.03543.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
jmschrei/apricot canonical (classifier label)
classifier basis: census
7 ran · 4 no recorded run
FunctionStatusWhere it lives
calculate_gains Ran
ran on a synthesized input
jmschrei/apricot/apricot/functions/facilityLocation.py
code served (permissive licence) · get_code("e8c3f5494d76b892")
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 CPUDispatcher. 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
from numba import njit, prange

# Define the function to get its signature
dtypes = 'void(float64[:,:], float64[:], float64[:], int64[:])'

def calculate_gains(dtypes, parallel, fastmath, cache):
    @njit(dtypes, parallel=parallel, fastmath=fastmath, cache=cache)
    def calculate_gains_(X, gains, current_values, idxs):
        for i in prange(idxs.shape[0]):
            idx = idxs[i]
            gains[i] = numpy.maximum(X[idx], current_values).sum()
    return calculate_gains_

# Construct valid arguments
# X: 2D float64 array (5 rows, 3 columns)
X = numpy.array([[1.0, 2.0, 3.0],
                  [4.0, 5.0, 6.0],
                  [7.0, 8.0, 9.0],
                  [10.0, 11.0, 12.0],
                  [13.0, 14.0, 15.0]], dtype=numpy.float64)

# gains: 1D float64 array (2 elements to match idxs length)
gains = numpy.zeros(2, dtype=numpy.float64)

# current_values: 1D float64 array (3 elements to match X column count)
current_values = numpy.array([2.0, 3.0, 4.0], dtype=numpy.float64)

# idxs: 1D int64 array with valid indices into X (2 elements)
idxs = numpy.array([0, 2], dtype=numpy.int64)

ARGS = {
    'dtypes': dtypes,
    'parallel': True,
    'fastmath': False,
    'cache': False,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numba, numpy — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type CPUDispatcher — a CPUDispatcher output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a CPUDispatcher 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
calculate_gains Ran
ran on a synthesized input
jmschrei/apricot/apricot/functions/featureBased.py
code served (permissive licence) · get_code("183d6ae68255ac3d")
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 CPUDispatcher. 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 numba import njit

# Define a simple function that will be passed as 'func'
# It needs to accept an array and return something with a .sum() method
@njit
def simple_func(x):
    return x * 2.0

# Create small numpy arrays for testing
X = np.random.randn(5, 4).astype(np.float64)  # 5 samples, 4 features
gains = np.zeros(3, dtype=np.float64)  # 3 gains to compute
current_values = np.random.randn(4).astype(np.float64)  # 4 values
idxs = np.array([0, 2, 4], dtype=np.int64)  # indices into X

ARGS = {
    'func': simple_func,
    'dtypes': 'void(float64[:,:], float64[:], float64[:], int64[:])',
    'parallel': False,
    'fastmath': False,
    'cache': False,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numba, numpy — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type CPUDispatcher — a CPUDispatcher output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a CPUDispatcher 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
calculate_gains Ran
ran on a synthesized input
jmschrei/apricot/apricot/functions/maxCoverage.py
code served (permissive licence) · get_code("28c6af75cdbdf321")
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 CPUDispatcher. 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
from numba import njit, prange

dtypes = 'void(float64[:,:], float64[:], float64[:], float64, int64[:])'

def calculate_gains(dtypes, parallel, fastmath, cache):
    @njit(dtypes, parallel=parallel, fastmath=fastmath, cache=cache)
    def calculate_gains_(X, gains, current_values, threshold, idxs):
        for i in prange(idxs.shape[0]):
            idx = idxs[i]
            gains[i] = numpy.fmin(current_values + X[idx], threshold).sum()
    return calculate_gains_

# Setup arguments
X = numpy.array([[1.0, 2.0, 3.0, 4.0],
                  [5.0, 6.0, 7.0, 8.0],
                  [9.0, 10.0, 11.0, 12.0]], dtype=numpy.float64)

gains = numpy.zeros(2, dtype=numpy.float64)

current_values = numpy.array([1.0, 2.0, 3.0, 4.0], dtype=numpy.float64)

threshold = 15.0

idxs = numpy.array([0, 1], dtype=numpy.int64)

ARGS = {
    'dtypes': dtypes,
    'parallel': False,
    'fastmath': False,
    'cache': False
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numba, numpy — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type CPUDispatcher — a CPUDispatcher output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a CPUDispatcher 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
calculate_gains_sieve Ran
ran on a synthesized input
jmschrei/apricot/apricot/functions/graphCut.py
code served (permissive licence) · get_code("e5e7fb4d629f8658")
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 CPUDispatcher. 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 numpy as np
from numba import njit, prange

torch.manual_seed(0)

# Analyze the function signature and body
# calculate_gains_sieve takes: dtypes, parallel, fastmath, cache
# The returned function takes: X, k, current_values, selections, gains, total_gains, max_values, n_selected, row_sums, idxs

# X: 2D array (n, d) - accessed as X.shape
# k: integer - compared with n_selected[j]
# current_values: 2D array (t, n) - accessed as current_values[j, i]
# selections: 2D array (t, k) - written as selections[j, n_selected[j]]
# gains: 2D array (t, k) - written as gains[j, n_selected[j]]
# total_gains: 1D array (t,) - accessed and modified as total_gains[j]
# max_values: 1D array (t,) - accessed as max_values[j]
# n_selected: 1D array (t,) - accessed and modified as n_selected[j]
# row_sums: 1D array (n,) - accessed as row_sums[i]
# idxs: 1D array (n,) - accessed as idxs[i]

n = 5  # number of rows
d = 4  # dimension of features
t = 3  # number of tasks/threads
k = 4  # max selections per task

# Create dummy data arrays
X = np.random.randn(n, d).astype(np.float64)
current_values = np.random.randn(t, n).astype(np.float64)
selections = np.zeros((t, k), dtype=np.int64)
gains = np.zeros((t, k), dtype=np.float64)
total_gains = np.zeros(t, dtype=np.float64)
max_values = np.ones(t, dtype=np.float64) * 100.0
n_selected = np.zeros(t, dtype=np.int64)
row_sums = np.random.randn(n).astype(np.float64)
idxs = np.arange(n, dtype=np.int64)

# Define numba signature and parameters
dtypes = "(float64[:,:], int64, float64[:,:], int64[:,:], float64[:,:], float64[:], float64[:], int64[:], float64[:], int64[:])"
parallel = True
fastmath = False
cache = False

ARGS = {
    "dtypes": dtypes,
    "parallel": parallel,
    "fastmath": fastmath,
    "cache": cache,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numba, numpy, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type CPUDispatcher — a CPUDispatcher output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a CPUDispatcher 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
calculate_gains_sparse Ran
ran on a synthesized input
jmschrei/apricot/apricot/functions/maxCoverage.py
code served (permissive licence) · get_code("885f1dcdbe1211c7")
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 CPUDispatcher. 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 numba import njit, prange

# First, define the function
sdtypes = 'void(float64[:], int32[:], int32[:], float64[:], float64[:], float64, int64[:])'

def calculate_gains_sparse(dtypes, parallel, fastmath, cache):
    @njit(sdtypes, parallel=parallel, fastmath=fastmath, cache=cache)
    def calculate_gains_sparse_(X_data, X_indices, X_indptr, gains, current_values, threshold, idxs):
        for i in prange(idxs.shape[0]):
            idx = idxs[i]
            start = X_indptr[idx]
            end = X_indptr[idx + 1]
            for j in range(start, end):
                k = X_indices[j]
                gains[i] += min(X_data[j] + current_values[k], threshold) - current_values[k]
    return calculate_gains_sparse_

# Construct arguments for the function
# The function creates a sparse matrix representation and computes gains

# Create small sparse matrix data in CSR format
# X_data: values in sparse matrix
X_data = np.array([1.5, 2.3, 0.8, 1.1], dtype=np.float64)

# X_indices: column indices for each non-zero value
X_indices = np.array([0, 2, 1, 3], dtype=np.int32)

# X_indptr: row pointers for CSR format (4 rows means 5 pointer values)
X_indptr = np.array([0, 2, 2, 4, 4], dtype=np.int32)

# gains: output array to accumulate gains (2 indices will be processed)
gains = np.array([0.0, 0.0], dtype=np.float64)

# current_values: current values for 4 features
current_values = np.array([0.5, 1.0, 0.3, 0.7], dtype=np.float64)

# threshold: threshold value for gain calculation
threshold = 2.0

# idxs: indices to process (2 row indices)
idxs = np.array([0, 2], dtype=np.int64)

ARGS = {
    'dtypes': sdtypes,
    'parallel': True,
    'fastmath': False,
    'cache': False,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numba, numpy — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type CPUDispatcher — a CPUDispatcher output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a CPUDispatcher 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
check_random_state Ran
ran on a synthesized input
jmschrei/apricot/apricot/utils.py
code served (permissive licence) · get_code("9970bf725452e2b7")
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 RandomState. 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 numbers
import numpy
import numpy.random

# Test case 1: seed is None
seed_none = None

# Test case 2: seed is an integer
seed_int = 42

# Test case 3: seed is a numpy integer
seed_numpy_int = numpy.int64(123)

# Test case 4: seed is already a RandomState instance
seed_random_state = numpy.random.RandomState(999)

# Test case 5: seed is numpy.random module
seed_numpy_random = numpy.random

# We'll test with the integer seed as the main case
ARGS = {
    "seed": 42
}
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 RandomState — a RandomState output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a RandomState 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
sigmoid Ran
ran on a synthesized input
jmschrei/apricot/apricot/functions/featureBased.py
code served (permissive licence) · get_code("7c6e5731ed160e05")
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 float, 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

# Analyze the function:
# - sigmoid takes a single parameter X which is a float64 array
# - It performs element-wise operation: X / (1.0 + X)
# - This is a mathematical operation on a numpy array

# Create a small float64 array as input
X = np.array([0.5, 1.0, 2.0, -0.5], dtype=np.float64)

ARGS = {
    'X': X
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numba, 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 float, 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
calculate_gains_sieve Not yet run
unverified (harvested, no recorded run)
jmschrei/apricot/apricot/functions/facilityLocation.py
code served (permissive licence) · get_code("462292bd2fd54252")
How it ran

no invocation recorded.

calculate_gains_sieve Not yet run
unverified (harvested, no recorded run)
jmschrei/apricot/apricot/functions/maxCoverage.py
code served (permissive licence) · get_code("e9f49efe5cdb81e9")
How it ran

no invocation recorded.

calculate_gains_sparse Not yet run
unverified (harvested, no recorded run)
jmschrei/apricot/apricot/functions/facilityLocation.py
code served (permissive licence) · get_code("33148b74897a49f9")
How it ran

no invocation recorded.

calculate_gains_sparse Not yet run
unverified (harvested, no recorded run)
jmschrei/apricot/apricot/functions/featureBased.py
code served (permissive licence) · get_code("974f410be770e2d1")
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 present apricot, an open source Python package for selecting representative subsets from large data sets using submodular optimization. The package implements an efficient greedy selection algorithm that offers strong theoretical guarantees on the quality of the selected set. Two submodular set functions are implemented in apricot: facility location, which is broadly applicable but requires memory quadratic in the number of examples in the data set, and a feature-based function that is less broadly applicable but can scale to millions of examples. Apricot is extremely efficient, using both algorithmic speedups such as the lazy greedy algorithm and code optimizers such as numba. We demonstrate the use of subset selection by training machine learning models to comparable accuracy using either the full data set or a representative subset thereof. This paper presents an explanation of submodular selection, an overview of the features in apricot, and an application to several data sets. The code and tutorial Jupyter notebooks are available at https://github.com/jmschrei/apricot

For agents

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

get_harvested_code_for_paper("1906.03543")
get_code_for_paper("1906.03543")
have("1906.03543")

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

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

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

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

Connect an agent — have() is free.