Thanks to everyone for the useful answers
After a couple of days trying different changes, deletions and additions, I decided to postpone the implementation of king safety, but I have not been idle
I have written a pretty simplistic SPSA tuning framework based on texel tuning. It takes a vector of parameters and optimizes them. It is multithreaded and works with up to (at least) 64 threads, although the performance decreases as the number of threads becomes larger than the number of CPU cores.
Due to its simplicity there are two issues:
1. It is not very effective when optimizing parameters with a big difference in value. When I tested it with piece values I had to optimize the queen values (multiple since there are both a middlegame and endgame value) separately from pawns, knights bishops and rooks.
2. The SPSA parameters that determine cn and an (see
https://en.wikipedia.org/wiki/Simultane ... roximation) has to be set by the user at the moment. These are called C_END and R_END. I intend to automatically determine these based on the evaluation function's sensitivity to changes in each individual parameter and its value.
I have tried to make the implementation very little engine-specific, in hopes that it will be easy for others to use in their own development
.
I also intend to change the algorithm to a mix between Adam and SPSA, which is not surprisingly called AdamSPSA (ref.
https://arxiv.org/pdf/1910.03591.pdf see page 3 and 4). The reason for this is because convergence were better the first time I created an evaluation tuner.
I just thought I would post about it here since it seems like a rather big part of creating a working king safety evaluation term.
The links to the two files are here:
https://github.com/BimmerBass/Loki/blob ... ki/texel.h and
https://github.com/BimmerBass/Loki/blob ... /texel.cpp. I would love to get some feedback about the implementation in case something is missing or faulty
NOTE: Since the branch is currently being worked upon, the code is pretty messy with a ton of commented out parts and probably some irrelevant comments which I've forgotten to delete when deleting the code they explained.
I hope this can be of help to others who might have a hard time determining good evaluation weights.