Laskas parameter optimizer

Discussion of anything and everything relating to chess playing software and machines.

Moderator: Ras

Ferdy
Posts: 4848
Joined: Sun Aug 10, 2008 3:15 pm
Location: Philippines

Re: Laskas parameter optimizer

Post by Ferdy »

Current v0.32.1 supports categorical param values, for example from Lc0,

Code: Select all

option name MultiGather type check default false

Code: Select all

--input-param "{'MultiGather': ['false', 'true']}"
or even from continuous param,

Code: Select all

option name MaxCollisionEvents type spin default 32 min 1 max 65536

Code: Select all

--input-param "{'MaxCollisionEvents': [32, 2, 4, 8, 16, 64]}"
The first value in the list [32, 2, 4, 8, 16, 64] which is 32 should be the default value from MaxCollisionEvents type spin default 32. Same for MultiGather with false default value.

Example batch file example2.bat

Code: Select all

:: Using categorical param values.
:: --bo-utility-kappa 0.001 (exploit)
:: Using --nodes 5000

set engine=E:\Chess\Engines\Lc0\lc0-v0.27.0-rc2-windows-gpu-nvidia-cudnn\lc0.exe

python lakas.py --cutechess-debug --concurrency 1 --optimizer bayesopt --bo-utility-kind ucb --bo-utility-kappa 0.001 --use-best-param --best-result-threshold 0.60 --output-data-file ex2_ucb.dat --input-data-file ex2_ucb.dat --optimizer-log-file ex2_ucb_plot.txt --nodes 5000 --budget 100 --games-per-budget 24 --engine %engine% --input-param "{'MultiGather': ['false', 'true'], 'HistoryFill': ['fen_only', 'no', 'always'], 'MaxCollisionEvents': [32, 2, 4, 8, 16, 64], 'MaxCollisionVisits': {'init':9999, 'lower':8000, 'upper':12000}}" --opening-file ./start_opening/ogpt_chess_startpos.epd --opening-file-format epd


pause
Log

Code: Select all

2021-02-19 20:51:32,660 | INFO  | Lakas v0.32.1
2021-02-19 20:51:32,680 | INFO  | input param: OrderedDict([('HistoryFill', ['fen_only', 'no', 'always']), ('MaxCollisionEvents', [32, 2, 4, 8, 16, 64]), ('MaxCollisionVisits', {'init': 9999, 'lower': 8000, 'upper': 12000}), ('MultiGather', ['false', 'true'])])

2021-02-19 20:51:32,680 | INFO  | total budget: 100
2021-02-19 20:51:32,680 | INFO  | games/budget: 24
2021-02-19 20:51:32,681 | INFO  | move control: base_time_sec: None, inc_time_sec: None, depth=None, nodes=5000
2021-02-19 20:51:32,682 | INFO  | parameter dimension: 12
2021-02-19 20:51:32,682 | INFO  | deterministic function: False
2021-02-19 20:51:32,683 | INFO  | use best param: True
2021-02-19 20:51:32,683 | INFO  | best result threshold: 0.6
2021-02-19 20:51:32,683 | INFO  | optimizer: bayesopt, initialization: Hammersley, init_budget: None, middle_point: False, utility_kind: ucb, utility_kappa: 0.001, utility_xi: 0.0, gp_parameters: {'alpha': 0.001, 'normalize_y': True, 'n_restarts_optimizer': 5, 'random_state': None}

2021-02-19 20:51:32,702 | INFO  | budget: 1
2021-02-19 20:51:32,703 | INFO  | recommended param: {'HistoryFill': 'always', 'MaxCollisionEvents': 2, 'MaxCollisionVisits': 9151, 'MultiGather': 'true'}
2021-02-19 20:51:32,703 | INFO  | best param: {'HistoryFill': 'fen_only', 'MaxCollisionEvents': 32, 'MaxCollisionVisits': 9999, 'MultiGather': 'false'}
2021-02-19 20:51:32,703 | INFO  | best loss: 0.4
2021-02-19 20:51:32,703 | INFO  | init param: {'HistoryFill': 'fen_only', 'MaxCollisionEvents': 32, 'MaxCollisionVisits': 9999, 'MultiGather': 'false'}
2021-02-19 20:51:32,704 | INFO  | recommended vs best
2021-02-19 20:59:54,122 | INFO  | actual result: 0.47917 @24 games, minimized result or loss: 0.52083, point of view: recommended

