SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2306.14809 · NeurIPS · 2023

Tanimoto Random Features for Scalable Molecular Machine Learning

José Hernández-Lobato, Austin Tripp, Sergio Bacallado, Sukriti Singh

arXiv · PDF · Open in the Atlas

Code that ran

7 of 7 samples (functions and classes) lifted from this paper's linked repositories executed on a synthesized input in Syntology's jail (3 of them constructed an object rather than computing a result; 2 honoured the contract we drafted, 0 violated it and 3 have no contract verdict; 2 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/2306.14809.json · badge: /api/ran/2306.14809.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
austint/tanimoto-random-features-neurips23 canonical (classifier label)
classifier basis: classifier_2025
7 ran · 0 no recorded run
FunctionStatusWhere it lives
PrefactorQMC_Featurizer Ran
ran on a synthesized input · constructed an object; no result was computed
austint/tanimoto-random-features-neurips23/trf23/random_features/tdp.py
code served (permissive licence) · get_code("0d63518d7c7a344e")
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, PrefactorQMC_Featurizer: 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 numpy as np
import math
from scipy import stats

# Set random seed for reproducibility
np.random.seed(0)
rng = np.random.default_rng(seed=0)

# Define the helper functions that are needed
def _gamma_dist(s: float, c: float) -> stats.gamma:
    return stats.gamma(a=s, scale=1 / c)

def _draw_gamma_qmc_samples(num_rf: int, s: float, c: float, rng: np.random.Generator) -> np.ndarray:
    gamma_offset = rng.random()
    gamma_cdf_vals = np.mod(gamma_offset + np.linspace(0, 1, num_rf), 1.0)
    return _gamma_dist(s=s, c=c).ppf(gamma_cdf_vals)

def _tanimoto_power_series_denominator_rf(x: np.ndarray, gamma_samples: np.ndarray, r: int, c: float=1.0, s: float=None, allow_r_less_than_s: bool=False):
    """Random feature function for (|x|^2+|y|^2)^{-r})."""
    if s is None:
        s = float(r)
    assert allow_r_less_than_s or r >= s
    assert x.ndim == 2
    assert gamma_samples.ndim == 1
    x_norm2 = np.sum(x ** 2, axis=-1, keepdims=True)
    term1 = (c / 2.0 - x_norm2) * gamma_samples
    term2 = (r - s) / 2.0 * np.log(gamma_samples)
    term3 = 0.5 * (-s * math.log(c) + math.lgamma(s) - math.lgamma(r))
    log_rf = term1 + term2 + term3
    rf_not_normalized = np.exp(log_rf)
    return rf_not_normalized / math.sqrt(rf_not_normalized.shape[-1])

class PrefactorQMC_Featurizer:
    """Random featurizer for 1/(|x|^2 + |y|^2)"""

    def __init__(self, *, r: int, num_rf: int, s: float, c: float, rng, **kwargs):
        super().__init__(**kwargs)
        self.r = r
        self.s = s
        self.c = c
        self.gamma_samples = _draw_gamma_qmc_samples(num_rf=num_rf, s=s, c=c, rng=rng)

    def __call__(self, x: np.ndarray) -> np.ndarray:
        return _tanimoto_power_series_denominator_rf(x=x, gamma_samples=self.gamma_samples, r=self.r, c=self.c, s=self.s, allow_r_less_than_s=True)

# Create arguments for PrefactorQMC_Featurizer
ARGS = {
    'r': 3,
    'num_rf': 8,
    's': 2.5,
    'c': 1.0,
    'rng': rng
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, scipy — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type PrefactorQMC_Featurizer — the run constructed an instance of its own class and did not call it; no shape is stated — the instrument coerces any output to an array; for a PrefactorQMC_Featurizer 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
TDP_PowerSeriesFeaturizer Ran
ran on a synthesized input · constructed an object; no result was computed
austint/tanimoto-random-features-neurips23/trf23/random_features/tdp.py
code served (permissive licence) · get_code("1e18577cc272b869")
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, TDP_PowerSeriesFeaturizer: 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 numpy as np
from numpy.random import Generator, PCG64

# Create a random number generator
rng = np.random.Generator(PCG64(seed=42))

# Define parameters for TDP_PowerSeriesFeaturizer
input_dim = 4
R = 3  # Maximum r value

# Create dictionaries mapping r values to their parameters
r_to_num_rf = {1: 8, 2: 16, 3: 32}
r_to_num_gamma = {1: 4, 2: 8, 3: 16}
r_to_s = {1: 1.0, 2: 2.0, 3: 3.0}
r_to_c = {1: 1.0, 2: 1.0, 3: 1.0}

ARGS = {
    'input_dim': input_dim,
    'r_to_num_rf': r_to_num_rf,
    'r_to_num_gamma': r_to_num_gamma,
    'r_to_s': r_to_s,
    'r_to_c': r_to_c,
    'rng': rng,
    'bias_correction': 'none'
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, scipy, sklearn — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type TDP_PowerSeriesFeaturizer — the run constructed an instance of its own class and did not call it; no shape is stated — the instrument coerces any output to an array; for a TDP_PowerSeriesFeaturizer 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
TDP_PowerSeriesTermFeaturizer Ran
ran on a synthesized input · constructed an object; no result was computed
austint/tanimoto-random-features-neurips23/trf23/random_features/tdp.py
code served (permissive licence) · get_code("d539b7a6bbff315d")
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, TDP_PowerSeriesTermFeaturizer: 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 numpy as np
from numpy.random import Generator, PCG64

# Create a small RNG
rng = Generator(PCG64(seed=42))

# Define parameters for TDP_PowerSeriesTermFeaturizer
num_rf = 8
num_prefactor_rf = 6
input_dim = 4
c = 1.0
s = 2.0
r = 2

ARGS = {
    "num_rf": num_rf,
    "num_prefactor_rf": num_prefactor_rf,
    "input_dim": input_dim,
    "c": c,
    "s": s,
    "r": r,
    "rng": rng,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, scipy, sklearn — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type TDP_PowerSeriesTermFeaturizer — the run constructed an instance of its own class and did not call it; no shape is stated — the instrument coerces any output to an array; for a TDP_PowerSeriesTermFeaturizer 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
_draw_gamma_qmc_samples Ran
ran, honoured the contract we drafted
austint/tanimoto-random-features-neurips23/trf23/random_features/tdp.py
code served (permissive licence) · get_code("21295215c8d6b0ef")
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 (10,) 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 scipy import stats

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

# Create the arguments dictionary
ARGS = {
    "num_rf": 10,
    "s": 2.0,
    "c": 0.5,
    "rng": np.random.default_rng(seed=42)
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, scipy — 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 (10,) — shape (10,) 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
_gamma_dist Ran
ran; our contract draft was wrong, not the code
austint/tanimoto-random-features-neurips23/trf23/random_features/tdp.py
code served (permissive licence) · get_code("2ec273296b0ab5a7")
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 rv_continuous_frozen. 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 scipy import stats

ARGS = {
    "s": 2.5,
    "c": 0.8,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, scipy, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type rv_continuous_frozen — a rv_continuous_frozen output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a rv_continuous_frozen 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
_tanimoto_power_series_denominator_rf Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
austint/tanimoto-random-features-neurips23/trf23/random_features/tdp.py
code served (permissive licence) · get_code("ac2576af5a40ca58")
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, 8) 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 math

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

# Construct arguments for _tanimoto_power_series_denominator_rf

# x: np.ndarray with ndim == 2, shape (batch_size, feature_dim)
x = np.random.randn(2, 4).astype(np.float32)

# gamma_samples: np.ndarray with ndim == 1
gamma_samples = np.random.uniform(0.1, 2.0, size=8).astype(np.float32)

# r: int parameter
r = 3

# c: float parameter (default 1.0)
c = 1.0

# s: Optional[float] (will be set to r if None)
s = None

# allow_r_less_than_s: bool (default False)
allow_r_less_than_s = False

ARGS = {
    "x": x,
    "gamma_samples": gamma_samples,
    "r": r,
    "c": c,
    "s": s,
    "allow_r_less_than_s": allow_r_less_than_s
}
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 ndarray, ndim 2, dtype family float, shape (2, 8) — shape (2, 8) 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
combine_count_sketches Ran
ran, honoured the contract we drafted
austint/tanimoto-random-features-neurips23/trf23/random_features/tdp.py
code served (permissive licence) · get_code("ab2270d1ee08d024")
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 numpy as np
from sklearn.kernel_approximation import PolynomialCountSketch, fft, ifft

# Create two count sketch arrays
# sketch1 and sketch2 should be 2D arrays (batch_size, feature_dim)
# Using small dimensions as per requirements
np.random.seed(0)

sketch1 = np.random.randn(2, 4).astype(np.float64)
sketch2 = np.random.randn(2, 4).astype(np.float64)

ARGS = {
    "sketch1": sketch1,
    "sketch2": sketch2,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, sklearn — 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

Also present in other papers' code

Of 7 samples lifted from this paper's linked repositories, 7 carry a function identity and 0 do not. Of the 7 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 7 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

The Tanimoto coefficient is commonly used to measure the similarity between molecules represented as discrete fingerprints, either as a distance metric or a positive definite kernel. While many kernel methods can be accelerated using random feature approximations, at present there is a lack of such approximations for the Tanimoto kernel. In this paper we propose two kinds of novel random features to allow this kernel to scale to large datasets, and in the process discover a novel extension of the kernel to real-valued vectors. We theoretically characterize these random features, and provide error bounds on the spectral norm of the Gram matrix. Experimentally, we show that these random features are effective at approximating the Tanimoto coefficient of real-world datasets and are useful for molecular property prediction and optimization tasks.

For agents

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

get_harvested_code_for_paper("2306.14809")
get_code_for_paper("2306.14809")
have("2306.14809")

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

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

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

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

Connect an agent — have() is free.