Skip to main content

tem1-bo: derivative-free optimizers on a protein fitness landscape

The problem

We want a TEM-1 beta-lactamase variant with high fitness (antibiotic resistance, Gray et al. 2018 / PEER benchmark; the train/valid/test splits are merged into 5198 single mutants). Each variant is represented by the mean-pooled final-layer embedding of ESM2-8M (320 dims). Those embeddings are pre-computed and shipped in src/tem1_bo/data/tem1.npz (6 MB), so nothing is downloaded and no GPU / torch is needed.

To get a continuous black box, the first d principal components of the embeddings (default d = 8) span a box, each axis rescaled to [0, 1]:

  • x in [0, 1]^d: a point in embedding space
  • f(x): minus the measured fitness of the variant whose embedding is nearest to x (everything is minimized)

f is piecewise constant (one plateau per variant), so it has no useful gradient. It is deterministic (not noisy) and one evaluation takes about 0.1 ms here. The real-world analogue is a lab measurement of a variant, which is why sample efficiency is the interesting question.

Optimizers

All get the same number of evaluations T per seed.

name family implementation
random baseline uniform samples
sobol space-filling scrambled Sobol (scipy.stats.qmc)
nelder-mead direct search scipy.optimize, restarted from a random point when it converges
cma-es direct search / ES cma, sigma0 = 0.3, restarted when it stops
bo model-based own numpy GP (RBF, hypers by marginal likelihood) + lower confidence bound (beta = 2), 10 Sobol initial points

Run

uv sync
uv run q2 --help
uv run q2 compare --budget 100 --seeds 10 --out results/
uv run pytest

The defaults (--budget 100 --seeds 10) take about 2 min on a laptop CPU. Other options: --dim (box dimension), --optimizers (subset). Seeds 0 .. S-1 are used for everything, running twice gives identical results.json.

Output

  • results/results.json: problem description, budget and one entry per (optimizer, seed) with the value f of every evaluation in order (x has the evaluated points).
  • results/ranking.json: for every (optimizer, seed) the Spearman rho between the true f of all 5198 variants and the prediction of a GP fitted on the first t evaluations (t = 10, 20, ..., budget). The same surrogate is used for all optimizers, so it measures how informative each optimizer's evaluations are about the whole landscape. If all evaluated f are equal the prediction is constant and rho is set to 0.
  • results/comparison.png, three panels:
    1. best f found so far against the number of evaluations (mean over seeds, band = +-1 std; lower is better, f = -fitness)
    2. histogram of f over all 5198 variants in the dataset (same y axis as panel 1, log counts)
    3. the Spearman rho curves from ranking.json (mean +- std over seeds)

Metadata

Release files for tem1-bo 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for tem1-bo 0.1.0
File Size Uploaded Provenance
tem1_bo-0.1.0.tar.gz 6.3 MB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for tem1-bo 0.1.0
File Interpreter ABI Platform
tem1_bo-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 12.5 MB

Release files / tem1_bo-0.1.0.tar.gz

Download URL tem1_bo-0.1.0.tar.gz
Size 6.3 MB
Tags Source
SHA-256 checksum
How to use checksums
d8bf0def6217c317a1217609319354f202373616328928b8a80b1ca825261da0
BLAKE2b-256 checksum
How to use checksums
771d5a2d39fa938bb7471b4d052d45790551a672ea4a3d87183e7740d05a5e8b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.11.11 {"installer":{"name":"uv","version":"0.11.11","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Fedora Linux","version":"42","id":"","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / tem1_bo-0.1.0-py3-none-any.whl

Download URL tem1_bo-0.1.0-py3-none-any.whl
Size 6.2 MB
Tags Python 3
SHA-256 checksum
How to use checksums
984efb53214be70f139896b3a72001b55ffe327e749c2c76620ca785faf15e64
BLAKE2b-256 checksum
How to use checksums
819372d173586d2515a9d199b1235b2107c1c3cae770ff21caf3e1cf78a121c4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.11.11 {"installer":{"name":"uv","version":"0.11.11","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Fedora Linux","version":"42","id":"","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Security for tem1-bo 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page