Skip to content

Commit 400c7d6

Browse files
WHOIM1205WHOIM1205
andauthored
Reconstruct encoded sequence before evaluation in MCTS simulation (#294)
## Fix incorrect sequence evaluation in MCTS simulation ### What was happening During simulation, we were passing encoded sequences (with `_` markers) directly to the evaluator. These got converted into invalid sequences internally (full of `N`s), so the scores driving the MCTS search were basically meaningless. ### What’s changed We now reconstruct the sequence using `_reconstruct()` before evaluation, so the model sees the actual nucleotide sequence. ### Why it matters This ensures the search is guided by real scores instead of corrupted ones, making the generated candidates much more reliable. Signed-off-by: WHOIM1205 <rathourprateek8@gmail.com> Signed-off-by: WHOIM1205 <your-email@users.noreply.github.com> Co-authored-by: WHOIM1205 <your-email@users.noreply.github.com>
1 parent 10b8fae commit 400c7d6

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

pyaptamer/mcts/_algorithm.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,9 @@ def _simulation(self, node: "TreeNode") -> float:
228228
for _ in range(remaining_length):
229229
sequence += random.choice(self.states)
230230

231+
# reconstruct the encoded sequence (e.g., "A__C" -> "CA") before evaluation
232+
sequence = self._reconstruct(sequence)
233+
231234
# evaluate the candidate sequence with the goal function
232235
return self.experiment.evaluate(sequence)
233236

0 commit comments

Comments
 (0)