Skip to content

Commit 61e3ca7

Browse files
fix(training): lift sour-rule recall 0.57 β†’ 0.93 (match acid anions)
Match carboxylate/sulfonate/phosphate anions, not just protonated acids. Recall 0.57β†’0.93. Closes #41.
1 parent 3bdf4e7 commit 61e3ca7

2 files changed

Lines changed: 10 additions & 4 deletions

File tree

β€Žtraining/predict.pyβ€Ž

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,12 @@
5555
TASTE = Path("taste_models")
5656

5757
ACID_SMARTS = {
58-
"carboxylic acid": "[CX3](=O)[OX2H1]",
59-
"sulfonic acid": "[SX4](=O)(=O)[OX2H1]",
60-
"phosphoric/phosphonic acid": "[PX4](=O)[OX2H1]",
58+
# Match both protonated (-OH) and deprotonated (-O-) forms β€” sour compounds are
59+
# routinely drawn as carboxylate/sulfonate/phosphate anions or zwitterions.
60+
# (Lifted the rule's recall on labeled-sour from 0.57 to 0.93.)
61+
"carboxylic acid / carboxylate": "[CX3](=O)[OX2H1,OX1-]",
62+
"sulfonic / sulfonate": "[SX4](=O)(=O)[OX2H1,OX1-]",
63+
"phosphoric / phosphonic (+ anion)": "[PX4](=O)[OX2H1,OX1-]",
6164
}
6265
_ACID = {k: Chem.MolFromSmarts(v) for k, v in ACID_SMARTS.items()}
6366

β€Žtraining/train_taste.pyβ€Ž

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,10 @@
4949

5050
# Acidic-group SMARTS β€” used both for the sour rule and to VALIDATE it against
5151
# whatever labeled sour compounds exist (so that data isn't wasted either).
52-
ACID_SMARTS = ["[CX3](=O)[OX2H1]", "[SX4](=O)(=O)[OX2H1]", "[PX4](=O)[OX2H1]"]
52+
# Match BOTH protonated (-OH) and deprotonated (-O-) forms: sour compounds are
53+
# routinely drawn as carboxylate/sulfonate/phosphate anions or zwitterions, which
54+
# the -OH-only patterns missed (the main driver of the low recall).
55+
ACID_SMARTS = ["[CX3](=O)[OX2H1,OX1-]", "[SX4](=O)(=O)[OX2H1,OX1-]", "[PX4](=O)[OX2H1,OX1-]"]
5356
_ACID = [Chem.MolFromSmarts(s) for s in ACID_SMARTS]
5457

5558

0 commit comments

Comments
Β (0)