ReactionClassifier
Hierarchical reaction classification. Given a reaction SMILES, it predicts a class in an LLM-derived reaction taxonomy and confirms it symbolically: a Morgan difference–product (MDP) fingerprint MLP gate proposes a class, the exact retrosynthetic templates in that class's tier-3 subtree are applied to the reaction, and a label is returned only if a template reproduces the recorded product
Install
pip install reactionclassifier # requires rdkit, torch, numpy
Quickstart
from reactionclassifier import ReactionClassifier
clf = ReactionClassifier() # loads the bundled gate + templates + taxonomy
r = clf.classify("CC(=O)O.NCc1ccccc1>>CC(=O)NCc1ccccc1")
r.reaction_code # '2.1.2.1' (deterministically confirmed)
r.reaction_name # 'Amidation using Carboxylic Acids | Primary Amine + Carboxylic Acid to Secondary Amide'
r.tier_path # ['2.1', '2.1.2', '2.1.2.1']
r.confidence # Top-1 probability of the neural layer
classify() returns a ClassificationResult:
| field | meaning |
|---|---|
reaction_code |
the deterministically confirmed class code — a template fired and reproduced the product. None if unconfirmed. |
reaction_name |
pipe-separated level 3/4/5 names of reaction_code (tiers 1-2 omitted). |
neural_code / neural_name |
the neural-gate prediction (always available); use as a fallback when reaction_code is None. Same name format. |
confidence |
neural-gate softmax confidence |
tier_path |
ancestor codes of reaction_code |
So: if reaction_code is populated you have a verified label; otherwise
neural_code/neural_name give the model's best (unverified) guess.
Taxonomy and granularity examples
from reactionclassifier import load_taxonomy, name_for, full_class_name, tier_path, load_granularity
load_taxonomy()["1.3.6"] # -> single class name
name_for("2.1.2.1") # -> single-level name
full_class_name("2.1.2.1") # -> pipe-joined L3|L4|L5 names, e.g.
# 'Amidation using Carboxylic Acids | Primary Amine + Carboxylic Acid to Secondary Amide'
tier_path("1.3.6.2") # -> ['1.3', '1.3.6', '1.3.6.2']
load_granularity() # the two granularity-comparison tables
What's included
| Component | File |
|---|---|
| MDP-gate MLP (full-data, 6,962 classes) | data/gate/ |
| Exact rr0rp1_ring0 template library | data/class_to_templates.json |
| Full taxonomy (14,060 code→name) | data/taxonomy.json |
| Granularity examples (+ a small illustrative SMIRKS subset) | data/granularity_examples*.json |
Full reaction database
The full labelled reaction database (≈666k reactions) is hosted externally (Zenodo) rather than shipped in the wheel:
from reactionclassifier.database import download_database
path = download_database() # downloads + caches the parquet, returns its path
The released database excludes NameRXN-derived columns (NAME, CLASS);
NameRXN is proprietary and its labels are not redistributed.
Detail
- The MDP fingerprint is a Morgan difference (reactant⊕product bit-unions) concatenated with the product fingerprint (RDKit, radius 2, 2048 bits each; 4096-dim).
- The full generalised-SMIRKS library is not released; only the small subset embedded in the granularity examples is included.
License
MIT (code and bundled data). See LICENSE.
Metadata
Release files for reactionclassifier 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| reactionclassifier-0.1.1.tar.gz | 22.1 MB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| reactionclassifier-0.1.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 44.3 MB
Release files / reactionclassifier-0.1.1.tar.gz
| Download URL | reactionclassifier-0.1.1.tar.gz |
|---|---|
| Size | 22.1 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
55c32cb7f776c9e6777160609fb7aaf6bec64a54f7021575b6cc09237ab4ac4f
|
|
BLAKE2b-256 checksum How to use checksums |
925809c7dc5fdebc13002c97b95a256c39b3fc5e7c571b9452f7983a12c884c1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jul 4, 2026.
Transparency logRelease files / reactionclassifier-0.1.1-py3-none-any.whl
| Download URL | reactionclassifier-0.1.1-py3-none-any.whl |
|---|---|
| Size | 22.1 MB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
7895222a87678e1e461bdbe62c60380e1014dc549b8a81b86f1c6f7c170c3164
|
|
BLAKE2b-256 checksum How to use checksums |
aaaa7f5b36d59ed402beea8611b1e755b41413dc2b47e5d30aae9d5ce9e19f2a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jul 4, 2026.
Transparency log