Skip to main content

Chalcedon

License Powered by: uv Code style: ruff Typing: ty GitHub Workflow Status PyPI

Fast, memory-efficient Butina clustering and train/validation/test splitting for chemical datasets. Use this package to minimize data leakage when splitting chemical data to improve the evaluation and generalizability of your models.

Installation

uv pip install chalcedon

Quick start

Recommended

For the recommended case, run directly from SMILES. Chalcedon computes Morgan fingerprints (radius 2, 2048 bits) internally and clusters in float32:

import chalcedon

smiles = [
    "CCO",
    "c1ccccc1",
    # ...your dataset
]

splits = chalcedon.butina_split(
    smiles,
    fractions={"train": 0.8, "val": 0.1, "test": 0.1},
    cutoff=0.65,
    dtype="float32" # or np.float32
)

train_smiles = splits["train"]
val_smiles = splits["val"]
test_smiles = splits["test"]

Using custom descriptors

We recommend dtype="float64" for non-binary descriptors, where dot-product magnitudes can exceed float32's exact range.

import chalcedon

descriptors = my_descriptor_generator(molecules)  # numpy.ndarray of shape (n, d)

cluster_ids = chalcedon.butina_cluster(descriptors, cutoff=0.65, dtype="float64")
splits = chalcedon.greedy_cluster_split(
    cluster_ids,
    fractions={"train": 0.8, "val": 0.1, "test": 0.1},
)

train_indices = splits["train"]  # numpy.ndarray of indices into `descriptors`

pairwise_tanimoto(fingerprints) is also exposed if you want just the similarity matrix.

Benchmarks

Scaling: wall time and peak memory Chalcedon can quickly create Butina clusters of large chemical datasets on consumer hardware with near linear memory scaling.

See benchmarks/report.md for a detailed analysis of algorithm performance and benchmarks/ to reproduce results.

Citation

If you use Chalcedon in your research, please cite:

@software{chalcedon,
  title = {Chalcedon: Clustering and dataset splitting for chemical data.},
  year = {2026},
  url = {https://github.com/rowansci/chalcedon}
}

Acknowledgements

  • RDKit for cheminformatics infrastructure and the CrystalFF torsion library (Riniker & Landrum, J. Chem. Inf. Model. 56, 2016)
  • GEOM dataset for the benchmark SMILES (Axelrod & Gomez-Bombarelli, Sci Data 9, 185, 2022)

This package was created with Cookiecutter and the jevandezande/uv-cookiecutter project template.

Metadata

Release files for chalcedon 0.0.2

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

Source distribution (sdist)

Source distribution for chalcedon 0.0.2
File Size Uploaded Provenance
chalcedon-0.0.2.tar.gz 2.5 MB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for chalcedon 0.0.2
File Interpreter ABI Platform
chalcedon-0.0.2-py3-none-any.whl Python 3 none any Details

Total release size: 2.5 MB

Release files / chalcedon-0.0.2.tar.gz

Download URL chalcedon-0.0.2.tar.gz
Size 2.5 MB
Tags Source
SHA-256 checksum
How to use checksums
fbd277531e202415e208d0a97ea928c1202cb3444f11055008764811a10fdea6
BLAKE2b-256 checksum
How to use checksums
96061de0fb6f902e5b8ca3851b20cb6723ae0b6e4c245f1e36fd554567f0a35e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.11.19 {"installer":{"name":"uv","version":"0.11.19","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / chalcedon-0.0.2-py3-none-any.whl

Download URL chalcedon-0.0.2-py3-none-any.whl
Size 11.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
528725a623ffb72a39711eec7648d840cfaae61b493d25262d96f4082ee1ccf5
BLAKE2b-256 checksum
How to use checksums
8abf75a1e81f63461ab678507ed1c084e1af85279ce82cdf8144454e5f440df6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.11.19 {"installer":{"name":"uv","version":"0.11.19","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Security for chalcedon 0.0.2

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.0.2 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