It is currently Fri Apr 19, 2024 8:26 pm

All times are UTC - 8 hours [ DST ]




Post new topic Reply to topic  [ 27 posts ]  Go to page 1, 2  Next
Author Message
Offline
 Post subject: Temperature graphs according to KataGo
Post #1 Posted: Tue Nov 19, 2019 9:13 pm 
Lives in gote

Posts: 586
Location: Adelaide, South Australia
Liked others: 208
Was liked: 265
Rank: Australian 2 dan
GD Posts: 200
It occurred to me that if KataGo can estimate the score, then it can also estimate the temperature. Just evaluate black's best move, then white's best move from the same position, then take the difference. Repeat for every move, and make a graph of the numbers. Here's my attempt at doing that in Python.

For my first test, I just picked the most recent game from GoGoD. If you want to make a game out of it, read through the SGF first, think about what a temperature graph might look like, and then compare your impressions with KataGo's.

SGF game record:


Temperature graph:
Attachment:
2019-10-07a.jpg
2019-10-07a.jpg [ 44.39 KiB | Viewed 8314 times ]
Attachment:
2019-10-07a_temperatures.csv [8.09 KiB]
Downloaded 394 times


My impressions:
First, there's a bunch of spikes which represent sente moves. These can be forcing moves, sente engame sequences, the first moves of 3-move gote endgame sequences, or ko threats.

I was hoping to see a drop for "the last big point of the fuseki", but it looks like there's no such thing in this game. Did I pick an unusual example by accident, or is tedomari not actually a thing in the fuseki? I did spend a bit of time searching for discussions of "the last big move", and found plenty of places where it's mentioned as a concept, but no specific examples where someone said "see, this game here, move 27..."

Between moves 18 and 50 I'm surprised at how flat the graph is. Moves such as black 21, 31 and 39 feel like a local response is urgent, so I might have expected a higher temperature at those moments.

Move 48, I see a weak black group, so maybe things are heating up a bit? The graph says no, not yet. Black 51 is a forcing move that really does need a reply, so we see the temperature jump 7 points at white 52. After white 64, black's corner lives or dies depending on who comes out of the fight with sente, and indeed things stay pretty hot until the trade is settled at move 90.

Big spike at move 116, can't ignore this sort of aggression! But the "baseline temperature" stays low, the situation is easily resolved. White's cut at 124 looks potentially exciting but again isn't a big deal overall. Notice the spike at 127 when the cutting stone is momentarily in atari.

Move 149, being a big ko threat, might provoke a spike in temperature? No, things are already pretty hot on account of the ko.

Move 163 moves to a new area of the board. And indeed 162 is a big drop in temperature.

