{"action":"created","issue":{"url":"https://api.github.com/repos/gcp/leela-zero/issues/1599","repository_url":"https://api.github.com/repos/gcp/leela-zero","labels_url":"https://api.github.com/repos/gcp/leela-zero/issues/1599/labels{/name}","comments_url":"https://api.github.com/repos/gcp/leela-zero/issues/1599/comments","events_url":"https://api.github.com/repos/gcp/leela-zero/issues/1599/events","html_url":"https://github.com/gcp/leela-zero/issues/1599","id":337775886,"node_id":"MDU6SXNzdWUzMzc3NzU4ODY=","number":1599,"title":"[Experimental] Dynamical \"komi\" to keep winrate within a certain range","user":{"login":"alreadydone","id":3064145,"node_id":"MDQ6VXNlcjMwNjQxNDU=","avatar_url":"https://avatars0.githubusercontent.com/u/3064145?v=4","gravatar_id":"","url":"https://api.github.com/users/alreadydone","html_url":"https://github.com/alreadydone","followers_url":"https://api.github.com/users/alreadydone/followers","following_url":"https://api.github.com/users/alreadydone/following{/other_user}","gists_url":"https://api.github.com/users/alreadydone/gists{/gist_id}","starred_url":"https://api.github.com/users/alreadydone/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alreadydone/subscriptions","organizations_url":"https://api.github.com/users/alreadydone/orgs","repos_url":"https://api.github.com/users/alreadydone/repos","events_url":"https://api.github.com/users/alreadydone/events{/privacy}","received_events_url":"https://api.github.com/users/alreadydone/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":206,"created_at":"2018-07-03T07:27:23Z","updated_at":"2018-08-29T18:12:13Z","closed_at":null,"author_association":"NONE","body":"A while ago I realized that [the color planes can be used to input komi information to the network](https://github.com/gcp/leela-zero/issues/1576); today I finally have some time to implement the recurring idea of dynamically adjusting komi to keep winrate not too extreme to enhance handicap performance: [Source code](https://github.com/alreadydone/lz/tree/komi), [Diffs](https://github.com/gcp/leela-zero/compare/next...alreadydone:komi?expand=1), and [Windows binary](https://github.com/alreadydone/lz/releases/tag/komi-v0.1).\r\n\r\nThere are three added command line options: --max-wr (adjust komi when white winrate exceeds it), --min-wr (adjust komi when white winrate goes below it), --mid-wr (the ideal white winrate to be maintained). The default is `--max-wr 0.5 --min-wr 0.1 --mid-wr 0.4`. Lowering these numbers will make the engine play more aggressively, but if --min-wr is too low it may play unreasonable moves. Tests and bug reports welcomed!\r\n\r\nI observed that the moves LZ considers indeed become more reasonable when we force the winrate to not be too low by adjusting \"komi\", although the policy is still pretty flat. As far as I can see with my changes LZ plays reasonably even on 9-stone handicap (I don't see any unreasonable 1st/2nd line moves or ladders, but there are tendencies to play in the center or do one-space high approach to 4-4).\r\n\r\nOne great feature of official LZ networks is that white winrate increases monotonically with komi (in all cases I observed, opening or endgame). In contrast @bjiyxo's 20B nets don't exhibit monotonicity. Maybe a lot of training steps are needed to achieve monotonicity (a form of neural net generalization, IMO). **Using color planes for komi can't work for ELF**, since its output is not winrate of the side to move. I haven't tested the Minigo or PhoenixGo weights.\r\n\r\nI introduced a function to clear the cache after each komi change, and [this](https://github.com/gcp/leela-zero/compare/next...alreadydone:komi?expand=1#diff-c56c48893bb7a5b7ffa8bb597772d378R249) is my approach to clear the tree. I don't know whether I am missing something or whether there are better way to do this.\r\n\r\n### Caution\r\n+ Do not use with the ELF weights; official LZ networks recommended.\r\n+ Manually adjusting komi won't precisely achieve the desired effect, since the network hasn't been trained with games in komi other than +/-7.5. I am just exploiting the fact that the winrate decreases with komi to adjust the winrate into a certain range; the winrate will still be inaccurate for komi values other than +/-7.5.\r\n+ In particular, in endgame, the komi that achieves 50-50 winrate isn't necessarily close to the score.\r\n+ This version is designed for handicap games, and the komi doesn't go below 7.5. In the comment below, an \"endgame\" version is provided, allowing komi down to 0.0 and trying to keep winrate between 30-70% with ideal value 50%."},"comment":{"url":"https://api.github.com/repos/gcp/leela-zero/issues/comments/417051274","html_url":"https://github.com/gcp/leela-zero/issues/1599#issuecomment-417051274","issue_url":"https://api.github.com/repos/gcp/leela-zero/issues/1599","id":417051274,"node_id":"MDEyOklzc3VlQ29tbWVudDQxNzA1MTI3NA==","user":{"login":"Marcin1960","id":33654280,"node_id":"MDQ6VXNlcjMzNjU0Mjgw","avatar_url":"https://avatars3.githubusercontent.com/u/33654280?v=4","gravatar_id":"","url":"https://api.github.com/users/Marcin1960","html_url":"https://github.com/Marcin1960","followers_url":"https://api.github.com/users/Marcin1960/followers","following_url":"https://api.github.com/users/Marcin1960/following{/other_user}","gists_url":"https://api.github.com/users/Marcin1960/gists{/gist_id}","starred_url":"https://api.github.com/users/Marcin1960/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Marcin1960/subscriptions","organizations_url":"https://api.github.com/users/Marcin1960/orgs","repos_url":"https://api.github.com/users/Marcin1960/repos","events_url":"https://api.github.com/users/Marcin1960/events{/privacy}","received_events_url":"https://api.github.com/users/Marcin1960/received_events","type":"User","site_admin":false},"created_at":"2018-08-29T18:12:13Z","updated_at":"2018-08-29T18:12:13Z","author_association":"NONE","body":"@alreadydone \"There has been some commits since 0826 and some bugs are fixed in the meantime, so give the latest release a try.\"\r\n\r\nI already merged these changes. :)\r\n\r\n\"(there is a nonslack engine developed by pangafu which seems to work better than mine and works with ELF).\"\r\n\r\nCan you provide the link?\r\n\r\n"}}
{"actor":{"display_login":"Marcin1960"}}