Method
uct
(self, exploration_weight: float = 1.0)
Source from the content-addressed store, hash-verified
| 24 | self.test_feedback = "" |
| 25 | |
| 26 | def uct(self, exploration_weight: float = 1.0) -> float: |
| 27 | if self.visits == 0: |
| 28 | return self.value |
| 29 | p = self.parent |
| 30 | p_visits = p.visits if p else 1 |
| 31 | return (self.value / self.visits) + exploration_weight * math.sqrt( |
| 32 | math.log(max(1, p_visits)) / self.visits |
| 33 | ) |
| 34 | |
| 35 | def best_child(self) -> "LATSNode | None": |
| 36 | if not self.children: |
Tested by
no test coverage detected