I was hoping to see a nice series of plateaus and drops as the size of endgame moves goes down. It's not quite as tidy as that, but there's a general downward trend from move 163 onwards, with spikes for sente moves (big atari at 166, threaten to break through at 186; "hane and connect" at 217 which is gote overall, but white can't ignore N19). The big ko threat at 243 stands out.

If I spent as much time actually playing go as tinkering with software, I might start getting good at this game...


Last edited by xela on Tue Nov 19, 2019 9:47 pm, edited 1 time in total.

This post by xela was liked by 2 people: Bill Spight, marvin
Top
 Profile  
 
Offline
 Post subject: Re: Temperature graphs according to KataGo
Post #2 Posted: Tue Nov 19, 2019 9:23 pm 
Lives in gote

Posts: 586
Location: Adelaide, South Australia
Liked others: 208
Was liked: 265
Rank: Australian 2 dan
GD Posts: 200
Example 2: the first game of a match that we've been discussing recently.

SGF game record:

Temperature graph:
Attachment:
2016-03-09a.jpg
2016-03-09a.jpg [ 39.04 KiB | Viewed 8310 times ]
Attachment:
2016-03-09a_temperatures.csv [6.16 KiB]
Downloaded 367 times

Top
 Profile  
 
Offline
 Post subject: Re: Temperature graphs according to KataGo
Post #3 Posted: Tue Nov 19, 2019 9:32 pm 
Lives in gote

Posts: 586
Location: Adelaide, South Australia
Liked others: 208
Was liked: 265
Rank: Australian 2 dan
GD Posts: 200
Same match, game 2

SGF game record:


Temperature graph:
Attachment:
2016-03-10a.jpg
2016-03-10a.jpg [ 38.36 KiB | Viewed 8310 times ]
Attachment:
2016-03-10a_temperatures.csv [6.83 KiB]
Downloaded 397 times

Top
 Profile  
 
Offline
 Post subject: Re: Temperature graphs according to KataGo
Post #4 Posted: Tue Nov 19, 2019 9:36 pm 
Lives in gote

Posts: 586
Location: Adelaide, South Australia
Liked others: 208
Was liked: 265
Rank: Australian 2 dan
GD Posts: 200
I thought I'd look for an older, gentler game to see whether the last big point of the fuseki stands out more clearly.

SGF game record:

My guess:
White 34?

Temperature graph:
My guess was wrong.
Attachment:
1954-07-05a.jpg
1954-07-05a.jpg [ 38.11 KiB | Viewed 8309 times ]
Attachment:
1954-07-05a_temperatures.csv [4.99 KiB]
Downloaded 368 times

Top
 Profile  
 
Offline
 Post subject: Re: Temperature graphs according to KataGo
Post #5 Posted: Tue Nov 19, 2019 9:46 pm 
Lives in gote

Posts: 586
Location: Adelaide, South Australia
Liked others: 208
Was liked: 265
Rank: Australian 2 dan
GD Posts: 200
Last one for today, let's see how much messier an amateur game looks.

SGF game record:


Temperature graph:
Attachment:
2008nationals6-hanysz-ormerod.jpg
2008nationals6-hanysz-ormerod.jpg [ 37.45 KiB | Viewed 8309 times ]
Attachment:
2008nationals6-hanysz-ormerod_temperatures.csv [4.14 KiB]
Downloaded 394 times

Top
 Profile  
 
Offline
 Post subject: Re: Temperature graphs according to KataGo
Post #6 Posted: Tue Nov 19, 2019 11:40 pm 
Judan

Posts: 6725
Location: Cambridge, UK
Liked others: 436
Was liked: 3719
Rank: UK 4 dan
KGS: Uberdude 4d
OGS: Uberdude 7d
Interesting stuff xela. The environmental go game at http://britgo.org/results/env/index.html would be a good candidate for analysis to see how well the players' thoughts on what the temperature was via when they took the points cards corresponds with KataGo.


This post by Uberdude was liked by: xela
Top
 Profile  
 
Offline
 Post subject: Re: Temperature graphs according to KataGo
Post #7 Posted: Tue Nov 19, 2019 11:50 pm 
Gosei
User avatar

Posts: 1758
Liked others: 378
Was liked: 375
Rank: 4d
It's interesting that KataGo judges even the first couple of moves as being worth ~20 points. My understanding was that the value of the first couple of moves was approximately 2x komi, or 13-15 points.

_________________
We don't know who we are; we don't know where we are.
Each of us woke up one moment and here we were in the darkness.
We're nameless things with no memory; no knowledge of what went before,
No understanding of what is now, no knowledge of what will be.

Top
 Profile  
 
Offline
 Post subject: Re: Temperature graphs according to KataGo
Post #8 Posted: Wed Nov 20, 2019 12:39 am 
Honinbo

Posts: 10905
Liked others: 3651
Was liked: 3374
Very interesting. :)

For one thing, your temperature graphs fit my intuition many years ago about the general shape of a go game. Namely that the average size of plays did not drop much until the endgame.

Another thing is that the error bands for the temperature estimates should be quite large. It is true that, in an ideal environment, with perfect play, each player will gain the same by playing first, approximately half as much as the largest gote gains, or as much as the largest reverse sente gains. The difference is approximately the temperature. But in a non-ideal environment, with perfect play the maximum error is equal to the temperature.

I am not sure about KataGo's score estimates, but at first glance at your charts, they seem high. That may be because they estimate the mean score instead of the median. The median result should be about 7 pts., which seems to correct komi, but the estimate appears to be about 10 pts. That's rather high, but large scores for the first player could be jacking up the mean, if that is what is being estimated. And large scores could be the result of the second player making risky plays. I don't know what is going on there, but that may not matter, if the estimates remain proportionally high throughout the game.

A word about sente. Let's assume an ideal environment with a certain temperature, T. Let's also assume a simple sente with a large gote follower. Let the temperature of the follower be 3T. Before the sente is played, we expect the first player to gain T/2. The sente move is played, gaining 3T. Now we expect the first player to gain 3T - T/2 = 2½T. That is, because of he temperature drop after the play in the follower, the gain is more than half the temperature of the follower. In this case the temperature of the sente will be estimated as 5T instead of its actual temperature of 3T. So the temperature of a sente will be systematically overestimated. A better estimate for the temperature of the sente follower is (D+T)/2, where T is the temperature just before the sente and D is the difference between the Black estimate and the White estimate for the follower. Your graphs often show sente spikes over 40. Such large plays are rare. Surely the sente temperatures are being overestimated.