2021-02-19 20:59:54,132 | INFO  | budget: 2
2021-02-19 20:59:54,132 | INFO  | recommended param: {'HistoryFill': 'always', 'MaxCollisionEvents': 64, 'MaxCollisionVisits': 9654, 'MultiGather': 'true'}
2021-02-19 20:59:54,133 | INFO  | best param: {'HistoryFill': 'fen_only', 'MaxCollisionEvents': 32, 'MaxCollisionVisits': 9999, 'MultiGather': 'false'}
2021-02-19 20:59:54,133 | INFO  | best loss: 0.4
2021-02-19 20:59:54,133 | INFO  | init param: {'HistoryFill': 'fen_only', 'MaxCollisionEvents': 32, 'MaxCollisionVisits': 9999, 'MultiGather': 'false'}
2021-02-19 20:59:54,133 | INFO  | recommended vs best
2021-02-19 21:06:36,578 | INFO  | actual result: 0.52083 @24 games, minimized result or loss: 0.47917, point of view: recommended

2021-02-19 21:06:36,591 | INFO  | budget: 3
2021-02-19 21:06:36,591 | INFO  | recommended param: {'HistoryFill': 'no', 'MaxCollisionEvents': 8, 'MaxCollisionVisits': 10622, 'MultiGather': 'true'}
2021-02-19 21:06:36,591 | INFO  | best param: {'HistoryFill': 'fen_only', 'MaxCollisionEvents': 32, 'MaxCollisionVisits': 9999, 'MultiGather': 'false'}
2021-02-19 21:06:36,592 | INFO  | best loss: 0.4
2021-02-19 21:06:36,592 | INFO  | init param: {'HistoryFill': 'fen_only', 'MaxCollisionEvents': 32, 'MaxCollisionVisits': 9999, 'MultiGather': 'false'}
2021-02-19 21:06:36,592 | INFO  | recommended vs best
2021-02-19 21:14:35,531 | INFO  | actual result: 0.50000 @24 games, minimized result or loss: 0.50000, point of view: recommended

...
With --cutechess-debug flag, cutechess debug will be saved in match_lakas.txt.

