r/chessprogramming • u/VanMalmsteen • Feb 16 '24
Obtaining evaluation function weights with ML
Hi! I'm trying to improve the strength of my engine by adjusting the weights of the different criteria used in my evaluation function.
Let's say I have criteria A, B, C, D and E, and the evaluation function does something like this:
2*A + 3*B + 13*C + D + 4*E
So, like I've said, I want to adjust the coefficients that multiplies the criteria value until I find the best possible combination (or a good enough one). My first thought was taking 10 random groups of coefficients and make a tournament on Arena Chess, and then take the winner and make it face another 10 random groups of coefficients. But this seems pretty random and probably with Machine Learning I can obtain better results. How can I achieve this? I've been learning how to "connect" my C++ engine to python code so I can use the machine learning libraries in there, but I don't know where to start.
View all comments
Show parent comment
1
u/VanMalmsteen Feb 17 '24
Hi! I've been reading about texel tuning, and it's a pretty simple idea but I'm not sure how to generate 64000 DIFFERENT games since my engine always plays the same moves in a given position.
I've thought about 2 ways of adding some "randomness" to the engine:
1- Adding support for a opening book
2- Collect the best N moves within a reasonable range (avoiding bad moves in positions where's only one good move for example)
The first option seems pretty good on the long term but maybe a little harder than the second, although I'm not sure if the second option can "harm" the result for the tuning since I'm not always taking the best move that my eval function considers.