Another thing is Professor Berlekamp's idea of a game temperature distinct from the board temperature. The game temperature never rises. OC, sente plays and extended high temperature fights can raise the board temperature, but eventually the temperature will come back down, perhaps with a resignation. ;) OC, the temperature of sente plays will not show up in the game temperature. I tried eyeballing the game temperatures of your graphs and you could see possible phase changes. Anyway, a game temperature graph eliminates the sente noise. OC, you can add the game temperature to your graphs simply by drawing it as a floor to the rest of the graph. (It will be too low if the players are weak, but at least for pro games, probably not by much.)

_________________
The Adkins Principle:
At some point, doesn't thinking have to go on?
— Winona Adkins

Visualize whirled peas.

Everything with love. Stay safe.


This post by Bill Spight was liked by: xela
Top
 Profile  
 
Offline
 Post subject: Re: Temperature graphs according to KataGo
Post #9 Posted: Wed Nov 20, 2019 1:10 am 
Honinbo

Posts: 10905
Liked others: 3651
Was liked: 3374
About the last big play of the opening or the last big yose

It is true that the last big play of the opening and the last big yose are supposed to be worth getting. That may or may not be so. The value of the last big play at any level of the game depends upon how much the temperature drops after that play. If there is no temperature drop, who cares?

The temperature drop for the last play of the game is typically 1 pt., when it is worth getting. And, OC, it only matters if the game is close. How much is a significant temperature drop?

Well, suppose that the temperature for the first move is 14 pts., and 240 moves later the temperature is 0. The average temperature drop per move is then approximately 0.06 pt. The fact that it is so small is what makes the go board an nearly ideal environment, and why the largest play as traditionally calculated is almost always best. It also means that a temperature drop of 1 pt. at any time in the game is significant. Not that getting the last play before the drop makes the difference between winning and losing, but it might, and it is worth trying to get that last play.

Recently I have discovered a different last play, occupying the last open corner. OC, this happens as a matter of course in a parallel fuseki, but in the Elf commentaries it is usually the right thing to do. There are sometimes plays in the opening that are better, but that is true of any last play situation. How much does occupying the last open corner gain? It depends on the situation, OC, but around 2% seems usual. I am not writing a paper on it yet. In terms of eventual scores, that gain is surely less than 1 pt. on average. I doubt if it would be noticeable in a typical temperature graph. I doubt if the last big play of the opening would be noticeable, either. But that does not mean that it is not worth some effort to get it. Quien sabe?

One thing that I did notice by eyeballing the game temperature in your graphs is that the endgame phase, where temperatures are dropping more rapidly than before, did show up in some graphs. Getting the last play before that phase change could be significant. :)

Edit: Eyeballing the game temperature in your graphs, it is not unusual to see large drops in the game temperature. Getting the last play before those drops could be important. :)

_________________
The Adkins Principle:
At some point, doesn't thinking have to go on?
— Winona Adkins

Visualize whirled peas.

Everything with love. Stay safe.

Top
 Profile  
 
Offline
 Post subject: Re: Temperature graphs according to KataGo
Post #10 Posted: Wed Nov 20, 2019 1:44 am 
Honinbo

Posts: 10905
Liked others: 3651
Was liked: 3374
A note on Berlekamps' Sentestrat strategy

Professor Berlekamp was a kyu player, and I was skeptical of his sentestrat strategy. OC, he was an excellent mathematician, and his point was impeccable. The basic idea is to answer sente plays immediately instead of making an inbetween play that raises the temperature even further. The danger of not answering sente is that raising the temperature further raises your possible loss. Answering sente immediately minimizes your maximum loss. As a 5 dan, I felt that sentestrat was like following your opponent around, which is in general a bad idea. OC, one danger of following your opponent around is answering a gote by mistake. I also had confidence that I would be able to judge when to answer a sente and when to make an inbetween play. I was also aware that pros often get into extended fights at high temperatures.

Looking at your graphs you can see extended periods of play where the temperature drifts up and stays high for quite a while. Did the players foresee who was going to get the last play before the temperature came back down? I kind of doubt it. It struck me that there is a certain wisdom in sentestrat. It relies upon accurately judging whether a play is sente or not, and it is a conservative strategy. Minimizing your maximum loss does not show fighting spirit. But it does have an appeal if you want to preserve a lead. :)

_________________
The Adkins Principle:
At some point, doesn't thinking have to go on?
— Winona Adkins

Visualize whirled peas.

Everything with love. Stay safe.

Top
 Profile  
 
