SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2410.19816 · NeurIPS · 2024

DivShift: Exploring Domain-Specific Distribution Shift in Large-Scale, Volunteer-Collected Biodiversity Datasets

Elena Sierra, Lauren Gillespie, Salim Soltani, Moises Exposito-Alonso, Teja Kattenborn

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 (1 of them constructed an object rather than computing a result; 1 honoured the contract we drafted, 0 violated it and 1 has no contract verdict; 5 failures of our instrument; 4 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/2410.19816.json · badge: /api/ran/2410.19816.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
moiexpositoalonsolab/DivShift marked official in Papers with Code
Papers with Code archive
7 ran · 4 no recorded run
FunctionStatusWhere it lives
LabelsDataset Ran
ran on a synthesized input · constructed an object; no result was computed
moiexpositoalonsolab/DivShift/src/supervised_train.py
code served (permissive licence) · get_code("7f2ff12dd300775f")
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 an instance of its own class, LabelsDataset: the run constructed the object and did not call it, so no result was computed. 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 torchvision.transforms as transforms
import pandas as pd
from PIL import Image
import io
import json
import tempfile
import os

torch.manual_seed(0)

# Create a temporary directory structure for the dataset
temp_dir = tempfile.mkdtemp()
state_dir = os.path.join(temp_dir, 'CA')
folder_dir = os.path.join(state_dir, '001')
os.makedirs(folder_dir, exist_ok=True)

# Create metadata JSON file
metadata = {
    'far': ['species_a', 'species_b', 'species_c'],
    'car': ['species_d', 'species_e'],
    'rar': ['species_f']
}
meta_path = os.path.join(temp_dir, 'divshift_nawc_far_car_rar.json')
with open(meta_path, 'w') as f:
    json.dump(metadata, f)

# Create dummy images
def create_dummy_image():
    img = Image.new('RGB', (32, 32), color=(73, 109, 137))
    return img

for i in range(2):
    photo_id = f'001{i:04d}'
    img_path = os.path.join(folder_dir, f'{photo_id}.png')
    create_dummy_image().save(img_path)

# Create a sample dataframe
data = {
    'photo_id': ['0010000', '0010001'],
    'state_name': ['CA', 'CA'],
    'species': ['species_a', 'species_b'],
    'l2_ecoregion': ['eco1', 'eco2'],
    'land_use': ['urban', 'forest']
}
df = pd.DataFrame(data)

# Create label dictionary
label_dict = {
    'species_a': 0,
    'species_b': 1,
    'species_c': 2,
    'species_d': 3,
    'species_e': 4,
    'species_f': 5
}

# Create transform
transform = transforms.Compose([
    transforms.Normalize(mean=[0.485, 0.456, 0.406], 
                        std=[0.229, 0.224, 0.225])
])

ARGS = {
    'data_frame': df,
    'img_dir': temp_dir,
    'label_dict': label_dict,
    'to_classify': 'species',
    'transform': transform,
    'target_transform': None
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
PIL, pandas, torch, torchvision — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type LabelsDataset — the run constructed an instance of its own class and did not call it; no shape 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
calculate_jsd Ran
ran, honoured the contract we drafted
moiexpositoalonsolab/DivShift/src/supervised_train.py
code served (permissive licence) · get_code("0c8bb8a9465fcb28")
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 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 pandas as pd
import numpy as np
import scipy.spatial.distance

# Create a sample dataframe with the required columns
df = pd.DataFrame({
    'supervised': [True] * 10,
    'train_partition': ['train', 'train', 'train', 'train', 'test', 'test', 'test', 'test', 'test', 'test'],
    'test_partition': ['train', 'train', 'train', 'train', 'test', 'test', 'test', 'test', 'test', 'test'],
    'b_partition': ['train', 'train', 'train', 'test', 'test', 'test', 'train', 'train', 'test', 'test'],
    'to_classify': ['A', 'B', 'A', 'C', 'B', 'A', 'A', 'B', 'C', 'A']
})

ARGS = {
    'df': df,
    'train_partition': 'train_partition',
    'test_partition': 'test_partition',
    'to_classify': 'to_classify',
    'b_partition': 'b_partition',
    'use_entire_split': False
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, pandas, scipy — 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
partition Ran
ran; our contract draft was wrong, not the code
moiexpositoalonsolab/DivShift/src/supervised_train.py
code served (permissive licence) · get_code("561a103ed3645a99")
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 torch
import numpy as np

torch.manual_seed(0)

# The function partition takes a list and an integer n
# It divides the list into n roughly equal parts
# It uses: len(lst), indexing with slices, range(n)

lst = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
n = 3

ARGS = {
    "lst": lst,
    "n": n
}
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 — 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
randomize_taxonomic_train_test Ran
ran; our contract draft was wrong, not the code
moiexpositoalonsolab/DivShift/src/supervised_train.py
code served (permissive licence) · get_code("f8a73f658b803a2e")
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 simple random generator
generator = np.random.default_rng(seed=42)

# Create a sample dataframe with species names and some data
data = {
    'name': ['species_A'] * 50 + ['species_B'] * 60 + ['species_C'] * 40,
    'value': np.random.randn(150),
    'feature': np.random.randn(150)
}
df = pd.DataFrame(data)

# Ensure the dataframe has a proper index
df = df.reset_index(drop=True)

ARGS = {
    'df': df,
    'generator': generator
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, pandas, tqdm — 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
randomize_train_test Ran
ran; our contract draft was wrong, not the code
moiexpositoalonsolab/DivShift/src/supervised_train.py
code served (permissive licence) · get_code("8159bdff9817d6cc")
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
import math

# Create a sample DataFrame with a partition column
df = pd.DataFrame({
    'value': np.random.randn(100),
    'partition': ['not_eligible'] * 30 + [np.nan] * 20 + [np.nan] * 50
})

# Create a generator (numpy random generator)
generator = np.random.default_rng(seed=42)

ARGS = {
    'df': df,
    'partition': 'partition',
    'generator': generator
}
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
species_topK Ran
ran; our contract draft was wrong, not the code
moiexpositoalonsolab/DivShift/src/supervised_train.py
code served (permissive licence) · get_code("2abe002af8c77b5d")
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 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 torch
import numpy as np

torch.manual_seed(0)

# Construct valid arguments for species_topK
# The function expects:
# - ytrue: tensor/array of true species labels
# - yobs: tensor/array of observed values (scores) with shape (batch, nspecs)
# - K: number of top values to select

# Create small test data
batch_size = 2
nspecs = 4
K = 2

# ytrue: true species labels for each sample (shape: batch_size,)
# Should contain species indices 0 to nspecs-1
ytrue = np.array([0, 1], dtype=np.int64)

# yobs: observed scores/predictions (shape: batch_size, nspecs)
# Random scores for each species
yobs = np.array([
    [0.9, 0.1, 0.3, 0.2],
    [0.2, 0.8, 0.1, 0.4]
], dtype=np.float32)

ARGS = {
    'ytrue': ytrue,
    'yobs': yobs,
    'K': K
}
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 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
train_one_epoch Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
moiexpositoalonsolab/DivShift/src/supervised_train.py
code served (permissive licence) · get_code("cfc9059e2d6da587")
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 torch
import torch.nn as nn
import torch.optim as optim
from torch.utils.tensorboard import SummaryWriter
from unittest.mock import MagicMock

torch.manual_seed(0)

# Define a minimal model
class SimpleModel(nn.Module):
    def __init__(self):
        super().__init__()
        self.fc = nn.Linear(4, 3)
    
    def forward(self, x):
        return self.fc(x)

# Create model
model = SimpleModel()

# Create device
device = torch.device('cpu')

# Create a minimal train loader (list of (data, target) tuples)
train_loader = [
    (torch.randn(2, 4), torch.randint(0, 3, (2,))),
    (torch.randn(2, 4), torch.randint(0, 3, (2,))),
]

# Create optimizer
optimizer = optim.SGD(model.parameters(), lr=0.01)

# Create a minimal logger (dict to store losses)
logger = {}

# Create args dict with minimal config
args = MagicMock()
args.epochs = 1

# Create mock SummaryWriter that captures calls
writer_mock = MagicMock(spec=SummaryWriter)

ARGS = {
    'args': args,
    'model': model,
    'device': device,
    'train_loader': train_loader,
    'optimizer': optimizer,
    'epoch': 0,
    'logger': logger,
    'count': 0,
    'SummaryWriter': writer_mock,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch, tqdm — 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
obs_topK Not yet run
unverified (harvested, no recorded run)
moiexpositoalonsolab/DivShift/src/supervised_train.py
code served (permissive licence) · get_code("a6a42efb124d807b")
How it ran

no invocation recorded.

save_weights Not yet run
unverified (harvested, no recorded run)
moiexpositoalonsolab/DivShift/src/supervised_train.py
code served (permissive licence) · get_code("2e0d728013704a3c")
How it ran

no invocation recorded.

test_one_epoch Not yet run
unverified (harvested, no recorded run)
moiexpositoalonsolab/DivShift/src/supervised_train.py
code served (permissive licence) · get_code("02e6b4b1e369961f")
How it ran

no invocation recorded.

train Not yet run
unverified (harvested, no recorded run)
moiexpositoalonsolab/DivShift/src/supervised_train.py
code served (permissive licence) · get_code("8cecb34f0bcef7ce")
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-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

Large-scale, volunteer-collected datasets of communityidentified natural world imagery like iNaturalist have enabled marked performance gains for fine-grained visual classification of species using machine learning methods. However, such data-sometimes referred to as citizen science data-are opportunistic and lack a structured sampling strategy. This volunteer-collected biodiversity data contains geographic, temporal, taxonomic, observers, and sociopolitical biases that can have significant effects on biodiversity model performance, but whose impacts are unclear for fine-grained species recognition performance. Here we introduce Diversity Shift (DivShift), a framework for quantifying the effects of domain-specific distribution shifts on machine learning model performance. To diagnose the performance effects of biases specific to volunteer-collected biodiversity data, we also introduce DivShift -North American West Coast (DivShift-NAWC), a curated dataset of almost 7.5 million iNaturalist images across the western coast of North America partitioned across five types of expert-verified bias. We compare species recognition performance across these bias partitions using a diverse variety of species-and ecosystemfocused accuracy metrics. We observe that these biases confound model performance less than expected from the underlying label distribution shift, and that more data leads to better model performance but the magnitude of these improvements are bias-specific. These findings imply that while the structure within natural world images provides generalization improvements for biodiversity monitoring tasks, the biases present in volunteer-collected biodiversity data can also affect model performance; thus these models should be used with caution in downstream biodiversity monitoring tasks.

For agents

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

get_harvested_code_for_paper("2410.19816")
get_code_for_paper("2410.19816")
have("2410.19816")

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

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

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

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

Connect an agent — have() is free.