lightvector / KataGo

GTP engine and self-play learning in Go
https://katagotraining.org/
Other
3.57k stars 564 forks source link

Evaluate the value of moves #964

Open simonguoxm opened 3 months ago

simonguoxm commented 3 months ago

I hope to generate a chart that shows the value of each move during the game and the statistics of many games. With this chart, we can help Go players to get some number sense about their decision.

We know that at the beginning, the value is about 13. As we reach the end of the game, the value is 1, and finally 0. How about in the middle of the game? My idea is to pass at a specific moment and use the "points lost" as the value. (Or it's possible this value is already there.)

Can anybody give me some suggestions on how to do this? If we can use katago to analysis one game, then we can analysis many games.

One issue -- there will be life and death situations involved, and passing at that moment doesn't show the value of the overall game. I hope to skip these situations automatically, but I don't have any idea how to do it.

lightvector commented 3 months ago

Have you read this yet? https://github.com/lightvector/KataGo/blob/master/docs/Analysis_Engine.md If you know how to write code you can do it however you like. If you only kind of know how to code, you can probably get by still by asking your favorite LLM chat agent for coding help.

A major caution is that passing does NOT reveal the value of moves, it is only a crude approximation. For example, if there is an endgame where a move gains 5 points for whoever plays it and another move gains 4 points for whoever plays it, and there are no other endgame moves, then the temperature of the game is 5, yet passing only loses 2 points compared to not passing (If you get +5 and opponent gets +4, it's only 2 points worse than you pass, opponent gets +5, you get +4). So the point loss due to passing is not a reliable way to get the true values of moves available.

Additionally, sometimes it is even correct to play a smaller gote move before a bigger gote move. For example, A is +4 for whoever plays, B is +3, and if black plays B there is a followup C that is +2 for whoever plays but if white plays B then there is no followup, and there are no other moves. Then, A is bigger than B, but if it is black's turn, it's correct for black to play B because black will get +3+2 while white gets +4, whereas if black plays A black will get +4 while white gets +3.

For contrast, assume there was an additional move D that was +2 for whoever plays. This time, it's correct for black to play A, the bigger move.

Anyways, consider very carefully how you interpret point differences and move values. It may be more complex than you think. :)

simonguoxm commented 3 months ago

My original idea is for teaching purpose, just show learners that the value of each move will slowly go down naturally, not to find the best step for a game. So even "a crude approximation" should be acceptable too.

Have you read this yet? https://github.com/lightvector/KataGo/blob/master/docs/Analysis_Engine.md If you know how to write code you can do it however you like. If you only kind of know how to code, you can probably get by still by asking your favorite LLM chat agent for coding help.

A major caution is that passing does NOT reveal the value of moves, it is only a crude approximation. For example, if there is an endgame where a move gains 5 points for whoever plays it and another move gains 4 points for whoever plays it, and there are no other endgame moves, then the temperature of the game is 5, yet passing only loses 2 points compared to not passing (If you get +5 and opponent gets +4, it's only 2 points worse than you pass, opponent gets +5, you get +4). So the point loss due to passing is not a reliable way to get the true values of moves available.

Additionally, sometimes it is even correct to play a smaller gote move before a bigger gote move. For example, A is +4 for whoever plays, B is +3, and if black plays B there is a followup C that is +2 for whoever plays but if white plays B then there is no followup, and there are no other moves. Then, A is bigger than B, but if it is black's turn, it's correct for black to play B because black will get +3+2 while white gets +4, whereas if black plays A black will get +4 while white gets +3.

For contrast, assume there was an additional move D that was +2 for whoever plays. This time, it's correct for black to play A, the bigger move.

Anyways, consider very carefully how you interpret point differences and move values. It may be more complex than you think. :)