Offline
 Post subject: Re: Temperature graphs according to KataGo
Post #11 Posted: Wed Nov 20, 2019 2:40 am 
Oza
User avatar

Posts: 2411
Location: Ghent, Belgium
Liked others: 359
Was liked: 1019
Rank: KGS 2d OGS 1d Fox 4d
KGS: Artevelde
OGS: Knotwilg
Online playing schedule: UTC 18:00 - 22:00
xela wrote:
If I spent as much time actually playing go as tinkering with software, I might start getting good at this game...


On the other hand, you are more likely to be a world class go analyst than a world class go player. So keep doing us and yourself a favor :)


This post by Knotwilg was liked by 2 people: Bonobo, xela
Top
 Profile  
 
Offline
 Post subject: Re: Temperature graphs according to KataGo
Post #12 Posted: Wed Nov 20, 2019 3:35 am 
Lives in gote

Posts: 586
Location: Adelaide, South Australia
Liked others: 208
Was liked: 265
Rank: Australian 2 dan
GD Posts: 200
Knotwilg wrote:
On the other hand, you are more likely to be a world class go analyst than a world class go player.

Well, perhaps one is less implausible than the other. But more of a meta-analyst really. I'll just make a new tool and see what Bill and others can do with it :-)

Thanks for your kind words.

Top
 Profile  
 
Offline
 Post subject: Re: Temperature graphs according to KataGo
Post #13 Posted: Wed Nov 20, 2019 6:12 am 
Gosei

Posts: 1590
Liked others: 886
Was liked: 528
Rank: AGA 3k Fox 3d
GD Posts: 61
KGS: dfan
These are really interesting, thanks! One thing that would make them easier to compare by eye is to put them all on the same vertical scale, say 0-100, or maybe put horizontal lines at multiples of 20 or something.

Of course all the graphs start at the same value so one can always use that to anchor them.


This post by dfan was liked by: xela
Top
 Profile  
 
Offline
 Post subject: Re: Temperature graphs according to KataGo
Post #14 Posted: Wed Nov 20, 2019 6:13 am 
Lives in sente

Posts: 757
Liked others: 114
Was liked: 916
Rank: maybe 2d
Yeah, I suspect too the estimates are a little high. Given that the score mean estimates the expected score that will be achieved in self-play between the two sides, this probably does mean the neural net is predicting a mild tendency for the side that is behind to do something "risky" and end up on average losing by slightly more than the amount of points that would equalize the game.

SAI will probably do better in this area once it is fully-trained, although I suspect that its use of a sigmoid for modeling winrate vs komi may make it difficult for SAI to understand details like "5.5 komi chinese = 6.5 komi chinese" since a sigmoid may force those two to be different.

In the limit as KataGo grows very very strong, the tendency for the above overestimation might be expected to shrink to 0, but let me think if there's a better way. It's a little tricky, since ideally one would like to still tell the komi to the neural net to allow it to explicitly adapt to knowing whether it's ahead or behind. Hmmm... :)

Top
 Profile  
 
Offline
 Post subject: Re: Temperature graphs according to KataGo
Post #15 Posted: Wed Nov 20, 2019 7:30 am 
Honinbo

Posts: 10905
Liked others: 3651
Was liked: 3374
More on better estimates

I pointed out the problem with using the straightforward difference, which I shall call D0, to estimate the follower of a sente, and suggested an improvement based upon the temperature estimate of the previous play. But as I was going to sleep, that a better estimate comes from looking forward, not back. :)

Assuming best play:

Let D0 be the difference for the current position.
Let D1 be the difference for the next position.
Let T be the temperature estimate for the current position.

Code:
Set T = D0;
If D1 < D0
    Set T = (D0 + D1)/2;


If the current position is sente or ambiguous, then D0 is the best estimate. If the current position is gote, then it is the average of D0 and D1. To see why, consider the last play for Black. If it is a sente, {2*s | 0 || -r}, s > r, then the temperature is r, and D0 = r. If it is a gote, {2*s | 0} then the temperature is s, but D0 = 2*s. Since it is the last play, D1 = 0, and (D0 + D1)/2 = s, which is the correct temperature. :)

