aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortslil <tslil@posteo.de>2026-09-17 07:01:29 +0100
committertslil <tslil@posteo.de>2026-09-18 15:12:19 +0100
commit0dba02072e9a89e35885d9078c0c8b58956448ce (patch)
tree90752b70ad25f1ccc5d48660660fe1ee223a02f2
parent1898add0142b70b3fef5af78a6f3d7399a3f2cd5 (diff)
working towards hybrid rootstrap
-rw-r--r--Makefile6
-rw-r--r--include/weights_5.c550
-rwxr-xr-xsrc/nn_train.py456
-rw-r--r--src/selfplay.c38
4 files changed, 579 insertions, 471 deletions
diff --git a/Makefile b/Makefile
index d6ca030..f254d97 100644
--- a/Makefile
+++ b/Makefile
@@ -34,8 +34,10 @@ native: ctlm cttei geminict
cand_a = $(word 1,$(subst -, ,$1))
cand_b = $(word 2,$(subst -, ,$1))
-.PHONY: selfplay-%
-selfplay-%:
+# .PHONY on the pattern alone does not force the recipe when the binary
+# already exists; the FORCE prerequisite does
+.PHONY: selfplay-% FORCE
+selfplay-%: FORCE
rm -f selfplay-%
rm -f src/*.o include/negamax.o include/pv.o include/tt.o
$(MAKE) SELFPLAY_OUT=$@ \
diff --git a/include/weights_5.c b/include/weights_5.c
index 588bf39..cbe5b53 100644
--- a/include/weights_5.c
+++ b/include/weights_5.c
@@ -1,297 +1,297 @@
/* generated by nn_train.py, do not edit by hand */
-/* iter=16, perf=+1524-1144=0332, rate=50.800 */
+/* iter=20, perf=+4837-2263=1700, rate=54.966 */
#ifndef WEIGHTS_FIVE
#define WEIGHTS_FIVE
#include "weights_5.h"
const float FIVE_embedding[7] =
{
- -0.184489027, -0.881782293, -0.451349735, -1.67686057, 0.554752886, 0.134153381, 1.468413
+ 0.0740088075, 1.24314356, 0.470590502, 1.9706943, -1.07658768, -0.110831268, -1.71863568
};
const float FIVE_dense_weights[FIVE_DENSE_NUM][FIVE_INP_NUM] NN_ALIGNED =
{
- {0.284560204, -0.419221222, 0.0328785852, 0.0813829675, 0.062259119, -0.0298566222, 0.0868502334, 0.129749909,
- 0.061135117, 0.0289993435, 0.165124103, 0.0191279501, 0.119712554, 0.0654717833, 0.060883034, -0.0114311464,
- 0.0400502011, 0.125673741, -0.0253371838, 0.0343324058, 0.0674481317, 0.182863027, -0.000346275134, -0.046321664,
- -0.0684036091, -0.050165683, -0.0875314176},
- {0.557323396, -0.131285638, -0.00802773703, -0.0321692415, -0.0971636176, -0.129316717, -0.104541615, -0.0400036201,
- -0.0320871621, 0.153581247, 0.114309713, 0.0890527517, 0.0316198133, -0.0229616798, 0.14933382, 0.195180729,
- 0.249423265, 0.020841103, -0.0592732914, 0.207456321, 0.16428718, 0.146135718, -0.0290612206, 0.0310738813,
- 0.175313443, 0.015554796, 0.00685921684},
- {0.383892566, -0.652790248, 0.108174205, 0.052967187, -0.0209764447, -0.0449645892, 0.151071727, 0.12525484,
- 0.135253966, -0.0870055631, -0.000694841088, 0.21838361, 0.0577249229, 0.20536311, -0.0258124657, -0.00405113585,
- 0.172642723, 0.0511332266, -0.00440308684, -0.0891218409, 0.0797435567, 0.0441572592, 0.0123149427, 0.0641523153,
- -0.145321563, -0.0181931965, 0.112535395},
- {-0.321058869, 0.204980388, -0.158239529, -0.163409308, -0.0633437783, -0.0415460616, -0.111264043, -0.0860894248,
- -0.202470213, -0.127226472, -0.0682562441, -0.110807009, -0.0804939792, -0.0131067969, -0.0590415262, 0.0276197419,
- -0.0784899369, 0.0302416515, -0.115167312, -0.0687930882, -0.0782043934, -0.167902917, -0.0995951965, -0.123959467,
- -0.0320122093, -0.0741118416, -0.18941617},
- {0.285745829, -0.100696772, 0.0657228455, 0.054573264, -0.101030931, 0.00427212659, -0.120137095, 0.0141248768,
- 0.0804607868, 0.100518562, -0.0138845397, 0.146215662, -0.08813674, -0.111878015, 0.0697537139, 0.0961741731,
- 0.197733656, -0.0838146284, 0.062217541, 0.000224303236, 0.228632852, 0.202914849, -0.0371545106, 0.00908992253,
- 0.163213357, 0.0751332939, 0.0327892676},
- {0.236844257, -0.512373924, 0.180812642, 0.0511930324, 0.0369419679, 0.118528575, 0.154989898, 0.0510200299,
- 0.106902733, 0.100861102, -0.0328107998, 0.086315535, 0.108647995, -0.0103859995, 0.104650848, -0.0242383704,
- -0.120366439, 0.108360156, 0.125119567, -0.00536804367, 0.062428806, -0.120536663, 0.14099215, 0.11179845,
- 0.0238136724, 0.119725138, -0.00515279267},
- {-0.946322918, -3.22145653, 0.30281207, 0.117794693, 0.13724938, 0.165796727, 0.244443521, 0.0749714077,
- -0.01591493, 0.173956037, -0.0204820745, 0.13026914, 0.0951825455, 0.00769977644, -0.0638609529, -0.0396789536,
- 0.130962491, 0.162444413, -0.0861478299, -0.047466971, 0.00670953514, 0.0636076257, 0.144687831, 0.144147187,
- 0.146003932, 0.0889518335, 0.150284842},
- {0.47046724, -0.488577843, -0.00988451764, 0.0260628946, -0.042511452, 0.0019026529, 0.107701562, 0.0772359297,
- -0.00852318201, -0.0811612159, 0.144580677, 0.147175536, 0.127442032, 0.076110594, -0.0703185946, 0.104386829,
- 0.120601349, -0.0195855536, 0.127387717, -0.119516514, -0.0093170628, -0.0398560725, 0.0235036444, 0.0744361356,
- -0.0965498984, 0.215383336, 0.0369071886},
- {-0.315617114, 0.151083708, -0.236110866, 0.0541519076, -0.0586371385, -0.136375204, -0.136796817, -0.0939740464,
- -0.039566949, -0.0402120836, -0.167311549, -0.0361223742, 0.0965963304, -0.185001165, 0.0382073522, -0.198193386,
- -0.108078822, -0.149277613, -0.115774535, -0.0326297618, -0.177266553, -0.0672949925, -0.148439199, 0.00843375176,
- -0.154945508, -0.0343751274, -0.0915465504},
- {-0.359880298, 0.314251602, -0.248112842, -0.096442394, -0.199134201, -0.137287632, -0.193692222, -0.058614891,
- -0.17952916, -0.065772213, -0.135623157, -0.0176453143, -0.0884096175, -0.0420794897, -0.0834076777, -0.0264618248,
- -0.200602546, -0.219354019, -0.183864295, -0.152532309, -0.124429226, -0.113392331, -0.00583864795, -0.160228282,
- -0.192600206, -0.130000398, -0.0963087678},
- {0.492462426, -0.294776499, -0.0668389648, 0.0232893713, 0.0713843554, -0.0417174511, 0.0813100636, 0.060909383,
- -0.0129402354, -0.0581903867, -0.0839913487, -0.0243335404, -0.052235093, -0.0222961027, 0.00917301793, 0.143684506,
- 0.00629981421, 0.0016236821, 0.0367625207, 0.0768950805, 0.0595415197, 0.195975393, -0.000282914611, -0.0298003592,
- 0.00434705382, 0.102033503, 0.112813391},
- {0.302839458, -0.502133846, 0.0983253345, 0.142431617, 0.203259692, 0.0236698892, 0.0856857076, 0.185378432,
- -0.00270775147, 0.0869711712, 0.0876712427, -0.0532260053, 0.0954493135, -0.0677271187, -0.0224150065, -0.0122775119,
- 0.0964757502, 0.0256153494, 0.0735723004, 0.0925729051, -0.0251201354, -0.051896017, 0.137042195, 0.183832392,
- -0.0736333877, 0.0174380112, 0.0986182541},
- {0.279993922, -0.13733831, 0.0617952645, -0.00253660837, 0.0270908661, 0.0524471402, -0.0400253981, 0.0419185534,
- 0.0192263611, -0.0510118119, 0.150818914, -0.0552226193, 0.0921702534, 0.0852532014, 0.158899799, 0.155513063,
- 0.17161037, 0.0238623396, -0.000968565699, 0.151265129, 0.130730301, -0.0379284061, 0.0972820967, -0.0399085209,
- 0.125809953, 0.171116307, 0.171346337},
- {-0.119764067, -1.35013366, 0.137646064, 0.0229721498, -0.0518602207, 0.0595485531, 0.153518945, -0.0200147927,
- 0.0999138281, -0.0284581035, 0.0159708057, -0.00420651259, 0.0410806611, 0.00428301981, -0.142613709, -0.0172457006,
- 0.0774680674, 0.117800258, 0.103139229, -0.0483194515, 0.035018608, 0.0693995804, 0.326715618, 0.0704217926,
- 0.191451311, 0.0998271033, 0.278734833},
- {-0.13475579, 0.324588686, -0.0925333947, -0.21291995, -0.000704998616, -0.0777914375, -0.0142197628, -0.0189588703,
- -0.089525573, -0.210839808, 0.0366633944, -0.239989728, -0.142792344, -0.166696861, -0.178795457, -0.182961404,
- -0.195784569, 0.0277741738, 0.0540008582, 0.00355652953, -0.0691932365, -0.0908621028, -0.09514191, -0.0227588397,
- -0.15823321, -0.0496945605, 0.00878029503},
- {-0.32498163, 0.497707099, 0.0281655882, -0.262365252, -0.265070498, -0.148149252, 0.0119146137, 0.00372263882,
- -0.113256313, -0.197625041, -0.218658969, -0.010111589, -0.124027781, -0.106711388, -0.220779508, -0.22598207,
- -0.203461275, -0.0945060626, -0.140289873, -0.175047383, -0.0757920891, -0.0764472708, -0.155023172, -0.153385833,
- -0.146838337, -0.08800143, -0.100332782},
- {0.0415623337, 0.528801262, 0.0799510106, 0.0957512632, 0.029891748, 0.0954739153, 0.206784412, 0.00290193269,
- 0.107724555, -0.138024077, -0.021738831, -0.0587063506, -0.0958752558, -0.0945331901, -0.256397426, 0.0457332842,
- -0.0968584493, 0.0945529342, -0.123311169, 0.0795145705, -0.0348570198, 0.199274316, 0.0963696465, 0.0014782761,
- 0.0442242362, -0.127259344, 0.0209389944},
- {-0.144642189, 0.258335918, -0.122986697, 0.00131682027, -0.0469562337, -0.0738089308, -0.0318803042, -0.112096235,
- -0.169825017, -0.151172772, -0.141715109, -0.0412416346, -0.211585537, -0.239820331, -0.018678192, -0.196874529,
- -0.101480678, -0.120082371, -0.146239877, -0.110808648, -0.103161201, -0.177231416, -0.140140936, -0.0315673985,
- -0.00367713696, -0.192495242, -0.0610412583},
- {-0.321165055, 0.192868292, -0.072390236, -0.18423751, -0.252518803, -0.26305601, -0.151765585, -0.171034545,
- -0.105600595, -0.178600773, -0.174596995, -0.247677445, -0.237892687, -0.236348018, -0.000236330408, -0.1834452,
- -0.163360119, -0.0701877028, -0.115833238, -0.202389836, -0.0721690729, -0.188146025, -0.120160259, -0.262443095,
- -0.20341222, -0.21971783, -0.0980650261},
- {0.449082792, -0.0270797014, -0.137314126, -0.177455604, -0.139097154, -0.106580488, -0.0292201657, 0.136190265,
- -0.0424143001, 0.149148405, -0.00196942198, -0.0597378463, 0.212443382, 0.129891843, 0.180067703, 0.205957547,
- 0.000957073935, 0.0718140006, 0.10343381, 0.078331463, 0.166744187, 0.106738798, 0.120621271, 0.0129682859,
- -0.0802863836, 0.10361319, 0.0862321332},
- {-0.17860204, 0.208189771, 0.0263033956, 0.000277920743, -0.160352573, 0.203601852, -0.150529191, -0.164125308,
- -0.0140420506, -0.0494858325, -0.0526152551, -0.00277568423, -0.108365946, 0.0116153434, -0.0167237688, -0.0395806618,
- 0.011931139, -0.165378034, -0.00324902334, -0.153365985, -0.0028339806, 0.133138388, 0.0944995135, 0.0164488498,
- -0.2324083, 0.0180397108, -0.0274234097},
- {-0.426561028, 0.24493596, -0.201330155, -0.0763864592, -0.258283228, -0.0643101931, -0.128942877, -0.209910497,
- -0.0374539979, -0.0166280884, -0.103381366, -0.0904387534, -0.0885902718, -0.172480807, -0.175712675, -0.106098562,
- 0.00110536814, -0.203794301, -0.0544060022, -0.104873434, -0.129390463, -0.104808956, -0.185094148, -0.141938984,
- -0.143806174, -0.170632169, -0.192467168},
- {0.45860526, -0.561122, 0.152751803, 0.0841200501, 0.0419712067, 0.0697804242, 0.0707635731, 0.0425729379,
- -0.0768229887, -0.0354808494, -0.0261325743, -0.00976600312, 0.0420026034, 0.0314931013, 0.130160108, -0.0415651761,
- 0.0342741646, 0.0618669875, -0.0239344724, -0.0121451197, 0.0371328294, 0.123138696, 0.00577426748, 0.118317187,
- 0.165599778, 0.0769964978, -0.00334955752},
- {-0.207275823, 0.500732005, -0.0335645191, -0.0334830247, -0.0650151968, 0.0840153024, -0.124142788, -0.087065056,
- -0.180922806, -0.144985691, -0.170720369, 0.0298153087, -0.101654306, -0.183430269, -0.231269047, -0.212364584,
- -0.00150433357, -0.0818462446, -0.124161288, -0.00721862353, -0.111195698, -0.0487206243, -0.0044800397, -0.0740649104,
- -0.0716948286, 0.00691187801, 0.00550211454},
- {0.393148512, -0.119145073, -0.0452868156, 0.165033549, -0.0167995542, 0.102966703, -0.115843639, 0.0740915835,
- 0.145073235, 0.151900068, -0.0324623771, 0.15006955, 0.181313798, 0.125166476, 0.0496145822, -0.0837331712,
- 0.0380510874, 0.0945119411, 0.086845085, 0.0748384967, -0.0646631196, 0.0774728209, -0.0452217348, 0.043796882,
- 0.0519146174, 0.0136192748, -0.110294946},
- {-0.147433862, 0.321911603, 0.0100102769, -0.0134002501, -0.066930376, -0.0428499989, 0.0197757501, -0.0872440711,
- 0.0300989896, 0.0125183631, -0.203157187, -0.0391080752, -0.0958503857, -0.122390091, -0.196443662, -0.193303362,
- -0.130691722, -0.121532083, -0.145535812, -0.228147209, -0.181243256, -0.0333666354, -0.0166955218, -0.00871372409,
- -0.129219323, -0.0389807671, -0.159113422},
- {-0.370798498, -0.0440062992, -0.197523639, -0.106161751, -0.200277418, -0.217777252, -0.227994964, -0.120287322,
- -0.132728204, -0.0282151941, -0.180056259, -0.0245637931, -0.0893416405, -0.175884694, 0.0340842232, -0.0811715424,
- -0.0163640399, -0.0825695395, -0.18725054, -0.011322774, -0.078294605, -0.0608479306, -0.148631766, -0.0791135058,
- -0.0415379256, -0.13186425, -0.259721696},
- {0.103509016, -0.527144849, 0.0767510533, 0.00180323108, 0.116921358, 0.139517441, 0.127197951, 0.107439823,
- -0.0525451638, -0.0226252265, 0.0640647262, 0.128393397, -0.0332081243, -0.0119498344, 0.148136154, -0.0720148385,
- 0.0190187842, 0.122899085, 0.135596454, 0.0877433196, 0.168484196, 0.135552719, 0.0518457182, -0.0296556726,
- 0.186869025, 0.0822264329, 0.0397439748},
- {0.263712794, -0.47617203, 0.0833945572, 0.0545602553, 0.122198626, 0.0465042032, 0.0840432867, 0.0169785693,
- 0.0863707662, 0.0346216112, 0.109502196, 0.0986033231, 0.156983376, -0.0153407948, -0.00615008362, 0.0688149855,
- 0.0742319152, 0.112336718, 0.0133233471, -0.11299479, 0.00305100321, 0.138550952, 0.12309023, 0.0680940971,
- 0.0337822363, -0.048854053, -0.0313863233},
- {0.518104434, -0.166436046, -0.099790968, -0.0663183108, -0.0625056997, -0.11375796, -0.145391315, -0.00967355538,
- 0.136790186, -0.0772993267, 0.0110090347, -0.0201231744, 0.153027356, 0.139256388, 0.167663798, 0.0641365945,
- -0.0409532301, 0.227549046, 0.143810138, 0.138499409, 0.0188430138, -0.0482751057, 0.0301126037, 0.248668149,
- 0.210530192, 0.00619054912, -0.0676088557},
- {-0.186104491, 0.233580634, 0.118573114, -0.0127976853, 0.0960566625, 0.0736953542, 0.251772195, -0.104145579,
- 0.172358245, -0.0386764631, 0.0379826277, 0.233925804, 0.145774886, 0.0786081105, 0.0350921117, 0.0126289213,
- 0.16919224, 0.0388850719, -0.0322800651, -0.158329591, -0.175317645, -0.0351669192, 0.196814284, 0.0443842933,
- 0.213631973, 0.0512152649, 0.0705220103},
- {-0.663716853, -0.0602777079, -0.30173257, -0.136000097, -0.153062031, -0.0556087717, -0.258628279, -0.165205106,
- -0.000581533648, -0.167645231, -0.135868862, -0.0608691685, -0.0867363587, -0.0508776195, 0.00834177993, -0.103275038,
- -0.014979247, -0.140215918, -0.0328150839, -0.0158109218, -0.0716385692, -0.0489339978, -0.261236131, -0.16322954,
- -0.0172049422, -0.0979898646, -0.280148059},
- {-0.362677455, 0.309364796, -0.104885608, -0.247386336, -0.0457500145, -0.23768191, -0.152669773, -0.148136899,
- -0.0432849154, -0.0953435227, -0.00593322562, 0.00845937338, -0.282667756, -0.0455091968, -0.251503557, -0.073382996,
- -0.101767071, -0.183216318, -0.0591018014, -0.176483303, -0.189185053, -0.0698805228, -0.121813469, -0.276816189,
- -0.203132078, -0.284364104, -0.0631222576},
- {-0.271336913, 0.358531058, -0.104681805, -0.0979469419, -0.19899261, -0.111380145, -0.000115820963, -0.196923733,
- -0.05307208, -0.152249023, -0.218512118, -0.220661506, -0.0955315977, -0.159456819, -0.187530965, -0.0649953634,
- -0.156288177, -0.129982695, -0.0631385893, -0.103726164, -0.203972623, -0.115513161, -0.218377545, -0.0585971773,
- -0.164505795, -0.158882901, -0.00978114828},
- {0.436828822, -0.18359673, -0.120823331, 0.018163735, 0.0473750904, 0.000923848012, -0.0924514681, 0.0212548189,
- 0.162091762, 0.0371801816, -0.0860306472, 0.0556199104, -0.0370946787, 0.0177761521, -0.0377422161, 0.125906974,
- 0.133987769, 0.140305921, -0.0204365384, 0.0635013431, 0.0715180635, 0.170115083, -0.0836736411, 0.0912571102,
- -0.0124657759, 0.022869695, 0.136827424},
- {0.26812467, -0.392687589, -0.0865207389, -0.0111842714, -0.0937324092, 0.0385713987, 0.0629994646, 0.213837177,
- 0.14744477, 0.090877831, 0.123816915, -0.0546384901, 0.198717892, 0.0222096518, 0.0390968435, 0.0261886474,
- 0.0361097492, 0.115883648, 0.0175191034, 0.0459386259, 0.0064832191, 0.0906174332, 0.0620728023, -0.030173596,
- 0.0510627963, 0.105207674, 0.0586854592},
- {-0.331030667, 0.239398569, -0.00119025051, 0.125689462, -0.0887103826, -0.142071694, -0.0594881997, 0.0309228618,
- -0.222743362, -0.0991295055, 0.0583660156, -0.0364912711, -0.0237700678, -0.147058994, 0.0616393872, -0.0795455277,
- -0.0114237014, 0.00666829245, -0.024228422, -0.0947056711, -0.0854747444, -0.10504929, -0.138950974, -0.16211009,
- -0.0779616833, 0.0264916811, 0.00684741186},
- {0.348057121, -0.0608999431, -0.0388324261, -0.06741409, 0.0579357408, 0.0839887038, 0.122396775, 0.00463847816,
- -0.0339901075, 0.0579785556, -0.0934322104, 0.0904669985, 0.174805418, 0.078890115, 0.0435999371, 0.18297261,
- -0.00101306045, 0.192684948, 0.0398712419, 0.219277442, -0.0507313684, 0.114328347, -0.0501508266, 0.0176378507,
- 0.00461746845, -0.060530629, -0.0128189651},
- {-0.239518806, 0.149858102, 0.0757433698, -0.0501972698, 0.0126221525, -0.087033011, -0.153267369, -0.112784863,
- -0.0279700551, 0.00935836602, -0.17472674, -0.0237264838, -0.000919192855, -0.051903192, -0.0430531725, -0.194500864,
- -0.00957198441, 0.092309013, -0.136882439, 0.0434827469, 0.018826399, -0.0471162759, -0.12462604, 0.110655658,
- -0.157060131, 0.0263610035, -0.151151538},
- {-0.25266847, 0.240214854, 0.0328920409, -0.138461784, -0.0437155329, 0.0782054812, -0.0836545527, -0.115790658,
- -0.181210458, -0.0250151847, -0.141142294, -0.156987101, -0.057452701, -0.0484984219, 0.00455962308, -0.0601748824,
- 0.0682900473, 0.146606028, -0.101017185, -0.0223872717, -0.019499328, -0.00622303365, -0.013845739, 0.0390694104,
- -0.00787655171, -0.0434663147, -0.208452597},
- {0.423567891, -0.358888686, 0.0525477231, 0.0222687405, 0.0183091927, 0.0336677209, -0.0492732637, -0.0268919598,
- 0.0456482731, 0.0317578875, 0.141728416, -0.0104958247, -0.0689619035, 0.11647515, 0.0680325851, 0.0702114403,
- 0.0129154706, 0.0485576354, 0.079603292, 0.0299764629, -0.00995149836, 0.151535317, 0.0357879661, 0.183903858,
- 0.0173941832, 0.163448751, -0.0173084661},
- {0.197580054, -0.708326459, 0.141587332, 0.110933885, 0.102622867, 0.131987453, 0.107058614, 0.143755391,
- -0.0216910318, 0.0737754032, 0.0635532364, 0.0330892913, 0.00785605144, 0.090250887, -0.164318591, 0.147977024,
- 0.00518943928, 0.100421317, 0.0181860141, 0.0421874933, 0.108827427, 0.103697687, 0.085741125, 0.0453558192,
- 0.00435643643, 0.0350861922, 0.101207308},
- {0.578496456, -0.281911999, -0.0912107229, -0.00157236506, 0.0737091973, -0.125786766, -0.0948118865, 0.139100745,
- 0.0863205642, -0.0181029402, 0.214752793, 0.0246585235, -0.105960019, 0.0706722289, 0.0743643269, -0.049071718,
- -0.0929681882, 0.15671432, 0.0541720353, 0.178679168, 0.155430138, -0.0451923274, -0.0259542577, 0.146785975,
- 0.231990561, -0.0218342151, 0.114251174},
- {-0.176638052, 0.474270254, 0.0354613811, -0.0849981308, -0.128094435, -0.0105027305, -0.121408045, -0.222882584,
- -0.0747505799, -0.177110344, -0.0617682151, -0.103388697, -0.177360058, -0.241234481, -0.15954411, -0.106433809,
- -0.209819645, -0.113705449, -0.0300333593, -0.180132613, -0.287074834, -0.197365507, -0.00205036276, -0.0379004143,
- -0.035296049, -0.0642936826, -0.0838138461},
- {0.304664016, -0.341737807, -0.0170252863, 0.0889494568, -0.0109711746, 0.107563712, 0.0696278811, -0.0278837569,
- 0.221802652, 0.00425856607, 0.168509856, 0.0334265642, -0.15764834, -0.00481014559, 0.0273048244, 0.166411385,
- -0.0321293622, -0.0703800023, 0.147926912, 0.0808914229, 0.183369756, 0.0965170786, -0.0390964486, 0.0423784479,
- 0.101480238, -0.0164118633, 0.153857082},
- {-0.230144233, 0.341433316, 0.00476452149, -0.218263462, -0.0902998894, -0.0575358607, 0.00763588026, -0.0891412795,
- -0.201102152, -0.140145585, -0.0842250809, -0.10659425, -0.0326113999, -0.0361110531, -0.137486845, -0.0495124571,
- -0.163888365, -0.212821499, -0.129089341, -0.19397074, -0.0730566755, -0.095200859, -0.0544053689, -0.000312670716,
- -0.0139416205, -0.147641197, -0.0805949122},
- {0.418724358, -0.120809369, 0.0368676111, 0.110036485, -0.0220006574, 0.147244766, -0.0400133096, 0.0347340517,
- 0.012510566, 0.150909945, 0.0194976777, 0.00483879866, 0.0834672675, 0.0558353104, 0.198132291, 0.103482619,
- 0.151304647, 0.102554977, 0.060864985, 0.142893896, 0.136461183, -0.103358932, 0.0351555012, 0.0740951374,
- -0.0124646891, 0.042901054, -0.0383626446},
- {0.213534549, -0.111635499, -0.0086081028, 0.0232707821, -0.0643704608, -0.0206556432, 0.137015283, 0.168181702,
- -0.0301412363, 0.144275323, 0.110661089, -0.0457311571, 0.147934765, 0.0910186693, 0.137458324, 0.141207725,
- -0.0650138557, 0.133419633, 0.205272615, 0.0719840154, 0.00883892551, 0.0116700241, 0.0515240915, 0.0242007468,
- 0.0802756399, -0.178275302, 0.128199667},
- {-0.0455628186, 0.252903968, 0.115100496, 0.0416428819, 0.0459814332, 0.0431688502, -0.178163812, -0.0555764586,
- 0.0648901686, -0.0402317531, -0.0111820968, -0.0657004416, 0.0597762391, -0.011672033, -0.142971113, 0.0338316001,
- 0.0950355306, -0.128613383, -0.119121835, 0.0171257854, -0.253217071, -0.158140317, 0.175188094, -0.00129613944,
- -0.161335245, -0.0163471103, 0.127176583},
- {-0.169768423, 0.0744621605, -0.103524618, -0.143717185, -0.199385568, -0.0491154566, 0.00195829291, -0.156508669,
- 0.0745632872, 0.0275436044, -0.169682056, 0.0171737969, -0.0738901943, -0.0062367986, 0.0585932024, -0.172567084,
- -0.0197479054, 0.00266714348, -0.162039846, -0.234088123, -0.0436253324, -0.154618815, -0.0335548371, -0.0258946549,
- -0.0616519339, -0.114310011, -0.174649164},
- {-0.133120164, 0.439192623, -0.103442669, -0.0153812859, -0.167189449, -0.230251342, -0.0318702646, -0.0332557373,
- -0.240462571, -0.116802149, -0.0354024991, -0.141053736, -0.0829382762, -0.204856411, -0.265515119, -0.115467556,
- -0.163805768, -0.0271386188, -0.255458713, -0.156825528, -0.145380557, -0.133044228, 0.0808085352, -0.202027619,
- -0.148987576, -0.091487132, -0.0606577769},
- {-0.49912706, 0.142519668, -0.220531911, -0.0795762315, -0.149396002, -0.13787435, -0.177432001, -0.0117400009,
- -0.0247782543, -0.0279774703, -0.103532702, -0.0744246468, -0.022347264, -0.0498960577, -0.0342140943, 0.038863644,
- -0.125420868, 0.019237902, -0.0820011869, -0.0810649693, -0.0274731442, 0.020874111, -0.267779201, 0.00144066662,
- 0.0239645559, -0.176892251, 0.00211504404},
- {-0.522538245, 0.0660262778, -0.140325516, -0.0308711566, 0.092320621, 0.0176545903, -0.270502061, -0.0141608836,
- -0.00595624326, -0.0258488357, 0.0565951392, -0.0404072441, 0.106640853, -0.000938775891, 0.026937522, -0.00591676123,
- -0.188626379, 0.0314368531, 0.0198946744, 0.0708869249, -0.0503331125, 0.0646673739, -0.172804534, -0.13487263,
- -0.0708622038, -0.071155861, 0.0576548576},
- {-0.23292163, 0.232858419, -0.214374363, -0.0747272447, -0.0250771437, 0.00480352156, -0.0999414474, -0.116430111,
- -0.0427023284, 0.0467009842, -0.036101073, -0.114257216, 0.0385426991, -0.175344765, -0.0373300798, -0.15985626,
- -0.176364839, -0.0585430823, -0.0409489274, -0.0306856725, -0.218576282, -0.0136922058, 0.0896271318, -0.0510689132,
- -0.0204482712, -0.00318003795, -0.084438242},
- {0.448063701, -0.264696002, 0.136618823, -0.0114351679, 0.174092636, 0.0299522914, -0.125877932, -0.137688085,
- 0.132760718, -0.14269121, 0.0382742807, 0.122338742, 0.123637401, 0.110391177, -0.0191646945, 0.0621364005,
- 0.147515818, -0.0154663734, 0.136175156, 0.0155771868, 0.0373467766, 0.254042983, -0.00348631176, 0.08404392,
- -0.0513186157, 0.0834140554, 0.168201968},
- {-0.613729, 0.240129039, -0.145507604, -0.127531052, -0.00972440466, -0.21081014, -0.24452126, -0.178855732,
- -0.129517794, -0.170253381, -0.131605685, -0.163777694, -0.114400662, 0.0251422562, -0.061545115, -0.0839774311,
- -0.0249273367, -0.243010461, -0.218458354, -0.0339211226, -0.0742143318, -0.144713581, -0.219067872, -0.205832168,
- -0.15246518, -0.0667908862, -0.0615462847},
- {0.315353423, -0.694815993, 0.0526129454, 0.0153720826, -0.0103507489, 0.00761156762, 0.0889430046, 0.0706181973,
- 0.0925181061, 0.102344185, -0.0452656411, 0.0707048103, 0.105654456, -0.0385615788, 0.08131437, -0.0531029738,
- 0.00106319215, 0.0558119416, 0.0918150544, 0.115882479, -0.0419094265, 0.13955456, 0.149811372, 0.110584214,
- 0.0166440587, 0.115375154, 0.166177467},
- {0.499753505, -0.164732948, -0.00713265315, 0.0114573343, 0.0201455187, 0.0611645952, 0.0193548817, 0.149596602,
- -0.0434964225, 0.1309001, -0.0703655854, 0.0236323625, 0.0327353776, 0.208937079, 0.194174871, 0.0507228114,
- 0.0477064252, -0.0133044897, 0.186319396, 0.0406931192, 0.120958753, 0.0228449013, -0.024871815, 0.0896263421,
- 0.149707183, -0.0308952034, -0.053363055},
- {-0.0975975916, 0.332158417, -0.110260442, -0.0525966175, -0.0285875276, -0.016478138, -0.151796699, -0.0250231232,
- 0.0522579029, -0.214109331, -0.150874913, -0.146583572, -0.0408011749, -0.0786627084, -0.190910399, -0.122526437,
- 0.0149130337, -0.161266267, -0.090077199, -0.163034379, -0.00696600927, -0.157891482, 0.0656950623, -0.0443540551,
- -0.189059064, -0.148320451, 0.0102756079},
- {0.527701974, -0.253993064, 0.0318637565, 0.0696030483, 0.0403470546, 0.131592408, 0.0328618176, -0.059813004,
- 0.210102618, 0.208370924, 0.0855169892, 0.150624573, 0.0156655498, 0.039555341, 0.176208407, -0.0183397196,
- 0.118501782, -0.0327469893, 0.138739929, 0.0998065546, -0.0155782755, 0.0745092556, -0.14734, -0.134942144,
- -0.0958396196, -0.136083946, -0.05625901},
- {-0.451924175, 0.355270594, -0.0893983245, -0.121184081, -0.0895734727, -0.243949428, -0.116623752, -0.0495870151,
- -0.21167925, -0.180889755, -0.092923291, -0.199588671, -0.122338913, -0.0905380324, -0.179280505, -0.160105631,
- -0.0434125364, -0.137021661, -0.151232749, -0.187471434, -0.126651421, -0.151861295, -0.173878103, -0.0177256074,
- -0.0867575184, -0.115521692, -0.218266904},
- {0.437505424, -0.678556502, 0.0559256673, 0.0993382186, 0.0869369283, 0.089817591, 0.111516215, 0.0114574945,
- 0.169818357, 0.138176322, 0.109305203, 0.139956906, 0.0130167427, 0.112872623, -0.00461274479, 0.10696537,
- 0.0193421058, -0.0835508034, -0.010430675, 0.0473661274, -0.0509739034, -0.0444266237, 0.174133644, -0.0205071531,
- 0.152494848, 0.069491066, 0.0520483479},
- {0.497572988, -0.328372508, 0.0126053747, -0.0111965649, 0.116439871, 0.0457431711, 0.0601232722, -0.0899857432,
- -0.0880742297, -0.0033846281, -0.114741094, -0.0733758286, 0.0488695465, 0.122944817, 0.0717117563, 0.0209182035,
- 0.130703717, 0.0235983748, -0.0289697163, 0.125805527, 0.0907257348, -0.0252740905, 0.0187348966, 0.109492823,
- 0.199946836, 0.131913632, -0.00105592923},
- {-0.21476914, 0.278274596, 0.0627218485, 0.0631298125, -0.0895549655, -0.190010443, 0.0231865626, 0.0107287103,
- -0.123579927, -0.0589644238, -0.185979038, -0.189050809, 0.0539022498, -0.0215617325, -0.0474458858, -0.146113798,
- -0.0797357634, -0.145009339, -0.0572422035, -0.067373924, -0.140065566, 0.12674129, -0.175425336, -0.10344892,
- 0.00935135502, -0.0380067825, 0.00392627809},
+ {-0.736501038, 0.441505551, -0.0101214806, 0.00838176813, 0.128412887, 0.0572147146, 0.00972155482, 0.115386635,
+ 0.119603187, 0.14025943, 0.114817813, 0.0303258933, 0.0892734081, 0.11637944, -0.0400928557, 0.133098051,
+ 0.0543531738, 0.079443492, 0.137819752, 0.0814808607, 0.0843888149, 0.0232406333, 0.091927141, 0.0622601695,
+ 0.0152867809, 0.144588381, 0.129209518},
+ {0.585523427, -0.348218173, 0.0201869905, -0.0927824378, -0.079847075, 0.00570499012, 0.019028658, -0.0525778793,
+ 0.0241511595, -0.0778653324, 0.0649214983, -0.0720155463, 0.0816128254, 0.152107835, 0.122573361, 0.00469767535,
+ 0.0939414054, -0.00473231031, 0.106732287, 0.0535288267, 0.121206462, 0.142429635, 0.0481809713, 0.0417780764,
+ -0.137944624, 0.0609199479, 0.137769178},
+ {0.462448597, -0.407749623, 0.0928331017, 0.169065684, -0.0239023864, -0.043717999, 0.0748787001, -0.115180753,
+ 0.00713600824, -0.0456510931, -0.115847155, -0.0928038359, -0.0936625302, 0.00672320556, -0.122399807, -0.197665408,
+ -0.0889568478, -0.0234494805, 0.0380730927, 0.0320549458, -0.140820429, 0.123263285, 0.0330723673, -0.115847103,
+ 0.0344328955, 0.0078370925, 0.0235057231},
+ {-0.394853741, 0.619607925, 0.000623293105, 0.0626177266, 0.0993065983, -0.0508532375, 0.0422961935, -0.0329102054,
+ 0.0658184364, -0.00211412669, 0.071218811, -0.00110832648, 0.0992975384, 0.0485603251, 0.043090459, 0.0198037624,
+ 0.144100145, 0.075020507, -0.0265296474, 0.1072428, 0.119981416, -0.081960164, -0.0284454729, 0.0727817416,
+ 0.0209743958, 0.017231239, 0.00270501012},
+ {0.322544158, -0.334278047, -0.103440411, -0.166788399, -0.121835642, -0.0188177433, 0.0470861383, -0.0765447021,
+ -0.151401475, 0.0245341826, -0.0653189644, -0.137065485, -0.0791330934, -0.0928802639, -0.118125282, -0.0103837829,
+ -0.105004698, -0.124869317, -0.140310287, -0.0502006561, -0.154444039, -0.0629348978, -0.0932405964, -0.060754858,
+ -0.178571165, -0.0198839214, -0.0266791955},
+ {0.48355487, -0.390889734, 0.077595599, -0.0655251518, 0.143206969, -0.102194585, -0.139597893, -0.0420332812,
+ 0.0287977494, -0.116232172, -0.0313235372, -0.0885956362, 0.033777222, 0.00323530566, 0.00361841219, 0.0489796698,
+ 0.162499145, -0.100385226, -0.160346776, -0.012796713, -0.092316702, 0.00321569922, 0.0583160706, -0.189311892,
+ -0.0899522752, -0.00434100768, -0.0259704161},
+ {0.56332922, -0.362275988, 0.0443004631, 0.0566074625, 0.103790238, 0.116797395, 0.0716718212, -0.00739252847,
+ -0.0622435883, -0.0145862829, -0.0833693147, -0.136529267, 0.0718827471, 0.0215955507, 0.12628819, -0.0718128085,
+ 0.0909880102, -0.101973854, -0.00682962313, 0.0249344036, -0.0967680514, -0.0909264088, -0.166580185, 0.121361844,
+ 0.123275392, -0.0651039332, 0.0537181273},
+ {-0.819170773, 0.319890618, 0.141533777, 0.129072368, -0.0416160114, 0.051628653, 0.081989117, 0.0895106494,
+ -0.0747076198, 0.1649829, -0.0243134368, 0.0412659608, 0.030081179, -0.0334956907, 0.00654935138, 0.149787158,
+ 0.0927348658, 0.0314128175, 0.130006343, -0.0245594271, 0.192781106, 0.0554638095, 0.0114317741, 0.178244412,
+ 0.132871851, 0.155762359, 0.0562597178},
+ {-0.28783685, 0.800749838, 0.0654582605, 0.16760315, -0.0268351845, 0.0785852894, 0.0815776661, 0.0205644313,
+ -0.0319911316, 0.130168468, 0.0646079183, -0.0104910787, -0.0759830847, 0.0305559859, 0.16011776, 0.0711820126,
+ 0.0454082005, 0.078481257, 0.00481300708, 0.0328404978, 0.0453402773, 0.020932721, -0.0534755625, 0.0791933984,
+ 0.0573769771, -0.0207710471, -0.0651272088},
+ {0.443260223, -0.382645726, 0.0540792719, -0.0148503678, 0.0803779736, -0.148579612, 0.175915852, 0.0861628428,
+ -0.126483589, -0.137266189, 0.0693714172, 0.0376117416, 0.0510658026, 0.0994918942, -0.00325085898, -0.141312346,
+ -0.18967995, -0.1160748, -0.0589719862, 0.0061827735, -0.127816349, -0.0692821294, 0.0541898757, -0.14229548,
+ -0.0578054674, -0.0225470457, 0.0464053452},
+ {-0.204074055, 0.799709797, -0.0926644951, -0.0725759491, -0.0710309893, 0.084686704, 0.0408146083, 0.0254257284,
+ 0.121725418, 0.0215996467, -0.0359991416, 0.0957524031, 0.0953931063, -0.00680645928, -0.0204294901, 0.12974003,
+ 0.112353064, 0.156413019, 0.164305806, 0.0415933207, 0.0266439002, -0.0343691036, 0.0610345528, -0.0121211726,
+ 0.0274683293, -0.0188910402, -0.122497492},
+ {-0.754237473, 0.489109159, -0.0150684342, 0.0150721166, 0.0898994058, 0.117045648, 0.180196047, 0.0989702791,
+ 0.118802801, 0.0894164145, 0.0476460047, 0.0852576643, 0.0704386756, 0.126215875, 0.0863139778, 0.0404747985,
+ 0.0579191074, -0.027498249, 0.0362317972, 0.0889331922, -0.0816930681, 0.0614292808, 0.0247090347, 0.136105731,
+ 0.157695234, -0.0156611446, 0.110241055},
+ {0.313439459, -0.371197999, -0.0812235922, -0.130841494, -0.15772593, -0.0686921179, -0.113482796, -0.215832263,
+ -0.263810158, -0.138681024, -0.0457723662, -0.0189078543, -0.0898318738, -0.00338601694, -0.0972477868, -0.0171671677,
+ -0.175094023, -0.0579345673, -0.0215088259, -0.0257680323, 0.0197421573, -0.00804031081, -0.0486229621, -0.0935873836,
+ -0.0598373115, 0.0556947142, -0.0341284163},
+ {-0.0283087846, 1.01821673, 0.0245439559, -0.0584667772, 0.0596237145, 0.117861398, -0.150972486, -0.105874307,
+ 0.13461031, 0.127710566, 0.0638094619, -0.0524306707, 0.0142664034, 0.176166981, 0.0509422906, 0.105261885,
+ -0.0829668492, 0.0342497528, -0.0993484035, -0.0566260181, 0.0703369901, -0.0444689468, 0.0637464449, 0.112646125,
+ 0.0266214907, -0.0401618667, -0.122857191},
+ {0.494186699, -0.433338791, -0.0518285334, -0.124452204, 0.0497728549, -0.0852343068, 0.00520238606, 0.0706914961,
+ -0.00554902293, -0.0658616275, -0.0817680433, -0.119707204, -0.0898402631, -0.11220105, -0.0157136191, -0.104440816,
+ -0.00855437294, -0.116905071, 0.0119658746, -0.112882987, 0.0223040786, 0.0165890623, -0.0733309537, -0.10083314,
+ 0.0402964987, -0.0173071269, -0.115835465},
+ {0.585159421, -0.537825108, -0.00638052402, -0.00731653441, -0.0890905112, 0.0726372227, -0.0513539203, -0.193280995,
+ -0.138472408, 0.00548683852, -0.0036317159, -0.0830583051, -0.251722008, 0.0221150201, -0.0875414535, -0.0016881146,
+ 0.108474821, -0.160211459, -0.115118034, 0.0284992438, 0.0648568422, -0.136975646, -0.122525007, 0.0966260657,
+ 0.0641387627, -0.113552749, -0.109446473},
+ {0.193843648, -0.242976606, -0.193332702, -0.292165011, -0.278867573, -0.228950977, -0.238747001, -0.0930175334,
+ -0.0573855378, -0.165438771, -0.240651086, -0.0511921868, 0.0324299969, -0.0392116196, -0.111929521, -0.274590582,
+ -0.148756132, -0.111382566, -0.0805970877, -0.0647319108, -0.199062288, -0.185016915, 0.0627402514, 0.00906337332,
+ -0.0627135858, -0.135310128, -0.169047281},
+ {-0.215394437, 0.889513314, 0.00638777902, 0.00826172903, 0.0156073878, 0.0459904447, -0.00762421312, -0.0168544892,
+ 0.0577065274, 0.0580772273, 0.0874491185, -0.0387069285, 0.0537195019, 0.10909301, 0.10909342, 0.0418900773,
+ -0.0534538031, -0.0679726452, 0.113790199, 0.058318954, -0.0312984921, -0.0566174537, -0.0532646477, -0.0796468034,
+ -0.124961801, -0.00909277145, 0.0655762851},
+ {-0.228752688, 0.836602569, -0.066971913, 0.00661093649, 0.0622722507, -0.0991612822, 0.0580747649, 0.0461828969,
+ -0.00459896866, 0.0183859095, 0.125690386, 0.0345075168, 0.055562906, 0.0219121948, 0.0377271026, 0.0509790927,
+ 0.116534844, 0.0217704326, 0.0595090501, 0.0035141164, -0.0847472772, 0.0247160643, -0.0256635621, 0.105417542,
+ -0.0172405094, -0.00555314263, 0.0275831074},
+ {-0.523936927, 0.542215705, 0.0836628824, 0.0148690064, -0.107132636, 0.0131806992, 0.0877602249, 0.0387383178,
+ 0.0478802584, 0.0926990509, 0.191303402, 0.106592536, -0.0540394038, 0.0751547292, -0.0609236471, -0.0316190124,
+ -0.0191638581, -0.00913275406, 0.0661239922, 0.183413312, -0.0261334088, 0.0737154484, 0.0801930279, -0.0199935101,
+ 0.0367107987, 0.0859389529, -0.0555933639},
+ {0.288705468, -0.441975057, -0.10542386, -0.027804669, 0.0127640441, -0.188249782, -0.0386438929, -0.159199029,
+ -0.115368813, -0.109920412, -0.0792587996, -0.128983915, -0.174695253, -0.15355587, 0.013300905, -0.131267965,
+ -0.196564063, -0.13494356, -0.176885277, -0.0716164261, -0.0909028128, -0.172184154, -0.173392311, -0.061146494,
+ -0.0728916377, -0.0879944786, -0.130929112},
+ {0.577622175, -0.508731306, 0.0489397533, -0.0387292616, -0.175800875, 0.0470782071, -0.0244599395, -0.183845922,
+ -0.076273866, -0.0991943106, -0.172568753, -0.0689993054, -0.0389560014, -0.089046672, 0.0276372749, 0.039563179,
+ -0.0502255633, 0.0743123293, 0.0455570854, -0.176738515, -0.0365099125, -0.105101839, 0.0263801813, 0.0622431785,
+ -0.00551946554, -0.176056966, -0.149150908},
+ {0.336864412, -0.319015056, 0.132177919, 0.00744339731, -0.211662367, 0.0252622422, 0.0705826059, 0.0777326003,
+ -0.156707972, -0.0793115273, 0.0194405708, -0.0405637026, -0.12632072, -0.189731076, -0.0813506842, -0.094583191,
+ -0.0984284878, 0.034173172, -0.113607906, -0.0468458906, -0.107121952, -0.0256407987, -0.022450408, -0.243887752,
+ -0.0653076544, -0.0913802236, -0.10388568},
+ {0.578416288, -0.503526211, 0.0678627491, -0.0796723217, -0.0205171332, -0.087524496, 0.123584375, -0.0171893202,
+ 0.0144450143, 0.0352460146, 0.0494950749, 0.0144806793, -0.122311831, 0.104767658, -0.0340576917, -0.0769768059,
+ -0.187032133, -0.0312526077, 0.0730399415, -0.0127690043, -0.0796863586, -0.0862771943, 0.00205425057, -0.0247630179,
+ -0.0599246062, -0.100494251, -0.00546842441},
+ {0.562040985, -0.488121718, -0.0126014715, 0.0654413924, -0.0157233886, -0.0506547168, -0.0735116154, 0.000446558377,
+ 0.0883243307, 0.0476379693, -0.0356399193, -0.0790520981, 0.0242921375, 0.083447054, -0.0226964466, -0.0555270053,
+ -0.0491245911, -0.11149352, -0.0803522915, -0.129119724, -0.121286027, -0.0180314351, -0.00345550943, 0.119797938,
+ 0.00104405289, -0.101297848, -0.0751108006},
+ {0.238196939, -0.53691113, -0.151438579, -0.100090817, -0.176935419, -0.0520765968, -0.266078323, -0.0999380946,
+ 0.040820688, -0.0347121321, -0.0450287312, -0.183185175, -0.163738295, 0.000619773462, -0.0867412314, -0.0491779186,
+ -0.236263737, -0.157642022, -0.0430997536, -0.14331156, -0.118139446, -0.16108115, -0.201048821, -0.177758396,
+ -0.129035383, -0.203504562, -0.164767295},
+ {0.441368878, -0.395885527, -0.153076977, -0.0806180239, -0.0695551485, -0.0865602046, -0.211709112, -0.0284602828,
+ -0.127726078, -0.00846482534, -0.164641082, -0.104029126, -0.21861203, -0.167878583, 0.00975916069, -0.0954109281,
+ 0.000394121686, -0.102626011, -0.019367246, -0.114014499, -0.0390974656, 0.0309991166, 0.0340251587, 0.0921528116,
+ -0.133139834, 0.110572889, -0.0450299494},
+ {-1.37051094, -0.209623411, 0.138460785, 0.092090182, 0.0507118851, 0.0916386992, 0.188570067, 0.0877156034,
+ 0.00925927609, 0.0311223976, 0.158533677, 0.0935553014, 0.0593449324, 0.0900341645, -0.0495540574, 0.0888268873,
+ 0.00726486882, 0.195680708, 0.00532209128, 0.121221334, 0.0602692068, 0.0463516042, 0.0633608252, 0.000764071126,
+ 0.142929018, -0.0125963408, 0.140731975},
+ {-1.02481186, -0.0301061235, 0.0968682766, -0.00556900632, 0.131804481, 0.076072745, 0.0394872352, 0.124811731,
+ 0.0580817759, -0.0613573231, 0.137282491, 0.0988281816, 0.110931978, 0.0479087867, 0.0885298625, -0.0936895385,
+ 0.173342228, -0.0392186679, 0.102072865, -0.0210707225, 0.102531731, 0.152089283, 0.0219103396, -0.0106732855,
+ 0.0755668655, 0.107699119, -0.037840154},
+ {-0.440617263, 0.427588522, 0.0922426656, 0.149832055, 0.141998261, 0.0473250188, -0.0015713285, 0.0251766704,
+ 0.175777137, 0.0605928078, 0.14569357, -0.040041931, -0.0712837875, -0.0216561873, 0.155275241, 0.0395933017,
+ -0.0587713532, 0.0714753345, 0.169354916, -0.0907185599, 0.121233217, 0.102245063, -0.076196596, -0.073741734,
+ 0.117569886, -0.00979469996, 0.066190891},
+ {0.0369343646, 0.94740963, -0.120297633, -0.0240263045, -0.0747312531, -0.0370690227, -0.0871979296, 0.0721855164,
+ -0.0477090999, -0.0303094052, -0.0174251776, 0.0737490803, -0.0174532924, 0.202143535, 0.044087287, 0.136250496,
+ 0.0836504027, 0.0106535666, 0.0564865582, 0.143943682, -0.0540259853, 0.14196521, -0.0470602587, -0.0595160872,
+ -0.067465283, -0.0373986252, -0.122069307},
+ {0.536459267, -0.527057171, 0.0432944037, -0.0220577996, 0.0586258806, 0.0299046487, -0.03634426, -0.134697944,
+ 0.0617770702, 0.0597911552, 0.0829500481, 0.0790654123, -0.0937644318, -0.138984412, -0.0958245695, -0.136554793,
+ -0.149459213, -0.00758869108, -0.0619160868, -0.0150070162, -0.12118274, -0.0870625973, -0.0453385152, -0.0505067669,
+ 0.0766466856, 0.081386447, -0.0441951305},
+ {-1.5428828, -0.80797714, 0.0740097687, 0.0697444305, 0.057266742, 0.122709066, 0.0515730716, 0.0172563121,
+ 0.102879532, 0.00833038613, -0.0306954794, 0.0508712716, 0.0623149313, -0.0547058731, 0.0178796276, 0.0469872989,
+ 0.048006475, 0.138395235, -0.015775077, -0.0874862075, -0.0236810762, 0.192813948, 0.102375232, 0.182756573,
+ 0.0315079354, 0.17786096, 0.120102532},
+ {0.404215246, -0.463934869, -0.0957639143, -0.153242469, -0.129122972, -0.0429926887, -0.00734173926, -0.130690306,
+ -0.0292293392, -0.101523019, -0.0187744685, -0.0789348856, -0.028868366, 0.0663219988, -0.12293189, 0.133115426,
+ -0.0129556032, 0.0705926567, -0.00292059872, 0.106569223, 0.068127282, 0.0237778127, 0.154400885, -0.203437477,
+ 0.0205398705, -0.100581557, -0.120557994},
+ {-0.644988537, 0.49214381, 0.150650322, 0.112618349, 0.118532732, -0.0712057278, 0.109975316, 0.0600802526,
+ 0.11721167, 0.0043891496, 0.0445214249, 0.020120509, 0.0575481392, 0.0311500095, 0.070253849, 0.0899710879,
+ 0.00519787194, 0.139914215, 0.00923856813, 0.073828876, 0.0130092464, 0.135768488, 0.135616556, -0.0155476285,
+ 0.0110093774, 0.141182959, 0.0469711907},
+ {0.565220535, -0.45870927, -0.0676563606, -0.103016622, 0.0210752469, 0.11313884, -0.141023487, -0.0987690315,
+ -0.00595930219, -0.00645625824, -0.145734802, -0.143644974, 0.0660507381, -0.0887921229, 0.103647389, -0.10528554,
+ -0.117506079, -0.0474755652, -0.110127009, -0.0812641829, 0.00495389896, -0.127982289, 0.00333370781, -0.161127314,
+ -0.132345542, 0.026314592, 0.0338136926},
+ {0.425351769, -0.419588655, 0.0911391899, 0.0296612848, -0.158307016, -0.183616206, -0.0537261553, 0.151801199,
+ -0.070437476, -0.144536048, 0.0424512364, -0.097841166, -0.00756636076, -0.0642707944, -0.0151114604, 0.0219121445,
+ -0.115748204, -0.112595864, 0.0332745798, 0.030156292, -0.0302893762, -0.168612301, -0.025304215, -0.0259683151,
+ 0.0275830887, -0.113976859, -0.103646033},
+ {0.635811269, -0.484070182, 0.0425479375, -0.0276354123, -0.0907608867, -0.0059059551, -0.0439028107, -0.000382573809,
+ 0.0340211354, 0.0319638103, -0.0113164345, -0.0539076701, -0.0457570031, -0.00216524722, -0.0475030392, 0.00518768514,
+ 0.0944753811, 0.017696023, 0.101162143, -0.0821021795, -0.0974972546, -0.0857279897, -0.0456408188, 0.0471956506,
+ -0.189597234, 0.0393579602, 0.0866887048},
+ {-0.499247909, 0.543323755, 0.0900440738, -0.056884367, 0.0500761643, 0.00318569271, -0.0280284118, -0.110797897,
+ 0.17162694, -0.0145060718, 0.0115644, 0.00268066581, -0.00221528695, 0.0504573807, 0.137124568, -0.0380336717,
+ -0.0434476212, -0.0169732086, 0.165596545, 0.0667509511, 0.138989732, 0.0213365871, -0.0366825201, 0.0830830038,
+ -0.00564401317, 0.0655842274, 0.0633930266},
+ {0.70726335, -0.293301582, -0.0149804838, -0.0407507345, 0.0592219196, 0.142761424, -0.058007393, 0.0426381007,
+ -0.0269866847, 0.086824134, 0.0405586213, -0.0860687941, 0.0596791469, -0.0316971801, -0.0820193738, 0.094117634,
+ -0.10543634, 0.140936255, -0.145996511, -0.104174055, 0.121777564, 0.0991584435, 0.0770189837, 0.12082129,
+ 0.122225203, 0.0808218941, 0.0609109141},
+ {-0.64608264, 0.476182133, 0.11432562, 0.143952027, 0.102427512, 0.108211726, 0.0424858816, -0.00217763684,
+ 0.0933892354, 0.0845816955, -0.0416734777, 0.0165807977, 0.0763965845, 0.0119573381, 0.10007228, 0.134320587,
+ 0.192003861, 0.0674655959, -0.043181546, 0.0899695978, 0.0556872673, 0.104730159, 0.0565740578, 0.113215894,
+ 0.127959728, 0.0764361992, 0.0625143424},
+ {0.508454621, -0.388237149, 0.0380777717, 0.09970662, -0.0212344527, -0.111735195, -0.127914205, 0.0887548178,
+ -0.185714722, 0.0326851979, -0.0785226375, -0.137000754, 0.0644617528, 0.0518359952, 0.00604667002, -0.0273073856,
+ 0.015539689, 0.0862407684, -0.120538272, 0.015681047, -0.116713345, -0.0603444837, 0.0632756948, -0.0189401153,
+ -0.103490613, -0.0350942872, -0.11512392},
+ {0.456700772, -0.404712647, 0.06749513, -0.064227134, -0.0689638332, -0.0506657399, -0.142596498, -0.139065787,
+ -0.12147744, -0.183219835, -0.0241773743, -0.00420871517, 0.0546985529, -0.0776123032, -0.177308828, -0.199897021,
+ -0.153310016, -0.154843956, -0.0349417962, -0.154218048, 0.0284505915, -0.00227548159, -0.082287766, -0.0456741937,
+ -0.0863075778, 0.0297212899, -0.0931005254},
+ {0.305552572, -0.315883875, -0.122184627, -0.0746651217, 0.0342479385, -0.0904350281, -0.245500386, -0.028839428,
+ -0.0701977536, -0.135232389, -0.165449649, -0.201628625, -0.0494867563, -0.109070107, -0.188339859, 0.0062798541,
+ 0.0606066026, -0.00351285841, -0.0736040324, -0.0990265533, -0.0258480106, -0.120790169, -0.0687542558, 0.0293561108,
+ -0.108199641, 0.049893599, -0.12316478},
+ {0.29987666, -0.572770119, -0.214782536, -0.0542312413, -0.108061738, -0.101396576, -0.0827371478, -0.0851614699,
+ -0.00562301371, -0.152533382, -0.0901153535, -0.100591116, -0.128925681, -0.0542940423, 0.0350219384, -0.0491921976,
+ 0.00431972975, -0.130837634, -0.0822021365, -0.0177699849, -0.185890228, -0.0105574373, -0.202068493, -0.117978066,
+ -0.220640764, -0.0570592247, -0.292594552},
+ {0.494745016, -0.417134374, -0.134922132, -0.0530528873, 0.0185136888, -0.0505652055, 0.0923090801, -0.0213337392,
+ 0.0254124161, -0.0483726412, -0.0614903308, 0.0912698284, 0.00118646806, 0.000871023745, -0.123800509, -0.0349011831,
+ -0.0204420723, 0.0510278866, -0.108978763, -0.0903524011, -0.11572279, 0.00258875033, -0.11578048, 0.0649974346,
+ -0.233644098, -0.143126875, 0.0714745894},
+ {-0.466099918, 0.303083658, 0.194454432, 0.0330169648, 0.0536028706, -0.0497129075, 0.0966591984, -0.124805987,
+ -0.082423687, -0.0515044816, 0.0231322292, 0.130053014, -0.109944403, 0.144403294, -0.0845312849, 0.0685306564,
+ 0.0952532962, 0.00103461824, -0.0119229294, 0.0040881224, 0.140647337, -0.000325238216, 0.000757269212, 0.0427705832,
+ 0.155582026, -0.00478899945, -0.0782169774},
+ {-0.579050004, 0.456353992, 0.0295837484, 0.0810229331, 0.110328488, 0.0420724191, 0.050499171, 0.134771183,
+ -0.0625161082, -0.0464896485, -0.0148950368, -0.0247010048, 0.0452727154, -0.0598820895, 0.193118423, -0.00318598771,
+ -0.00731150666, 0.0971256569, 0.0108000766, 0.160293519, 0.0459034592, 0.00420842972, 0.134508863, 0.0377153382,
+ 0.0310785193, 0.116767183, -0.0212338604},
+ {0.492659539, -0.440205097, -0.1786699, -0.14724575, -0.146198928, 0.0497965477, 0.0124387546, 0.100123711,
+ -0.123940602, -0.0283736996, 0.0403211005, 0.147481978, 0.0415745042, 0.00405436335, -0.150250316, 0.0711188614,
+ -0.000899086765, -0.116314314, -0.0729056522, -0.0609736517, -0.150646538, -0.0844909176, -0.0804084763, -0.0814922377,
+ -0.00574966893, -0.0615304783, -0.130495623},
+ {0.375148445, -0.35052672, -0.21811676, -0.111509539, -0.111186869, -0.0975456983, 0.0201611463, 0.0519107096,
+ -0.0776508376, -0.211821184, 0.0204374492, -0.160981134, -0.0669252574, -0.11746414, -0.119440816, -0.110870838,
+ -0.0161191821, 0.147800952, -0.0731140003, 0.0409589112, -0.152980223, -0.0631486773, 0.024988275, -0.0637564436,
+ 0.05677123, -0.151989713, 0.146640077},
+ {-0.537738979, 0.155770138, 0.0717488229, 0.154025748, -0.0575252771, 0.178430438, -0.0433261469, 0.0817758739,
+ -0.037413165, 0.115568593, -0.016169101, 0.059824802, 0.0719826445, 0.0910876915, 0.0896192044, -0.0639773533,
+ 0.0665314645, 0.0056780125, -0.0497693233, 0.0644020513, 0.0495124944, -0.0795804262, 0.00850042328, 0.126630023,
+ -0.108872443, 0.047845453, 0.118190601},
+ {0.397517473, -0.496414095, -0.134717777, -0.121990517, -0.0415601805, -0.15664281, -0.142036721, -0.103453189,
+ -0.087386325, 0.0575556234, 0.0110460855, -0.0624599159, -0.0119338734, -0.0386830419, -0.0431415178, -0.0480975658,
+ 0.0445168614, 0.017456213, -0.00431484589, 0.0308391713, 0.00833894685, -0.0886696875, -0.183318466, -0.121195629,
+ -0.0626910776, -0.109209515, -0.175251946},
+ {0.443285644, -0.376179397, -0.0270347875, 0.135097116, -0.0652561337, 0.0533783548, -0.014442821, 0.0201152023,
+ 0.00358327036, -0.0973063484, -0.171811253, 0.0935230479, -0.0994925722, -0.0457014367, -0.0259426255, -0.0118914824,
+ 0.00667368574, 0.00211936398, -0.12007203, 0.112607278, 0.0472122319, -0.00623246795, 0.107382551, -0.137344256,
+ -0.0901683196, -0.114172265, -0.0637115687},
+ {0.481253833, -0.459548533, -0.00186790479, -0.0670129359, 0.0119494796, -0.132754967, -0.100173682, 0.00466447277,
+ -0.178400099, -0.118565761, -0.143831864, -0.0246553589, -0.102533117, -0.107857428, -0.120118216, -0.100659706,
+ -0.0394478105, -0.0107691484, 0.0909453034, -0.0510972999, -0.0987442434, 0.0210721195, -0.135219529, -0.136416972,
+ 0.0104762809, -0.0321881138, -0.080034934},
+ {0.478051156, -0.390066892, -0.0616386048, -0.0139461271, -0.12503244, -0.0886834487, 0.0696618259, -0.122561499,
+ -0.127830952, -0.135499537, -0.0724472106, 0.0503810309, -0.0329925232, -0.121970139, -0.0805257484, -0.0517395064,
+ 0.127011746, -0.105815455, -0.117574736, -0.171412915, 0.00718646124, -0.0142810643, -0.108239599, -0.113955647,
+ -0.115745522, -0.186678171, 0.0428371988},
+ {0.500688553, -0.457732707, 0.0468688384, -0.0812474936, 0.0559192821, 0.0192655697, -0.00432712026, -0.0348228589,
+ 0.0680508986, -0.0765108988, 0.0665702373, 0.0890227407, 0.110584609, 0.0915147886, 0.00808657613, 0.0324192569,
+ 0.152577803, 0.0244663972, -0.133136615, -0.0185757652, -0.179004312, 0.114306241, -0.0481279902, -0.0929322466,
+ 0.0698894933, -0.154856935, -0.0797469243},
+ {-1.10205662, 0.0431513935, 0.0359299965, 0.0410667099, -0.0479542539, 0.0948511511, 0.12424472, 0.0309509933,
+ 0.0864339918, 0.029587606, 0.0145721287, 0.0853804871, 0.132514894, 0.106967807, 0.0772302672, 0.114916787,
+ 0.125742197, -0.00166881434, 0.0482046753, -0.00177590875, 0.137009561, 0.0597598515, 0.178690583, 0.0321583077,
+ 0.0264418647, -0.0577933304, 0.143539712},
+ {-0.169617161, 0.753173649, -0.0357469134, -0.143619597, -0.0365971848, 0.0783468112, -0.00600597309, -0.0300697405,
+ 0.0504271351, 0.129783496, 0.0770770609, 0.133545205, 0.0330213122, -0.00300192437, 0.021057032, -0.0731424466,
+ -0.0704107434, 0.153760269, 0.122179128, -0.0806687102, 0.0635517538, -0.0575274974, -0.000880315551, 0.0180198345,
+ 0.0463861525, 0.0521901958, 0.114362903},
+ {0.541069031, -0.373762012, -0.00346784736, -0.114745341, 0.0749837831, 0.023730997, 0.119919084, 0.0436235741,
+ 0.0766937137, -0.0944101363, 0.0768890977, 0.0154710021, -0.0146260886, -0.0396183915, -0.15101184, -0.103892073,
+ 0.032796409, 0.01677504, -0.0131742777, -0.122963153, 0.0478341803, -0.0416218005, 0.0621234663, -0.0900596976,
+ -0.095683597, 0.0570060574, -0.148392186},
+ {0.621991098, -0.412671417, 0.109054297, 0.152968824, -0.109320141, -0.0486302823, 0.105001248, -0.0630277395,
+ 0.0720740482, 0.00874471292, -0.118035778, -0.0964144766, -0.0285033491, -0.118909054, -0.134643853, 0.138064712,
+ -0.0398782529, 0.119126923, -0.148600459, -0.07180015, -0.00132761989, -0.0327637903, 0.0603960119, 0.110346965,
+ 0.0160790533, 0.0838280022, 0.0681004152},
+ {0.267255366, -0.300656796, -0.308595836, 0.0114773903, -0.00455049379, -0.188414246, -0.000839192071, -0.160705596,
+ -0.0327411033, 0.0353504717, -0.148212522, 0.0458654165, 0.0401847027, 0.00880304165, -0.00134926476, 0.151421279,
+ 0.0980324224, -0.155263439, 0.0947797149, -0.0275884662, -0.010804561, -0.0862751678, -0.0493875332, -0.16067642,
+ 0.0359508097, -0.0833133236, 0.0724551156},
+ {-0.579416513, 0.183669999, 0.156003579, 0.0300249904, 0.0622566901, -0.0566965528, -0.0361310914, 0.0524020791,
+ -0.030924283, -0.0140644573, 0.027700752, 0.101386458, 0.0708734393, 0.0798268691, 0.0485159382, -0.0826731846,
+ -0.0398858935, -0.121528007, 0.160635203, 0.0963176936, 0.00677957386, 0.0833255649, 0.0618095621, -0.0827444941,
+ 0.160995021, 0.103194773, 0.0617046356},
+ {0.676655293, -0.388367414, 0.0809247419, 0.0668345466, -0.171927795, 0.0357040837, 0.0894320607, 0.0448640287,
+ 0.0496236421, 0.0481129847, -0.0973136052, 0.161646038, -0.113477305, 0.04949544, 0.0729649812, -0.0361371897,
+ 0.0662086233, -0.00700450502, -0.116499677, -0.0211075936, 0.070632197, 0.0159394443, -0.0889575556, -0.0802729949,
+ 0.0583706349, 0.068704322, 0.0971004963},
+ {-0.851525426, 0.0957234949, 0.052559007, 0.0460673496, 0.0693054795, 0.0644561276, 0.11398416, 0.021627564,
+ 0.0437199362, 0.103789032, -0.0312068891, -0.0665286854, 0.0249293167, 0.0493387133, 0.0870543793, -0.0129110338,
+ 0.193294987, 0.15596509, 0.00858440436, 0.0967156887, -0.0302792024, 0.0566488765, 0.0778378099, -0.0519785471,
+ -0.0802783072, 0.109945856, 0.093652375},
};
const float FIVE_dense_biases[FIVE_DENSE_NUM] =
{
- 0.448750377, 0.403760582, 0.343976527, -0.255637884, 0.287142545, 0.484369278, 0.346042812, 0.353629231,
- -0.132978559, 0.0292666871, 0.33778137, 0.327351302, 0.3948856, 0.282039821, -0.0324714705, -0.129281044,
- -0.21987389, -0.030962348, -0.0587515272, 0.184871286, -0.0846855566, -0.151341617, 0.369707227, -0.188353449,
- 0.355887353, -0.0255241822, -0.210587487, 0.235232681, 0.284036249, 0.459257066, -0.451358795, -0.112674445,
- -0.207122475, -0.0463822149, 0.156282499, 0.413409323, -0.0411145575, 0.173950806, -0.0794503465, -0.244166583,
- 0.220132127, 0.398949623, 0.248157859, -0.050257463, 0.392109722, -0.144541204, 0.485850841, 0.29079178,
- -0.339778692, -0.0887532607, -0.0737924799, -0.249317899, -0.335118115, -0.151358426, 0.466078371, -0.0393950865,
- 0.407593697, 0.364170969, -0.231799334, 0.383101225, -0.136441469, 0.524635255, 0.312647462, -0.0535623394
+ 0.0607186109, -0.0681320056, 0.00174399419, -0.0552374087, 0.169119328, 0.059536662, 0.121260114, 0.0594619587,
+ 0.123958312, 0.142431423, -0.066357702, 0.1571486, 0.0430835485, 0.0681126416, 0.218000457, 0.0866415352,
+ -0.0935378969, 0.18506594, -0.0619109422, -0.0327474251, 0.279266626, 0.247783005, 0.0759725198, 0.267866522,
+ 0.0564821772, 0.162609458, 0.116303787, 0.0144420909, 0.0144254379, 0.0594321191, 0.0713874102, 0.120119229,
+ -0.0792147592, 0.151572526, 0.0799025595, 0.241775259, 0.132559836, 0.221947417, -0.0514785275, 0.188967034,
+ 0.196275517, 0.0211338401, 0.128358856, -0.0350252055, 0.194681481, 0.125860646, -0.104203798, 0.0794227272,
+ -0.0228515472, 0.156887457, 0.10330575, 0.18149218, 0.160906896, 0.250343442, 0.239296943, 0.0897175968,
+ 0.0577574857, -0.0525054261, -0.0180928297, -0.0237387344, -0.0620574579, -0.0873452052, 0.0453474857, 0.117129661
};
const float FIVE_logit_weights[FIVE_DENSE_NUM] NN_ALIGNED =
{
- -0.371308535, -0.405355245, -0.377181888, 0.497233629, -0.250674397, -0.429564774, -1.11061406, -0.296319515,
- 0.23601149, 0.243570864, -0.24711068, -0.369821012, -0.335140526, -0.493516713, 0.214400083, 0.474441826,
- 0.155431896, 0.203262046, 0.336635977, -0.23676908, 0.109814323, 0.444532424, -0.370563239, 0.360269755,
- -0.278772235, 0.17623356, 0.379497468, -0.263965845, -0.396779865, -0.319404095, 0.251259804, 0.409782857,
- 0.351485848, 0.366804957, -0.178924903, -0.297108471, 0.144363016, -0.16299139, 0.124468893, 0.280428141,
- -0.374722838, -0.71489042, -0.22734572, 0.310074896, -0.339080572, 0.387652963, -0.476010561, -0.23891817,
- 0.158733234, 0.128290251, 0.344814301, 0.395800322, 0.244534045, 0.224248424, -0.349556744, 0.367600739,
- -0.529881656, -0.339196235, 0.28590101, -0.340338498, 0.524476707, -0.638551593, -0.325753361, 0.121846914
+ 0.366290689, -0.179763243, -0.170635402, 0.358551443, -0.301865429, -0.204198688, -0.18824023, 0.368638158,
+ 0.29080224, -0.110242181, 0.260225922, 0.333086222, -0.242419481, 0.257134348, -0.183402345, -0.260596663,
+ -0.272571802, 0.304102749, 0.33268097, 0.333681524, -0.446022332, -0.248471856, -0.232226282, -0.329673767,
+ -0.238541022, -0.486667186, -0.209973752, 0.601931572, 0.395690441, 0.195730135, 0.266417474, -0.295594722,
+ 0.409933716, -0.158102736, 0.31490761, -0.293863147, -0.134037212, -0.291068882, 0.193977296, -0.144613206,
+ 0.299789637, -0.232466415, -0.251558155, -0.20994027, -0.279022664, -0.185697749, 0.142207414, 0.255289674,
+ -0.258415729, -0.143972635, 0.151671469, -0.366263509, -0.123788796, -0.322885275, -0.363797396, -0.156830251,
+ 0.550342262, 0.203263223, -0.183517739, -0.203325212, -0.108895399, 0.191670418, -0.131806001, 0.275587142
};
-const float FIVE_logit_bias = -0.178311273;
+const float FIVE_logit_bias = -0.0882488862;
#endif \ No newline at end of file
diff --git a/src/nn_train.py b/src/nn_train.py
index 5332aa8..a97c964 100755
--- a/src/nn_train.py
+++ b/src/nn_train.py
@@ -3,7 +3,7 @@
# /// script
# requires-python = ">=3.14"
# dependencies = [
-# "pandas>=3.0.5",
+# "numpy>=2.5.3",
# "torch>=2.14.0",
# "tqdm>=4.70.0",
# ]
@@ -39,13 +39,12 @@ from math import log, ceil
import argparse
import concurrent.futures
-import copy
+import json
import os
from pathlib import Path
import subprocess
import numpy as np
-import pandas as pd
import torch
from tqdm import tqdm
@@ -94,28 +93,51 @@ def _fmt_matrix(mat: np.ndarray, per_line: int = 8) -> str:
# ===================================================================
+# Config
+# ===================================================================
+
+
+@dataclass(frozen=True)
+class DataGenConfig:
+ size: int
+ depth: int
+ min_ply: int
+ games: int
+ procs: int
+ replay_iters: int
+
+
+@dataclass(frozen=True)
+class TrainingConfig:
+ smooth_factor: float
+ epochs: int
+ batch: int
+ lr: float
+ val_frac: float
+
+
+# ===================================================================
# Self-play records
# ===================================================================
-def td_lambda_targets(
+def smooth(
leaf_values: Tensor,
result: float,
- td_lambda: float,
+ lam: float,
) -> Tensor:
+ # Smooth(leaf_values, result, lambda), rooted at the game outcome:
+ # G[-1] = result, G[t] = (1-lambda)V[t] + lambda G[t+1]
targets = torch.empty_like(leaf_values)
targets[-1] = result
- # G[t] = (1-lambda)V[t+1] + lambda G[t+1]
for ply in range(len(leaf_values) - 2, -1, -1):
- targets[ply] = (1.0 - td_lambda) * leaf_values[ply + 1] + td_lambda * targets[
- ply + 1
- ]
+ targets[ply] = (1.0 - lam) * leaf_values[ply] + lam * targets[ply + 1]
return targets
-SPOOKY: int = 3
+SPOOKY: int = 4
@dataclass
@@ -133,14 +155,38 @@ class Performance:
@dataclass(frozen=True)
+class DataSplit:
+ train_positions: Tensor
+ train_targets: Tensor
+ train_parity_signs: Tensor
+ val_positions: Tensor
+ val_targets: Tensor
+ val_parity_signs: Tensor
+
+ def batches(self, batch_size: int) -> Iterator[tuple[Tensor, Tensor, Tensor]]:
+ order = torch.randperm(
+ len(self.train_positions), device=self.train_positions.device
+ )
+ for start in range(0, len(order), batch_size):
+ idx = order[start : start + batch_size]
+ yield (
+ self.train_positions[idx],
+ self.train_targets[idx],
+ self.train_parity_signs[idx],
+ )
+
+
+@dataclass(frozen=True)
class CandidateRecords:
- positions: list[Tensor] # [n, inp_dim]
- game_ids: list[Tensor] # [n]
- results: list[Tensor] # [n]
- cand_results: list[Tensor] # [n]
- terminals: list[Tensor] # [n]
- terminal_values: list[Tensor] # [n]
- parity_signs: list[Tensor] # [n]
+ positions: Tensor # [n, inp_dim] net input of the root state s_t
+ leaf_positions: Tensor # [n, inp_dim] net input of the PV leaf pv_t
+ game_ids: Tensor # [n]
+ results: Tensor # [n] game result R, black's perspective
+ cand_results: Tensor # [n] R from the recorded candidate's perspective
+ parity_signs: Tensor # [n] root parity
+ leaf_parity_signs: Tensor # [n] leaf parity
+ leaf_terminals: Tensor # [n] leaf is an exact terminal
+ leaf_terminal_values: Tensor # [n] exact terminal value, black's perspective
def performance(self) -> Performance:
result = Performance(0, 0, 0)
@@ -156,107 +202,176 @@ class CandidateRecords:
result.draw += 1
return result
- def make_training_data(
- self, model: Module, td_lambda: float
- ) -> tuple[Tensor, Tensor, Tensor]:
+ def make_training_data(self, model: Module, training: TrainingConfig) -> DataSplit:
model.eval()
with torch.no_grad():
- values = model(self.positions) * self.parity_signs
+ # Net(pv_t), black's perspective; exact terminals override the net
+ leaf_values = model(self.leaf_positions) * self.leaf_parity_signs
+ leaf_values = torch.where(
+ self.leaf_terminals, self.leaf_terminal_values, leaf_values
+ )
- targets = torch.empty_like(values)
+ targets = torch.empty_like(leaf_values)
for game_id in torch.unique(self.game_ids):
in_game = self.game_ids == game_id
- game_terminals = self.terminals[in_game]
- game_terminal_values = self.terminal_values[in_game]
- game_values = values[in_game].clone()
- game_values[game_terminals] = game_terminal_values[game_terminals]
game_result = self.results[in_game][0].item()
- game_targets = td_lambda_targets(game_values, game_result, td_lambda)
- # Terminal positions are also direct supervised examples. Do this
- # after constructing the TD sequence so it does not reset the EMA.
- game_targets[game_terminals] = game_terminal_values[game_terminals]
- targets[in_game] = game_targets
+ # self-pair games (i,i) record the candidate on every ply,
+ # so smooth one chain per colour, not across players
+ for sign in (1.0, -1.0):
+ idxs = torch.nonzero(
+ in_game & (self.parity_signs == sign), as_tuple=True
+ )[0]
+ if len(idxs) == 0:
+ continue
+ targets[idxs] = smooth(
+ leaf_values[idxs], game_result, training.smooth_factor
+ )
+
+ n_val = max(1, int(len(leaf_values) * training.val_frac))
+ perm = torch.randperm(len(leaf_values), device=leaf_values.device)
+ val_idx, train_idx = perm[:n_val], perm[n_val:]
- return self.positions, targets, self.parity_signs
+ return DataSplit(
+ train_positions=self.positions[train_idx],
+ train_targets=targets[train_idx],
+ train_parity_signs=self.parity_signs[train_idx],
+ val_positions=self.positions[val_idx],
+ val_targets=targets[val_idx],
+ val_parity_signs=self.parity_signs[val_idx],
+ )
@dataclass(frozen=True)
class PlayRecords:
positions: list[Tensor] # [candidate, n_i, inp_dim]
+ leaf_positions: list[Tensor] # [candidate, n_i, inp_dim]
game_ids: list[Tensor] # [candidate, n_i]
results: list[Tensor] # [candidate, n_i]
cand_results: list[Tensor] # [candidate, n_i]
- terminals: list[Tensor] # [candidate, n_i]
- terminal_values: list[Tensor] # [candidate, n_i]
parity_signs: list[Tensor] # [candidate, n_i]
+ leaf_parity_signs: list[Tensor] # [candidate, n_i]
+ leaf_terminals: list[Tensor] # [candidate, n_i]
+ leaf_terminal_values: list[Tensor] # [candidate, n_i]
def index(self, index: int) -> CandidateRecords:
return CandidateRecords(
positions=self.positions[index],
+ leaf_positions=self.leaf_positions[index],
game_ids=self.game_ids[index],
results=self.results[index],
cand_results=self.cand_results[index],
- terminals=self.terminals[index],
- terminal_values=self.terminal_values[index],
parity_signs=self.parity_signs[index],
+ leaf_parity_signs=self.leaf_parity_signs[index],
+ leaf_terminals=self.leaf_terminals[index],
+ leaf_terminal_values=self.leaf_terminal_values[index],
)
@classmethod
- def load_selfplay(cls, fn, size):
- df = pd.read_csv(fn, header=None)
+ def load_merge(cls, files: list[Path], size: int) -> PlayRecords:
+ # one JSON record per line:
+ # {"result": R, "rows": [{"cand", "root": {...}, "leaf": {...}}]}
inp_dim = NET_DIMS[size][0]
+ n_cells = inp_dim - 2
+
+ games: list[dict] = []
+ for file in files:
+ with open(file) as f:
+ for line in f:
+ if line.strip():
+ games.append(json.loads(line))
- fields = {
- "parity_signs": df.iloc[:, 0].to_numpy(dtype=np.float32),
- "positions": df.iloc[:, 1 : inp_dim + 1].to_numpy(dtype=np.float32),
- "results": df.iloc[:, inp_dim + 1].to_numpy(dtype=np.float32),
- "terminals": df.iloc[:, inp_dim + 2].to_numpy(dtype=np.bool_),
- "terminal_values": df.iloc[:, inp_dim + 3].to_numpy(dtype=np.float32),
- "game_ids": df.iloc[:, inp_dim + 4].to_numpy(dtype=np.int64),
- "cand_results": df.iloc[:, inp_dim + 6].to_numpy(dtype=np.float32),
- }
- cand_ids = df.iloc[:, inp_dim + 5].to_numpy(dtype=np.int64)
+ def board(row_part: dict) -> list[float]:
+ return [*row_part["head"], *row_part["cells"]]
- n_cands = int(cand_ids.max()) + 1
- gathered = {k: [] for k in fields}
- for cid in range(n_cands):
- mask = cand_ids == cid
- for k, arr in fields.items():
- gathered[k].append(torch.from_numpy(arr[mask]))
+ n_cands = max(r["cand"] for g in games for r in g["rows"]) + 1
+ fields = (
+ "positions",
+ "leaf_positions",
+ "game_ids",
+ "results",
+ "cand_results",
+ "parity_signs",
+ "leaf_parity_signs",
+ "leaf_terminals",
+ "leaf_terminal_values",
+ )
+ per_cand = {c: {k: [] for k in fields} for c in range(n_cands)}
+ for game_id, game in enumerate(games):
+ result = float(game["result"])
+ for cand in range(n_cands):
+ rows = [r for r in game["rows"] if r["cand"] == cand]
+ if not rows:
+ continue
+ for part in ("root", "leaf"):
+ for r in rows:
+ if len(r[part]["cells"]) != n_cells:
+ raise ValueError(
+ f"{files[-1]}: {len(r[part]['cells'])} cells, "
+ f"expected {n_cells} for size {size}"
+ )
+ parity = np.array([r["root"]["parity"] for r in rows], dtype=np.float32)
+ per_cand[cand]["positions"].append(
+ torch.from_numpy(
+ np.array([board(r["root"]) for r in rows], dtype=np.float32)
+ )
+ )
+ per_cand[cand]["leaf_positions"].append(
+ torch.from_numpy(
+ np.array([board(r["leaf"]) for r in rows], dtype=np.float32)
+ )
+ )
+ per_cand[cand]["game_ids"].append(
+ torch.full((len(rows),), game_id, dtype=torch.int64)
+ )
+ per_cand[cand]["results"].append(
+ torch.full((len(rows),), result, dtype=torch.float32)
+ )
+ per_cand[cand]["cand_results"].append(torch.from_numpy(parity * result))
+ per_cand[cand]["parity_signs"].append(torch.from_numpy(parity))
+ per_cand[cand]["leaf_parity_signs"].append(
+ torch.from_numpy(
+ np.array([r["leaf"]["parity"] for r in rows], dtype=np.float32)
+ )
+ )
+ per_cand[cand]["leaf_terminals"].append(
+ torch.from_numpy(
+ np.array(
+ [r["leaf"]["terminal"] == 1 for r in rows],
+ dtype=np.bool_,
+ )
+ )
+ )
+ per_cand[cand]["leaf_terminal_values"].append(
+ torch.from_numpy(
+ np.array(
+ [r["leaf"]["terminal_value"] for r in rows],
+ dtype=np.float32,
+ )
+ )
+ )
- return cls(**gathered)
+ def merged(cand: int, k: str, empty: Tensor) -> Tensor:
+ blocks = per_cand[cand][k]
+ return torch.concat(blocks, dim=0) if blocks else empty
- @classmethod
- def load_merge(cls, files: list[Path], size: int) -> PlayRecords:
- sprs = [PlayRecords.load_selfplay(file, size) for file in files]
- # for each field, gather [file0[i], file1[i], ...] for every index i
- # and concat along dim 0 -> merged list indexed by cand id
return cls(
- positions=[
- torch.concat(vals, dim=0) for vals in zip(*(s.positions for s in sprs))
- ],
- game_ids=[
- torch.concat(vals, dim=0) for vals in zip(*(s.game_ids for s in sprs))
- ],
- results=[
- torch.concat(vals, dim=0) for vals in zip(*(s.results for s in sprs))
- ],
- cand_results=[
- torch.concat(vals, dim=0)
- for vals in zip(*(s.cand_results for s in sprs))
- ],
- terminals=[
- torch.concat(vals, dim=0) for vals in zip(*(s.terminals for s in sprs))
- ],
- terminal_values=[
- torch.concat(vals, dim=0)
- for vals in zip(*(s.terminal_values for s in sprs))
- ],
- parity_signs=[
- torch.concat(vals, dim=0)
- for vals in zip(*(s.parity_signs for s in sprs))
- ],
+ **{
+ k: [
+ merged(
+ cand,
+ k,
+ torch.empty(
+ (0, inp_dim) if k.endswith("positions") else (0,),
+ dtype=torch.float32
+ if k not in ("game_ids", "leaf_terminals")
+ else (torch.int64 if k == "game_ids" else torch.bool),
+ ),
+ )
+ for cand in range(n_cands)
+ ]
+ for k in fields
+ }
)
@@ -282,55 +397,29 @@ class Net(Module):
return tanh(self.output(hidden)).squeeze(-1)
def fit(
- self,
- *,
- records: CandidateRecords,
- td_lambda: float,
- val_frac: float,
- epochs: int,
- batch: int,
- lr: float,
+ self, *, records: CandidateRecords, training: TrainingConfig
) -> tuple[float, float]:
# training widgets
- optimizer = torch.optim.AdamW(self.parameters(), lr=lr)
+ optimizer = torch.optim.AdamW(self.parameters(), lr=training.lr)
loss_fn = MSELoss()
- pbar = tqdm(range(epochs), desc="train", unit="ep")
+ pbar = tqdm(range(training.epochs), desc="train", unit="ep")
for _ in pbar:
- # make data
- positions, targets, parity_signs = records.make_training_data(
- self, td_lambda
- )
- n = len(positions)
- perm = torch.randperm(n, device=positions.device)
- n_val = max(1, int(n * val_frac))
- val_idx = perm[:n_val]
- train_idx = perm[n_val:]
-
- val_positions = positions[val_idx]
- val_targets = targets[val_idx]
- val_parity_signs = parity_signs[val_idx]
- train_positions = positions[train_idx]
- train_targets = targets[train_idx]
- train_parity_signs = parity_signs[train_idx]
+ split = records.make_training_data(self, training)
self.train()
- order = torch.randperm(len(train_positions), device=positions.device)
- for start in range(0, len(train_positions), batch):
- batch_idx = order[start : start + batch]
+ for positions, targets, parity_signs in split.batches(training.batch):
optimizer.zero_grad()
- predictions = (
- self(train_positions[batch_idx]) * train_parity_signs[batch_idx]
- )
- loss = loss_fn(predictions, train_targets[batch_idx])
+ predictions = self(positions) * parity_signs
+ loss = loss_fn(predictions, targets)
loss.backward()
optimizer.step()
with torch.no_grad():
self.eval()
- predictions = self(val_positions) * val_parity_signs
- mse = loss_fn(predictions, val_targets).item()
- corr = torch.corrcoef(torch.stack([predictions, val_targets]))[
+ predictions = self(split.val_positions) * split.val_parity_signs
+ mse = loss_fn(predictions, split.val_targets).item()
+ corr = torch.corrcoef(torch.stack([predictions, split.val_targets]))[
0, 1
].item()
@@ -426,39 +515,30 @@ def cand_copy_for(size: int, id: int, root: Path) -> None:
# ===================================================================
-def setup(num_candidates: int, size: int, root: Path) -> list[Net]:
- inp_dim, hidden = NET_DIMS[size]
+def setup(num_candidates: int, data_gen: DataGenConfig, root: Path) -> list[Net]:
+ inp_dim, hidden = NET_DIMS[data_gen.size]
candidates = [Net(inp_dim, hidden) for _ in range(num_candidates)]
for id, cand in enumerate(candidates):
cand.to_c(
- size=size,
+ size=data_gen.size,
id=id,
- path=root / "include" / f"cand_{id}_weights_{size}.c",
+ path=root / "include" / f"cand_{id}_weights_{data_gen.size}.c",
note=f"{id=}, v000, random init",
)
- cand_copy_for(6 if size == 5 else 5, id, root)
+ cand_copy_for(6 if data_gen.size == 5 else 5, id, root)
return candidates
def run_step(
*,
- batch: int,
candidates: list[Net],
- depth: int,
- epochs: int,
- games: int,
+ data_gen: DataGenConfig,
iter: int,
- lr: float,
- min_ply: int,
- procs: int,
- replay_iters: int,
root: Path,
- size: int,
- td_lambda: float,
- val_frac: float,
+ training: TrainingConfig,
):
- def csv_path(i: int) -> Path:
- return root / "data" / f"selfplay-{size}-v{i:03d}.csv"
+ def data_path(i: int) -> Path:
+ return root / "data" / f"selfplay-{data_gen.size}-v{i:03d}.json"
print(f"\n== iteration {iter} ==")
@@ -474,30 +554,40 @@ def run_step(
)
# 2. generate self-play data
- csv = csv_path(iter)
- print(f"selfplay: {num_candidates=}, {games=}, {size=}, {depth=}, {min_ply=}")
- out_rows: list[str] = []
+ data = data_path(iter)
+ print(
+ f"selfplay: {num_candidates=}, {data_gen.games=}, "
+ f"{data_gen.size=}, {data_gen.depth=}, {data_gen.min_ply=}"
+ )
+ out_games: list[str] = []
for out in fan_out(
[
- [f"./selfplay-{i}-{j}", str(size), str(depth), str(min_ply)]
+ [
+ f"./selfplay-{i}-{j}",
+ str(data_gen.size),
+ str(data_gen.depth),
+ str(data_gen.min_ply),
+ ]
for (i, j) in cand_pairs
],
- games,
- procs,
+ data_gen.games,
+ data_gen.procs,
"selfplay",
root,
):
- out_rows.extend(out.splitlines())
- print(f"writing {len(out_rows):,} rows to {csv}")
- with open(csv, "w") as f:
- _ = f.write("\n".join(out_rows))
- if out_rows:
+ out_games.extend(out.splitlines())
+ print(f"writing {len(out_games):,} games to {data}")
+ with open(data, "w") as f:
+ _ = f.write("\n".join(out_games))
+ if out_games:
_ = f.write("\n")
# 3. compute performance
- csvs = [csv_path(i) for i in range(max(iter - replay_iters, 1), iter + 1)]
- print("Loading data from", [str(c) for c in csvs], "...", end=" ")
- records = PlayRecords.load_merge(csvs, size)
+ data_files = [
+ data_path(i) for i in range(max(iter - data_gen.replay_iters, 1), iter + 1)
+ ]
+ print("Loading data from", [str(c) for c in data_files], "...", end=" ")
+ records = PlayRecords.load_merge(data_files, data_gen.size)
print("candidates have", [f"{r.shape[0]:,}" for r in records.results], "rows.")
results = [
(i, cand, records.index(i).performance()) for i, cand in enumerate(candidates)
@@ -509,9 +599,9 @@ def run_step(
# 4. write champ
idx, champ, perf = max(results, key=lambda t: t[2].rate())
- path = root / "include" / f"weights_{size}.c"
+ path = root / "include" / f"weights_{data_gen.size}.c"
champ.to_c(
- size=size,
+ size=data_gen.size,
id=None,
path=path,
note=f"{iter=}, perf={str(perf)}, rate={perf.rate() * 100.0:.3f}",
@@ -520,20 +610,13 @@ def run_step(
_ = subprocess.run(["make", "native"], cwd=root, check=True, capture_output=True)
print(f"Wrote candidate {idx:03d} to {str(path)}")
- # 5. fine-tune on TD-leaf(lambda) targets -> candidate
+ # 5. fine-tune on the hybrid targets -> candidate
for idx, cand in enumerate(candidates):
- corr, mse = cand.fit(
- records=records.index(idx),
- td_lambda=td_lambda,
- val_frac=val_frac,
- epochs=epochs,
- batch=batch,
- lr=lr,
- )
+ corr, mse = cand.fit(records=records.index(idx), training=training)
cand.to_c(
- size=size,
+ size=data_gen.size,
id=idx,
- path=root / "include" / f"cand_{idx}_weights_{size}.c",
+ path=root / "include" / f"cand_{idx}_weights_{data_gen.size}.c",
note=f"id={idx}, v{iter:03d}, val_corr={corr:.4f}, val_mse={mse:.4f}",
)
@@ -546,7 +629,7 @@ def run_step(
def main() -> None:
root = Path(__file__).resolve().parent.parent
p = argparse.ArgumentParser(
- description="the TD(lambda) self-play bootstrap loop",
+ description="Train the neural network evaluators of ctak",
formatter_class=argparse.ArgumentDefaultsHelpFormatter,
)
_ = p.add_argument(
@@ -577,19 +660,19 @@ def main() -> None:
_ = p.add_argument(
"--replay-iters",
type=int,
- default=0,
+ default=10,
help="number of previous data sources to retain",
)
_ = p.add_argument(
- "--td-lambda",
+ "--smooth-factor",
type=float,
default=0.7,
- help="TD(lambda) lambda",
+ help="The EMA smoothing factor",
)
_ = p.add_argument(
"--epochs",
type=int,
- default=20,
+ default=5,
help="candidate training epochs",
)
_ = p.add_argument(
@@ -626,7 +709,7 @@ def main() -> None:
"--min-ply",
type=int,
default=8,
- help="record positions at this ply or later",
+ help="length of random opening in games",
)
args = p.parse_args()
@@ -642,28 +725,35 @@ def main() -> None:
)
)
+ data_gen = DataGenConfig(
+ size=args.size,
+ depth=args.depth,
+ min_ply=args.min_ply,
+ games=args.games,
+ procs=args.procs,
+ replay_iters=args.replay_iters,
+ )
+ training = TrainingConfig(
+ smooth_factor=args.smooth_factor,
+ epochs=args.epochs,
+ batch=args.batch,
+ lr=args.lr,
+ val_frac=args.val_frac,
+ )
+
(root / "data").mkdir(exist_ok=True)
- candidates = setup(num_candidates=args.num_candidates, size=args.size, root=root)
+ candidates = setup(num_candidates=args.num_candidates, data_gen=data_gen, root=root)
num_params = sum(p.numel() for p in candidates[0].parameters() if p.requires_grad)
print(f"Number of trainable parameters: {num_params:,}")
for iter in range(1, args.iters + 1):
run_step(
- batch=args.batch,
candidates=candidates,
- depth=args.depth,
- epochs=args.epochs,
- games=args.games,
+ data_gen=data_gen,
iter=iter,
- lr=args.lr,
- min_ply=args.min_ply,
- procs=args.procs,
- replay_iters=args.replay_iters,
root=root,
- size=args.size,
- td_lambda=args.td_lambda,
- val_frac=args.val_frac,
+ training=training,
)
print(f"\n== done, champion in include/weights_{args.size}.c ==")
diff --git a/src/selfplay.c b/src/selfplay.c
index 1d6bd84..b2a5821 100644
--- a/src/selfplay.c
+++ b/src/selfplay.c
@@ -91,10 +91,20 @@ static int8_t win_value(const enum WIN_TYPE w) {
}
}
+static void emit_board(const float *head, const uint8_t *cells,
+ const uint8_t n_cells) {
+ fprintf(stdout, "\"head\":[%.8f,%.8f],\"cells\":[", head[0], head[1]);
+ for (uint8_t c = 0; c < n_cells; c++)
+ fprintf(stdout, "%s%u", c ? "," : "", cells[c]);
+ fprintf(stdout, "]");
+}
+
static int play_game(const uint8_t min_ply, const nn_function fn_1,
const nn_function fn_2, const uint32_t cand_id_1,
const uint32_t cand_id_2,
- const uint32_t game_id, char record[][16], uint8_t replay) {
+ char record[][16], uint8_t replay) {
+ float root_head[MAX_PLY][2];
+ uint8_t root_cells[MAX_PLY][MAX_CELLS];
float row_head[MAX_PLY][2];
uint8_t row_cells[MAX_PLY][MAX_CELLS];
uint8_t row_term[MAX_PLY];
@@ -133,6 +143,10 @@ static int play_game(const uint8_t min_ply, const nn_function fn_1,
row_parity_sign[n_rows] = leaf->parity_sign;
row_cand_id[n_rows] = (state->current_colour&1) ? cand_id_1 : cand_id_2;
row_mover_sign[n_rows] = (state->current_colour&1) ? 1 : -1;
+
+ // Net input of the root state s_t, before the move is played
+ nn_prepare_head(root_head[n_rows], state);
+ nn_cell_idxs(root_cells[n_rows], state);
n_rows++;
}
@@ -155,13 +169,17 @@ static int play_game(const uint8_t min_ply, const nn_function fn_1,
// final outcome of the played game, from black's perspective
const int8_t R = win_value(state->won);
+ fprintf(stdout, "{\"result\":%d,\"rows\":[", R);
for (uint32_t k = 0; k < n_rows; k++) {
- fprintf(stdout, "%.1f,%.8f,%.8f,", row_parity_sign[k], row_head[k][0], row_head[k][1]);
- for (uint8_t c = 0; c < n_cells; c++)
- fprintf(stdout, "%u,", row_cells[k][c]);
- fprintf(stdout, "%i,%u,%.0f,%u,%u,%i\n", R, row_term[k], row_terminal_value[k], game_id, row_cand_id[k],
- row_mover_sign[k] * R);
+ fprintf(stdout, "%s{\"cand\":%u,\"root\":{\"parity\":%d,", k ? "," : "",
+ row_cand_id[k], row_mover_sign[k]);
+ emit_board(root_head[k], root_cells[k], n_cells);
+ fprintf(stdout, "},\"leaf\":{\"parity\":%.0f,", row_parity_sign[k]);
+ emit_board(row_head[k], row_cells[k], n_cells);
+ fprintf(stdout, ",\"terminal\":%u,\"terminal_value\":%.1f}}",
+ row_term[k], row_terminal_value[k]);
}
+ fprintf(stdout, "]}\n");
return (int)n_rows;
}
@@ -169,9 +187,9 @@ static int play_game(const uint8_t min_ply, const nn_function fn_1,
const char *usage =
"selfplay, one game of training data between candidates.\n\n\
Usage: selfplay <size> <depth> <min_ply>\n\n\
-Plays a single game of <size>x<size>, with <min_ply> moves made randomly. Only the deterministic plies are written to stdout, one CSV row per recorded search, from ply <min_ply> onwards:\n\n\
-\tparity_sign,mover_flats,opponent_flats,<cell ids...>,R,terminal,leaf_R,game_id,cand_id,cand_R\n\n\
-R is the outcome from black's perspective, cand_R the outcome from the recorded candidate's perspective. nn_train.py runs many of these in parallel to generate training data.\n\n\
+Plays a single game of <size>x<size>, with <min_ply> moves made randomly. Only the deterministic plies are written to stdout, one JSON record per game, from ply <min_ply> onwards:\n\n\
+\t{\"result\": R, \"rows\": [{\"cand\": id, \"root\": {\"parity\", \"head\", \"cells\"}, \"leaf\": {\"parity\", \"head\", \"cells\", \"terminal\", \"terminal_value\"}}]}\n\n\
+R is the outcome of the game from black's perspective. Each row records the net input of the root state s_t and the PV leaf selected at that ply; the leaf value Net(pv) is taken from the trained net. nn_train.py runs many of these in parallel to generate training data.\n\n\
Copyright (C) 2026, tslil clingman\n\n\
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.";
@@ -212,13 +230,11 @@ int main(int argc, char **argv) {
size == 5 ? FIVE_A : SIX_A, size == 5 ? FIVE_B : SIX_B,
CAND_A,
CAND_B,
- rand32(),
record, 0);
play_game(min_ply,
size == 5 ? FIVE_B : SIX_B, size == 5 ? FIVE_A : SIX_A,
CAND_B,
CAND_A,
- rand32(),
record, CAND_A == CAND_B ? 0: 1);