david-carteau / cerebrum

The Cerebrum library
Other
11 stars 3 forks source link

Positions.txt file #1

Closed ChrisWhittington closed 3 years ago

ChrisWhittington commented 3 years ago

Hi I was intrigued to work out why the format appears to be line = FEN with no side to move info, and white-eval; black-eval

Does that mean each FEN was analysed twice with wtm (to give white eval) and then with btm? Or is btm = -wtm?

Struggling to comprehend here, when NN gives only one output.

david-carteau commented 3 years ago

Each line must effectively contain a fen, without side to move (stm), and two evaluations : one from white point of view (as if the fen had been provided with stm = white), one from black point of view (idem, as if the fen had been provided with stm = black).

Both evaluations are used while training : the line is actually cloned, one with the fen + stm = white and eval from white point of view, the second with the fen + stm = black and eval from black point of view. It is as if we had provided to the trainer two distinct lines, representing the same position, but from each side point of view. It is a way to artificially double the number of positions used during training, while at the same time having a balanced coverage of all the 40960 features.

Thus, when you build the positions file, you have to provide a fen and two evals, one from white point of view, one from black point of view. You should for sure avoid providing positions where one player is in check (in this case, normally an engine does not rely on any evaluation, and search one ply deeper, trying to escape the check).

Here is a sample of what I used for training Orion : 1r2k2r/2q1bp2/p2ppp1p/8/bp1B1P2/5B2/PPPQ2PP/1K1RR3;1.56;-1.28 8/2k3K1/2P2R2/7p/8/8/8/7r;0.00;0.04 r2qk2r/pbpp2pp/1p3n2/2bPp3/2P1P3/P1NQ4/1P2N1PP/R1B1K2R;0.08;0.33 8/2n1kpp1/2Pp4/3PpP1P/1K2B3/1R6/4r3/8;2.25;-1.36 r3r1k1/pp1b2p1/5bnp/3p1p2/8/N1P1BN2/PP1R1PPP/4R1K1;0.18;-0.12 3q1rk1/p2bppbp/3p1np1/1p3P2/2rBP3/1NN5/PPP1Q1PP/R4R1K;-0.50;0.83 8/8/5p2/2P2k2/6pK/4P3/1B2P1bP/8;0.65;-0.55 1rb2rk1/p3ppbp/2pp2p1/q6n/4P3/1BN1BP2/PPPQ2PP/2KR3R;0.16;0.12 8/p1p3p1/1p4k1/r2P4/3P2p1/6Pp/2R4K/8;-6.40;7.77 8/2k5/p4p2/Pp1Bp3/1Pp1P3/2P2P2/8/2bK4;0.01;-0.05

You can see that evals from white and black points of view are not necesseraly the opposite of each other.

I hope my explanations were clear enough, on the contrary, do not hesitate to come back to me !

ChrisWhittington commented 3 years ago

Thanks, I just about managed to work that one out! Also explains the MINI_BATCH_SIZE divide by 2. Did you experiment the virtues of using black-white flipped evals against just one eval? Probably there aren't enough sample positions to say whether doubling samples by flipping or by using twice as many test positions works out best.

Did you look at Gary Linscott's data enhancement by adding another 64x10 inputs? I'm struggling to work out how that works. http://talkchess.com/forum3/viewtopic.php?f=7&t=75724&start=40

david-carteau commented 3 years ago

Did you experiment the virtues of using black-white flipped evals against just one eval? Probably there aren't enough sample positions to say whether doubling samples by flipping or by using twice as many test positions works out best.

No. I think that evaluation highly depends on whose side to move it is. Using one single (flipped) evaluation for both sides would not be reliable enough.

Did you look at Gary Linscott's data enhancement by adding another 64x10 inputs? I'm struggling to work out how that works. http://talkchess.com/forum3/viewtopic.php?f=7&t=75724&start=40

I yet did not understand that concept of "factorizer". I'll dig it when it will be possible (now that I have a working network, I won't modify it, I'm instead going to try a "zero" approach for the training).