MCPcopy Create free account
hub / github.com/MARIO-Math-Reasoning/Super_MARIO / InferNode

Class InferNode

offline_inference.py:25–51  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

23
24
25class InferNode(BaseModel):
26
27 tag: str = "0"
28
29 text: str = ""
30 extra_info: str = ""
31 action: str = ""
32 action_input: str = ""
33 final_answer: str = ""
34
35 c_puct: float = 1.25
36 depth: int = 0
37
38 prior: float = 1.0
39 value: float = 0
40 q_value: float = 0
41 visit_count: int = 0
42
43 parent: Optional[Any] = None
44 children: List[Any] = []
45
46 prune: bool = False
47
48 def puct(self) -> float:
49 q_value = self.q_value if self.visit_count > 0 else 0
50 u_value = self.c_puct * self.prior * np.sqrt(self.parent.visit_count) / (1 + self.visit_count)
51 return q_value + u_value
52
53
54def rebuild_tree(

Callers 1

rebuild_treeFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected