debug: log top-5 action probabilities on every decide() call
Adds a single INFO log line after each successful inference showing: - chosen action + confidence - top-5 actions sorted by probability - turn, phase, vector_source This lets us diagnose the 'only plays lands' behaviour without a Python REPL. Remove or downgrade to DEBUG once the training issue is resolved.
This commit is contained in:
1 parent
084742a56a
commit
e4f35a2d8b
1 file changed
+18
@@ -342,6 +342,24 @@ async def decide(req: DecideRequest):
|
||||
if "error" in result:
|
||||
raise HTTPException(500, detail=result["error"])
|
||||
|
||||
# ----------------------------------------------------------------
|
||||
# Probability diagnostic — logs top-5 actions on every decision.
|
||||
# Remove or downgrade to logger.debug once training looks healthy.
|
||||
# ----------------------------------------------------------------
|
||||
probs = result.get("probabilities", {})
|
||||
if probs:
|
||||
top5 = sorted(probs.items(), key=lambda kv: kv[1], reverse=True)[:5]
|
||||
top5_str = ", ".join(f"{a}:{p:.3f}" for a, p in top5)
|
||||
logger.info(
|
||||
"[decide] turn=%d phase=%s → %s (conf=%.3f) | top5=[%s] | src=%s",
|
||||
req.resolved_turn(),
|
||||
req.phase,
|
||||
result["action"],
|
||||
result["confidence"],
|
||||
top5_str,
|
||||
vector_source,
|
||||
)
|
||||
|
||||
log_prob = 0.0
|
||||
try:
|
||||
conf = result.get("confidence", 0.5)
|
||||
|
||||
Reference in new issue
Block a user