SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2210.16834 · NeurIPS · 2022

Alleviating the Sample Selection Bias in Few-shot Learning by Removing Projection to the Centroid

Zenglin Xu, Jing Xu, Xu Luo, Xinglin Pan, Wenjie Pei, Yanan Li

arXiv · PDF · Open in the Atlas

Code that ran

12 of 12 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 6 have no contract verdict; 5 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/2210.16834.json · badge: /api/ran/2210.16834.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
kikimormay/fsl-tcbr canonical (classifier label)
classifier basis: classifier_2025
6 ran · 0 no recorded run
uitml/nohub community (classifier label)
classifier basis not recorded on the link
6 ran · 0 no recorded run
FunctionStatusWhere it lives
L2SquareDist Ran
ran; our contract draft was wrong, not the code
kikimormay/fsl-tcbr/models/proo_head.py
pointer only (licence: NONE) · get_code("9148b4837084aa06")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, kikimormay/fsl-tcbr when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

PN_head Ran
ran on a synthesized input · constructed an object; no result was computed
kikimormay/fsl-tcbr/models/proo_head.py
pointer only (licence: NONE) · get_code("a878f89801621e70")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, kikimormay/fsl-tcbr when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

box_cox Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
kikimormay/fsl-tcbr/evaluate_DC_minusEffect.py
pointer only (licence: NONE) · get_code("40fb33e3f0e18042")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, kikimormay/fsl-tcbr when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

compute_classification_metrics Ran
ran on a synthesized input
uitml/nohub/src/evaluate.py
code served (permissive licence) · get_code("ef7087bcf8b23f9c")
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

torch.manual_seed(0)

# The function expects two tensors that support:
# - equality comparison (==)
# - .float() method
# - .mean(dim=1) method
# These should be 2D tensors for mean(dim=1) to make sense

query_labels = torch.tensor([
    [1, 0, 1, 1],
    [0, 1, 0, 1]
], dtype=torch.long)

query_predictions = torch.tensor([
    [1, 0, 1, 0],
    [0, 1, 0, 1]
], dtype=torch.long)

ARGS = {
    'query_labels': query_labels,
    'query_predictions': query_predictions
}
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 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
dict_means Ran
ran on a synthesized input
uitml/nohub/src/helpers.py
code served (permissive licence) · get_code("a1d8a3e0deeaaf5c")
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 pandas as pd

# Create a list of dictionaries with numeric values
dicts = [
    {'a': 1, 'b': 2, 'c': 3},
    {'a': 4, 'b': 5, 'c': 6},
    {'a': 7, 'b': 8, 'c': 9}
]

ARGS = {
    'dicts': dicts
}
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 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
gen_clusters Ran
ran, honoured the contract we drafted
kikimormay/fsl-tcbr/gaussian_simulation.py
pointer only (licence: NONE) · get_code("38490fabee69591b")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, kikimormay/fsl-tcbr when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

get_cos_sin Ran
ran; our contract draft was wrong, not the code
kikimormay/fsl-tcbr/evaluate_DC_minusEffect.py
pointer only (licence: NONE) · get_code("d545754a366e78e9")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, kikimormay/fsl-tcbr when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

get_pca_weights Ran
ran on a synthesized input
uitml/nohub/src/pca.py
code served (permissive licence) · get_code("8d0ff3ac7756bd95")
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 Tensor, ndim 3, dtype family float, shape (2, 3, 3) 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 torch.nn as nn

torch.manual_seed(0)

# The function expects inputs as a tensor
# Looking at the code:
# - inputs.ndim can be 2 or 3
# - inputs.size() is called
# - inputs[None, :, :] is used to add a dimension if ndim == 2
# - inputs.mean(dim=1, keepdim=True) is called
# - inputs.transpose(1, 2) @ inputs is computed (matrix multiplication)
# - th.linalg.eigh() is called on the result
# - eig_vec is indexed and flipped
# 
# So inputs should be a 3D tensor: (batch, features, samples) or
# a 2D tensor: (features, samples)
# Let's use a 3D tensor with shape (batch=2, features=4, samples=3)

inputs_3d = torch.randn(2, 4, 3)

ARGS = {
    'inputs': inputs_3d
}
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 Tensor, ndim 3, dtype family float, shape (2, 3, 3) — shape (2, 3, 3) 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
initial_weights Ran
ran on a synthesized input
uitml/nohub/src/classifiers/simpleshot.py
code served (permissive licence) · get_code("f9f219e499515fa0")
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 Tensor, ndim 3, dtype family float, shape (2, 2, 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 torch as th
from torch import nn

th.manual_seed(0)

# Construct support_features: shape (batch_size, num_support, feature_dim)
# Using distinct sizes: batch=2, num_support=3, feature_dim=4
support_features = th.randn(2, 3, 4)

# Construct support_labels: shape (batch_size, num_support)
# Labels should be class indices from 0 to n_ways-1
# Using 2 ways (classes 0 and 1), batch_size=2, num_support=3
support_labels = th.tensor([[0, 1, 0], [1, 0, 1]])

# normalize parameter
normalize = False

ARGS = {
    "support_features": support_features,
    "support_labels": support_labels,
    "normalize": normalize,
}
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 Tensor, ndim 3, dtype family float, shape (2, 2, 4) — shape (2, 2, 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
mean_confidence_interval Ran
ran; our contract draft was wrong, not the code
kikimormay/fsl-tcbr/evaluate_DC_minusEffect.py
pointer only (licence: NONE) · get_code("02885b711bbe655c")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, kikimormay/fsl-tcbr when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

npy Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
uitml/nohub/src/helpers.py
code served (permissive licence) · get_code("968801ffa2d3b187")
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 2, dtype family float, shape (2, 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 torch
import numpy as np

torch.manual_seed(0)

# Create a simple tensor on CPU
tensor_1d = torch.randn(2, 4)
tensor_2d = torch.randn(3, 5)

# Test with list of tensors
list_of_tensors = [tensor_1d, tensor_2d]

# Test with tuple of tensors
tuple_of_tensors = (tensor_1d, tensor_2d)

# Test with dict of tensors
dict_of_tensors = {
    "a": tensor_1d,
    "b": tensor_2d,
    "nested": {"c": tensor_1d}
}

# ARGS mapping all parameters
ARGS = {
    "t": tensor_1d,
    "to_cpu": True
}
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 ndarray, ndim 2, dtype family float, shape (2, 4) — shape (2, 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
transpose_list_dict Ran
ran on a synthesized input
uitml/nohub/src/helpers.py
code served (permissive licence) · get_code("c84ca57bf718dc2e")
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

torch.manual_seed(0)

# The function takes a list of dicts and converts it to a dict of lists
# It expects dicts to have the same keys

ARGS = {
    "dicts": [
        {"a": 1, "b": 2, "c": 3},
        {"a": 4, "b": 5, "c": 6},
        {"a": 7, "b": 8, "c": 9},
    ]
}
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 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

Also present in other papers' code

Of 12 samples lifted from this paper's linked repositories, 12 carry a function identity and 0 do not. Of the 12 distinct functions with an identity, 1 are also present in other papers whose code we hold (0 with at least one paper dated earlier, 0 the same month, 1 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.

FunctionAlso present inEarliest-datedOthers named
npy 2 other papers
2 later
2303.09877 (2023-03)
On the Effects of Self-supervision and Contrastive Alignment in Deep Multi-view Clustering
Xu_A_Hubness_Perspective_on_Representation_Learning_for_Graph-Based_Multi-View_Clustering_CVPR_2025_paper (2025 (year only))
A Hubness Perspective on Representation Learning for Graph-Based Multi-View Clustering

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

Few-shot learning (FSL) targets at generalization of vision models towards unseen tasks without sufficient annotations. Despite the emergence of a number of fewshot learning methods, the sample selection bias problem, i.e., the sensitivity to the limited amount of support data, has not been well understood. In this paper, we find that this problem usually occurs when the positions of support samples are in the vicinity of task centroid-the mean of all class centroids in the task. This motivates us to propose an extremely simple feature transformation to alleviate this problem, dubbed Task Centroid Projection Removing (TCPR). TCPR is applied directly to all image features in a given task, aiming at removing the dimension of features along the direction of the task centroid. While the exact task centroid cannot be accurately obtained from limited data, we estimate it using base features that are each similar to one of the support features. Our method effectively prevents features from being too close to the task centroid. Extensive experiments over ten datasets from different domains show that TCPR can reliably improve classification accuracy across various feature extractors, training algorithms and datasets. The code has been made available at https://github.com/KikimorMay/FSL-TCBR.

For agents

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

get_harvested_code_for_paper("2210.16834")
get_code_for_paper("2210.16834")
have("2210.16834")

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

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

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

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

Connect an agent — have() is free.