Skip to content

Commit

Permalink
Threshold MCES for de novo
Browse files Browse the repository at this point in the history
  • Loading branch information
roman-bushuiev committed Jun 3, 2024
1 parent 29e7088 commit 769b0c9
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions massspecgym/models/de_novo/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,15 +126,16 @@ def evaluate_de_novo_step(
# report the minimum distance. The minimum distances for each sample in the batch are
# averaged across the epoch.
min_mces_dists = []
mces_thld = 100
# Iterate over batch
for preds, true in zip(smiles_pred_top_k, smile_true):
# Iterate over top-k predicted molecule samples
dists = [
MCES(s1=true, s2=pred, **self.myopic_mces_kwargs)[1]
if pred is not None else 20 # TODO Replace with a more sensible value
if pred is not None else mces_thld
for pred in preds
]
min_mces_dists.append(min(dists))
min_mces_dists.append(min(min(dists), mces_thld))
self._update_metric(
metric_pref + f"top_{top_k}_min_mces_dist",
MeanMetric,
Expand Down

0 comments on commit 769b0c9

Please sign in to comment.