(OC, we could do more reading and calculation and come up with better estimates, but that's more work, and ballpark estimates are better than what we have now. :))

So I would suggest this way to make the initial temperature estimates, and to keep track of the game temperature estimate, which is the lowest temperature estimate to date, and graph it, as well. Higher temperatures are in theory temporary, and the drop below the game temperature can be significant information.

Edit: What if Black's last play is a gote with a follower? {2*s | 0 || -r}, s < r. The temperature is (r + s)/2. D1 = 2*s, and I suppose that D0 = r. In this case the formula I gave will overestimate the temperature. When 2*s ≥ r, then T = r, and the overestimate is (r - s)/2. When 2*s < r, then T = (r + 2*s)/2, and the overestimate is s/2. Earlier in the game I suppose that D0 will be closer to the actual temperature and this problem will tend to disappear. That's the theory, anyway. ;) And since the temperature is typically low near the end of play, this systematic overestimate will be small, and we may not care.

I have thought about working backwards, but that assumes correct play to the end, which we cannot do.

_________________
The Adkins Principle:
At some point, doesn't thinking have to go on?
— Winona Adkins

Visualize whirled peas.

Everything with love. Stay safe.


This post by Bill Spight was liked by: xela
Top
 Profile  
 
Offline
 Post subject: Re: Temperature graphs according to KataGo
Post #16 Posted: Wed Nov 20, 2019 8:23 am 
Honinbo

Posts: 10905
Liked others: 3651
Was liked: 3374
lightvector wrote:
In the limit as KataGo grows very very strong, the tendency for the above overestimation might be expected to shrink to 0, but let me think if there's a better way. It's a little tricky, since ideally one would like to still tell the komi to the neural net to allow it to explicitly adapt to knowing whether it's ahead or behind. Hmmm... :)


Well, statistical komi is the median, which may be available during training on millions of positions. I suppose that's more work than just finding the game winner, however.

_________________
The Adkins Principle:
At some point, doesn't thinking have to go on?
— Winona Adkins

Visualize whirled peas.

Everything with love. Stay safe.

Top
 Profile  
 
Offline
 Post subject: Re: Temperature graphs according to KataGo
Post #17 Posted: Wed Nov 20, 2019 2:33 pm 
Lives in gote

Posts: 586
Location: Adelaide, South Australia
Liked others: 208
Was liked: 265
Rank: Australian 2 dan
GD Posts: 200
Thanks for all the suggestions! Bill's and dfan's ideas are easy to implement, but I've got a busy few days ahead of me, so I'm unlikely to post the updated graphs before next week. Of course I've already published the source code, so someone else might leap in and make those changes before I get to it...

Top
 Profile  
 
Offline
 Post subject: Re: Temperature graphs according to KataGo
Post #18 Posted: Wed Nov 27, 2019 5:22 am 
Lives in gote

Posts: 586
Location: Adelaide, South Australia
Liked others: 208
Was liked: 265
Rank: Australian 2 dan
GD Posts: 200
OK, I now have graphs for the Spight Adjusted Temperature Method! The raw_temperature line is the same numbers from the first version, and the adjusted_temperature uses Bill's formula. Game_temperature is just the minimum of all the preceding adjusted temperatures.

Example 1: most recent GoGod game, same as post number 1 in this thread.
Attachment:
2019-10-07a_temperatures.jpg
2019-10-07a_temperatures.jpg [ 95.92 KiB | Viewed 7968 times ]
Attachment:
2019-10-07a_temperatures_adjusted.csv [8.52 KiB]
Downloaded 365 times

Top
 Profile  
 
Offline
 Post subject: Re: Temperature graphs according to KataGo
Post #19 Posted: Wed Nov 27, 2019 5:23 am 
Lives in gote

Posts: 586
Location: Adelaide, South Australia
Liked others: 208
Was liked: 265
Rank: Australian 2 dan
GD Posts: 200
Example 2: AlphaGo-Lee Sedol game 1, post number 2 above
Attachment:
2016-03-09a_temperatures.jpg
2016-03-09a_temperatures.jpg [ 91.88 KiB | Viewed 7967 times ]
Attachment:
2016-03-09a_temperatures_adjusted.csv [6.55 KiB]
Downloaded 419 times

This three attachments per post limit is getting a bit annoying...

Top
 Profile  
 
Offline
 Post subject: Re: Temperature graphs according to KataGo
Post #20 Posted: Wed Nov 27, 2019 5:24 am 
Lives in gote

Posts: 586
Location: Adelaide, South Australia
Liked others: 208
Was liked: 265
Rank: Australian 2 dan
GD Posts: 200
Example 3: you can probably guess which game...
Attachment:
2016-03-10a_temperatures.jpg
2016-03-10a_temperatures.jpg [ 84.87 KiB | Viewed 7967 times ]
Attachment:
2016-03-10a_temperatures_adjusted.csv [7.31 KiB]
Downloaded 383 times

Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 27 posts ]  Go to page 1, 2  Next

All times are UTC - 8 hours [ DST ]


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group