pasky / pachi

A fairly strong Go/Baduk/Weiqi playing program
http://pachi.or.cz/
GNU General Public License v2.0
506 stars 117 forks source link

MM Patterns #81

Closed lemonsqueeze closed 5 years ago

lemonsqueeze commented 6 years ago

This is the mm branch i've been playing with for a while to replace large patterns. Not 100% ready yet but looks like it's getting there =)

Nice thing with it:

At first i stayed pretty close to Rémi's paper and got about same results (prediction rate slighly lower, might have been a bug on my part, but i was missing mcowner feature also). Then i started experimenting with special features to fix simple tactical blunders which occur at low playouts. Things like double atari, atari + capture next etc. I have a few examples of these and was curious if having good priors in the tree would fix it. Of course they don't show up much in the 6d games used for training, so mm tool doesn't give them a very high gamma, but nothing prevents us from making it huge afterwards =)

Turns out it works really well if feature code and gamma are chosen carefully. Mistakes get punished quickly in the tree and it starts looking elsewhere. Another thing i tried is to decouple some features that interfere with each other so only one matches ('prioritized' features in the code). MM can't take into account the interaction between features but we can choose which ones to let through. For example play is mostly non-local during ko fight, so it makes no sense to match distance feature if capture:take_ko also matches. I guess next step would be to use LFR instead, should make this logic unnecessary iiuc. In the meantime, it works pretty well.

Haven't play-tested this thing very much yet. I suspect it might benefit from some prior tuning. At least right now at low playouts it doesn't look worse when it plays online:

There's a million commits in the original branch so for now i just squashed everything into one giant commit. Will see about making it more digestible...

lemonsqueeze commented 5 years ago

Some 13x13 play-testing, taking 2 stones against Hira 10_36H (1k level):

pachi -t =5000:
Confidence level: 95%
 221 13-h2-2-hira_1k-pachi5k_large_pat  26% [20%-31%]           [--|-]
 338 13-h2-2-hira_1k-pachi5k_mmbasic    38% [33%-43%]                 [--|-]
 312 13-h2-2-hira_1k-pachi5k_mm9        43% [37%-48%]                   [--|--]
 291 13-h2-2-hira_1k-pachi5k_mm10       45% [39%-50%]                    [--|--]
pachi -t =5000:15000:
Confidence level: 95%
 399 13-h2-2-hira_1k-pachi_large_pat    55% [51%-60%]                          [-|--]
 327 13-h2-2-hira_1k-pachi_mm9          64% [59%-69%]                              [--|-]
 364 13-h2-2-hira_1k-pachi_mm10         65% [60%-70%]                               [-|--]

large_pat: pachi with large patterns setup, before mm branch (#80) mmbasic: 0107231 basic features mm9: bcdca69 tenuki patch mm10: 67c6ba3 tactical features fixes

lemonsqueeze commented 5 years ago

Predict stats:

Predictions by move number: (short)
  move   0-29 : 2551/8675 (29%) *****************************
  move  30-59 : 2755/8912 (30%) ******************************
  move  60-89 : 2712/8500 (31%) *******************************
  move  90-119: 2564/8108 (31%) *******************************
  move 120-149: 2295/7457 (30%) ******************************
  move 150-179: 1901/6223 (30%) ******************************
  move 180-209: 1514/4760 (31%) *******************************
  move 210-239: 1040/3330 (31%) *******************************
  move 240-269:  647/1983 (32%) ********************************
  move 270-299:  325/878  (37%) *************************************

Topn stats: (Games: 300)
Predicted   : 18436/59200 moves (31%)  ***********************
  in best  2: 26051/59200 moves (44%)  *********************************
  in best  3: 30649/59200 moves (51%)  **************************************
  in best  4: 33966/59200 moves (57%)  ******************************************
  in best  5: 36397/59200 moves (61%)  *********************************************
  in best  6: 38215/59200 moves (64%)  ************************************************
  in best  7: 39759/59200 moves (67%)  **************************************************
  in best  8: 41067/59200 moves (69%)  ***************************************************
  in best  9: 42220/59200 moves (71%)  *****************************************************
  in best 10: 43249/59200 moves (73%)  ******************************************************
  in best 11: 44215/59200 moves (74%)  *******************************************************
  in best 12: 44991/59200 moves (75%)  ********************************************************
  in best 13: 45733/59200 moves (77%)  *********************************************************
  in best 14: 46433/59200 moves (78%)  **********************************************************
  in best 15: 47012/59200 moves (79%)  ***********************************************************
  in best 16: 47599/59200 moves (80%)  ************************************************************
  in best 17: 48107/59200 moves (81%)  ************************************************************
  in best 18: 48574/59200 moves (82%)  *************************************************************
  in best 19: 49026/59200 moves (82%)  *************************************************************
  in best 20: 49490/59200 moves (83%)  **************************************************************