2021-02-19 20:51:35,056 | 1088 | INFO | 1583 >test(0): setoption name HistoryFill value always
2021-02-19 20:51:35,056 | 1088 | INFO | 1583 >test(0): setoption name MaxCollisionEvents value 2
2021-02-19 20:51:35,056 | 1088 | INFO | 1583 >test(0): setoption name MaxCollisionVisits value 9151
2021-02-19 20:51:35,056 | 1088 | INFO | 1583 >test(0): setoption name MultiGather value true
2021-02-19 20:51:35,057 | 1088 | INFO | 1583 >test(0): isready
2021-02-19 20:51:35,057 | 1088 | INFO | 1583 <test(0): readyok
2021-02-19 20:51:35,057 | 1088 | INFO | Started game 1 of 24 (test vs base)
2021-02-19 20:51:35,057 | 1088 | INFO | 1583 >test(0): ucinewgame
2021-02-19 20:51:35,057 | 1088 | INFO | 1584 >test(0): setoption name Ponder value false
2021-02-19 20:51:35,057 | 1088 | INFO | 1584 >test(0): position fen r1b1r1k1/pppp1ppp/2n5/6B1/2PPq1n1/2P2N2/P3BPPP/R2QK2R b KQ - 0 1
2021-02-19 20:51:35,057 | 1088 | INFO | 1584 >base(1): ucinewgame
2021-02-19 20:51:35,057 | 1088 | INFO | 1584 >base(1): setoption name Ponder value false
2021-02-19 20:51:35,057 | 1088 | INFO | 1584 >base(1): position fen r1b1r1k1/pppp1ppp/2n5/6B1/2PPq1n1/2P2N2/P3BPPP/R2QK2R b KQ - 0 1
2021-02-19 20:51:35,057 | 1088 | INFO | 1584 >base(1): isready
2021-02-19 20:51:41,225 | 1088 | INFO | 7751 <base(1): readyok
2021-02-19 20:51:41,225 | 1088 | INFO | 7751 >base(1): go nodes 5000
2021-02-19 20:51:41,246 | 1088 | INFO | 7772 <base(1): info depth 1 seldepth 2 time 20 nodes 3 score cp 23 nps 428 tbhits 0 pv d7d6 h2h3
2021-02-19 20:51:41,248 | 1088 | INFO | 7775 <base(1): info depth 2 seldepth 3 time 23 nodes 6 score cp 22 nps 600 tbhits 0 pv h7h6 g5h4 d7d6
2021-02-19 20:51:41,251 | 1088 | INFO | 7777 <base(1): info depth 3 seldepth 4 time 25 nodes 14 score cp 29 nps 1166 tbhits 0 pv h7h6 g5c1 b7b6 h2h3
2021-02-19 20:51:41,253 | 1088 | INFO | 7779 <base(1): info depth 3 seldepth 5 time 28 nodes 42 score cp 30 nps 2800 tbhits 0 pv h7h6 g5h4 c6a5 h2h3 g4f6
2021-02-19 20:51:41,255 | 1088 | INFO | 7782 <base(1): info depth 4 seldepth 6 time 30 nodes 66 score cp 28 nps 3882 tbhits 0 pv h7h6 g5h4 c6a5 h2h3 g4f6 h4f6
2021-02-19 20:51:41,258 | 1088 | INFO | 7784 <base(1): info depth 4 seldepth 7 time 32 nodes 89 score cp 28 nps 4684 tbhits 0 pv h7h6 g5h4 c6a5 e1f1 d7d6 h2h3 g4f6
2021-02-19 20:51:41,262 | 1088 | INFO | 7788 <base(1): info depth 4 seldepth 8 time 36 nodes 115 score cp 25 nps 5000 tbhits 0 pv h7h6 g5h4 d7d6 h2h3 g4f6 h4f6 g7f6 e1f1
2021-02-19 20:51:41,266 | 1088 | INFO | 7793 <base(1): info depth 5 seldepth 9 time 41 nodes 161 score cp 23 nps 5750 tbhits 0 pv h7h6 g5h4 d7d6 h2h3 g4f6 h4f6 g7f6 e1f1 c8f5
2021-02-19 20:51:41,270 | 1088 | INFO | 7797 <base(1): info depth 5 seldepth 10 time 45 nodes 213 score cp 19 nps 6656 tbhits 0 pv h7h6 g5h4 d7d6 h2h3 g4f6 h4f6 g7f6 e1f1 c8f5
2021-02-19 20:51:41,275 | 1088 | INFO | 7801 <base(1): info depth 5 seldepth 11 time 49 nodes 239 score cp 17 nps 6638 tbhits 0 pv h7h6 g5h4 d7d6 h2h3 g4f6 h4f6 g7f6 e1f1 c8f5 d1d2
2021-02-19 20:51:41,291 | 1088 | INFO | 7818 <base(1): info depth 6 seldepth 11 time 66 nodes 403 score cp 14 nps 7603 tbhits 0 pv h7h6 h2h3 g4f2 e1f2 h6g5 d1d2 e4f4 d2f4 g5f4 a1e1 d7d6
2021-02-19 20:51:41,293 | 1088 | INFO | 7821 <base(1): info depth 6 seldepth 12 time 69 nodes 436 score cp 16 nps 7785 tbhits 0 pv h7h6 g5h4 d7d6 h2h3 g4f6 h4f6 g7f6 e1f1 c8f5 f3e1 c6a5
2021-02-19 20:51:41,304 | 1088 | INFO | 7832 <base(1): info depth 6 seldepth 13 time 80 nodes 568 score cp 13 nps 8477 tbhits 0 pv h7h6 g5h4 b7b6 e1f1 c8a6 f3d2 g4e3 f2e3
2021-02-19 20:51:41,312 | 1088 | INFO | 7839 <base(1): info depth 6 seldepth 14 time 87 nodes 671 score cp 11 nps 9067 tbhits 0 pv h7h6 g5h4 d7d6 h2h3 g4f6 h4f6 g7f6 e1f1 c8f5 d1d2 g8g7 a1e1 c6a5 f1g1
2021-02-19 20:51:41,317 | 1088 | INFO | 7844 <base(1): info depth 7 seldepth 14 time 92 nodes 759 score cp 9 nps 9607 tbhits 0 pv h7h6 g5h4 d7d6 h2h3 g4f6 h4f6 g7f6 e1f1 c8f5 d1d2 g8g7 a1e1 c6a5 f1g1
2021-02-19 20:51:41,329 | 1088 | INFO | 7857 <base(1): info depth 7 seldepth 15 time 105 nodes 939 score cp 7 nps 10206 tbhits 0 pv h7h6 g5h4 d7d6 h2h3 g4f6 h4f6 g7f6 e1f1 c8f5 f3e1 c6a5 e2d3 e4e6 d4d5 e6e5
2021-02-19 20:51:41,339 | 1088 | INFO | 7867 <base(1): info depth 7 seldepth 16 time 115 nodes 1124 score cp 7 nps 11019 tbhits 0 pv h7h6 g5h4 d7d6 h2h3 g4f6 h4f6 g7f6 e1f1 c8f5 f3e1 c6a5 e2d3 e4e6 d4d5 f5d3 d1d3
2021-02-19 20:51:41,365 | 1088 | INFO | 7893 <base(1): info depth 8 seldepth 16 time 141 nodes 1685 score cp 4 nps 13164 tbhits 0 pv h7h6 g5h4 d7d6 h2h3 g4f6 h4f6 g7f6 e1f1 c8f5 f3e1 c6a5 e2d3 e4e6 d4d5 f5d3 d1d3
2021-02-19 20:51:41,368 | 1088 | INFO | 7895 <base(1): info depth 8 seldepth 17 time 143 nodes 1744 score cp 4 nps 13415 tbhits 0 pv h7h6 g5h4 d7d6 h2h3 g4f6 h4f6 g7f6 e1f1 c8f5 f3e1 c6a5 e2d3 e4e6 d4d5 f5d3 e1d3 e6e4
2021-02-19 20:51:41,383 | 1088 | INFO | 7910 <base(1): info depth 8 seldepth 18 time 159 nodes 2007 score cp 3 nps 13841 tbhits 0 pv h7h6 g5h4 d7d6 h2h3 g4f6 h4f6 g7f6 e1f1 c8f5 f3e1 c6a5 e2d3 e4e6 d4d5 f5d3 e1d3 e6e4
2021-02-19 20:51:41,396 | 1088 | INFO | 7924 <base(1): info depth 8 seldepth 19 time 172 nodes 2290 score cp 3 nps 14402 tbhits 0 pv h7h6 g5h4 d7d6 h2h3 g4f6 h4f6 g7f6 e1f1 c8f5 f3d2 e4c2 d1c2 f5c2 h3h4 e8e7 a1c1 a8e8 e2f3
2021-02-19 20:51:41,407 | 1088 | INFO | 7934 <base(1): info depth 9 seldepth 20 time 182 nodes 2485 score cp 2 nps 14704 tbhits 0 pv h7h6 g5h4 d7d6 h2h3 g4f6 h4f6 g7f6 e1f1 c8f5 f3d2 e4c2 d1c2 f5c2 h3h4 e8e7 h1h3 a8e8 e2d3 c2d3 h3d3
2021-02-19 20:51:41,424 | 1088 | INFO | 7951 <base(1): info depth 9 seldepth 21 time 199 nodes 2802 score cp 2 nps 15064 tbhits 0 pv h7h6 g5h4 d7d6 h2h3 g4f6 h4f6 g7f6 e1f1 c8f5 f3d2 e4c2 d1c2 f5c2 h3h4 e8e7 h1h3 a8e8 e2d3 c2d3 h3d3 e7e2
2021-02-19 20:51:41,463 | 1088 | INFO | 7990 <base(1): info depth 9 seldepth 22 time 238 nodes 3488 score cp 1 nps 15502 tbhits 0 pv h7h6 g5h4 d7d6 h2h3 g4f6 h4f6 g7f6 e1f1 c8f5 f3d2 e4c2 d1c2 f5c2 h3h4 e8e7 h1h3 a8e8 e2d3 c2d3 h3d3 c6a5 d3f3
2021-02-19 20:51:41,492 | 1088 | INFO | 8019 <base(1): info depth 9 seldepth 23 time 267 nodes 4117 score cp 0 nps 16208 tbhits 0 pv h7h6 g5h4 d7d6 h2h3 g4f6 h4f6 g7f6 e1f1 c8f5 f3d2 e4c2 d1c2 f5c2 h3h4 e8e7 h1h3 a8e8 e2d3 c2d3 h3d3 e7e2 a1b1 b7b6
2021-02-19 20:51:41,494 | 1088 | INFO | 8021 <base(1): info depth 10 seldepth 23 time 269 nodes 4184 score cp 0 nps 16343 tbhits 0 pv h7h6 g5h4 d7d6 h2h3 g4f6 h4f6 g7f6 e1f1 c8f5 f3d2 e4c2 d1c2 f5c2 h3h4 e8e7 h1h3 a8e8 e2d3 c2d3 h3d3 e7e2 a1b1 b7b6
2021-02-19 20:51:41,512 | 1088 | INFO | 8039 <base(1): info depth 10 seldepth 23 time 287 nodes 4491 score cp 0 nps 16390 tbhits 0 pv h7h6 g5h4 d7d6 h2h3 g4f6 h4f6 g7f6 e1f1 c8f5 f3d2 e4c2 d1c2 f5c2 h3h4 e8e7 h1h3 a8e8 e2d3 c2d3 h3d3 e7e2 a1b1 b7b6
2021-02-19 20:51:41,513 | 1088 | INFO | 8041 <base(1): bestmove h7h6 ponder g5h4

Current version also supports --move-time-ms option.