File size: 1,683 Bytes
2cb04e4 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 | ---
license: mit
tags:
- enzyme-classification
- ec-number
---
# Leak CURBER enzyme classification — homology kNN
Predicts one EC number per protein sequence by transferring labels from the most similar training enzymes.
## Method
1. **Prefilter**: TF-IDF-weighted 5-mer presence vectors; cosine similarity against all 186k unique training sequences, top 1,000 candidates per query (sparse matrix product).
2. **Re-rank**: Smith-Waterman local alignment (BLOSUM62, gap open 11, extend 1) of the query against each candidate with SIMD Opal (`pyopal`).
3. **Vote**: ECs of all hits scoring within 10% of the best hit, weighted by alignment score (multi-EC hits split their weight).
Falls back to the k-mer nearest neighbour if the 480 s time budget is reached, and to the most frequent EC if a query has no candidates.
## Local validation
Validation sequences have no exact matches in train and very low k-mer overlap (median top-1 cosine 0.05), so a random split is misleading (median 0.65). The local hold-out is 4,915 training sequences drawn from the low-similarity pool, scored against the remaining 181k and importance-weighted to match the validation similarity distribution (effective sample size ~2,300).
| Metric | Weighted hold-out |
|---|---|
| L1 | 0.943 |
| L2 | 0.912 |
| L3 | 0.899 |
| L4 | 0.746 |
## Runtime
11,367 validation inputs: 233 s, 4.0 GB peak RAM on 2 vCPU.
## Files
- `predict.py` — inference entry point
- `kmer.py` — sparse k-mer index
- `train.py` — builds `weights/db.parquet` from `train.parquet`
- `inputs.py`, `task.json`, `ec_vocabulary.json` — from the starter
- `weights/db.parquet` — unique training sequences with their ECs
|