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