Skip to content

Commit

Permalink
fix(node_evaluators): Handle the empty input list case
Browse files Browse the repository at this point in the history
  • Loading branch information
kmaziarz committed Sep 8, 2023
1 parent 09c3e79 commit 107fb0c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ and the project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.
- Add a top-level CLI for running end-to-end search ([#26](https://github.com/microsoft/syntheseus/pull/26)) ([@kmaziarz])
- Release single-step evaluation framework and wrappers for several model types ([#14](https://github.com/microsoft/syntheseus/pull/14), [#15](https://github.com/microsoft/syntheseus/pull/15), [#20](https://github.com/microsoft/syntheseus/pull/20)) ([@kmaziarz])
- Release checkpoints for all supported single-step model types ([#21](https://github.com/microsoft/syntheseus/pull/21)) ([@kmaziarz])
- Implement node evaluators commonly used in MCTS and Retro* ([#23](https://github.com/microsoft/syntheseus/pull/23)) ([@kmaziarz])
- Implement node evaluators commonly used in MCTS and Retro* ([#23](https://github.com/microsoft/syntheseus/pull/23), [#27](https://github.com/microsoft/syntheseus/pull/27)) ([@kmaziarz])
- Add option to terminate search when the first solution is found ([#13](https://github.com/microsoft/syntheseus/pull/13)) ([@austint])
- Add code to extract routes in order found instead of by minimum cost ([#9](https://github.com/microsoft/syntheseus/pull/9)) ([@austint])
- Declare support for type checking ([#4](https://github.com/microsoft/syntheseus/pull/4)) ([@kmaziarz])
Expand Down
3 changes: 3 additions & 0 deletions syntheseus/search/node_evaluation/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,9 @@ def _get_probability(self, node, graph) -> float:
return metadata["probability"] # type: ignore

def _evaluate_nodes(self, nodes, graph=None) -> Sequence[float]:
if not nodes: # handle the case when there are no nodes to score
return []

probs = np.asarray([self._get_probability(n, graph) for n in nodes])
probs = np.clip(probs, a_min=self._clip_probability_min, a_max=self._clip_probability_max)

Expand Down

0 comments on commit 107fb0c

Please sign in to comment.