I'm not very good at reading code (including my own after a while) but I would say what you added was correct - a bug fix in fact - because otherwise weight i will stay at -1 regardless of whether or not the error improved. (also see tuner.js in my repo which does the same).
I resisted switching to gradient descent for a long time, but it really is worth it in the long run. My own GD code is relatively slow (but still three orders of magnitude faster than my +1/-1 code) because I recompute the feature coefficients every time a position is (re)encountered. That was for memory reasons, but more usual I suspect is to measure the coefficients once and cache them.
PS: if your eval will always be linear, you could GD train using a 'neural' network with a single input layer and a (linear activated) output node for mg and eg (the maths is literally exactly the same I realised when implementing my net tuner). Then you can use an off the shelf trainer like PyTorch or TensorFlow. As I recall Zurichess is trained like this. And you also have the option of playing around a bit with the network later.
Stuck trying to come up with my own PST values
Moderator: Ras
-
- Posts: 547
- Joined: Tue Feb 04, 2014 12:25 pm
- Location: Gower, Wales
- Full name: Colin Jenkins
-
- Posts: 93
- Joined: Sun Aug 08, 2021 9:14 pm
- Full name: Kurt Peters
Re: Stuck trying to come up with my own PST values
I think I might have sorted it out.
First, once my previous test finally finished, all the values were ridiculously high (like multiple thousands, or even above 10,000). The original positions file didn't contain only quiet positions, so I had to manually filter it. I don't know if I missed any, but clearly something was bad with that dataset. I just decided to try one of the files provided by Zurichess (in a link elsewhere on these forums) that had only quiet positions. That immediately gave me numbers that actually looked reasonable.
I also tried something I read in another post: Have an array of deltas (one delta for each weight) and double that delta if the error was improved and halve the delta if the error was not improved. I think that's helped with the speed a bit; I can run through 1.4 million positions in about 2 hours now.
Some quick self-play tests at 1+0.01: strength seems to be about even versus the PeSTO values (which is a pretty good improvement over the untrained values, which was like a 50 Elo loss). Which is acceptable to me, since I get away from someone else's values without losing any strength. Will have to do some longer TC tests tonight.
Thanks for the help everyone.
First, once my previous test finally finished, all the values were ridiculously high (like multiple thousands, or even above 10,000). The original positions file didn't contain only quiet positions, so I had to manually filter it. I don't know if I missed any, but clearly something was bad with that dataset. I just decided to try one of the files provided by Zurichess (in a link elsewhere on these forums) that had only quiet positions. That immediately gave me numbers that actually looked reasonable.
I also tried something I read in another post: Have an array of deltas (one delta for each weight) and double that delta if the error was improved and halve the delta if the error was not improved. I think that's helped with the speed a bit; I can run through 1.4 million positions in about 2 hours now.
Some quick self-play tests at 1+0.01: strength seems to be about even versus the PeSTO values (which is a pretty good improvement over the untrained values, which was like a 50 Elo loss). Which is acceptable to me, since I get away from someone else's values without losing any strength. Will have to do some longer TC tests tonight.
Thanks for the help everyone.
-
- Posts: 1062
- Joined: Tue Apr 28, 2020 10:03 pm
- Full name: Daniel Infuehr
Re: Stuck trying to come up with my own PST values
KhepriChess wrote: ↑Fri Feb 25, 2022 6:15 am Some quick self-play tests at 1+0.01: strength seems to be about even versus the PeSTO values (which is a pretty good improvement over the untrained values, which was like a 50 Elo loss). Which is acceptable to me, since I get away from someone else's values without losing any strength. Will have to do some longer TC tests tonight.
Thanks for the help everyone.
The obvious solution was never mentioned by anyone here:
Gradient descent.
The beauty about this is that one score delta (ELO/Strength) will update all your values correctly into the right direction at once!
So here is what you can do:
All you need to do is rewrite the PeSTO in terms of matrix multiplication (8x8 input matrix multiplied with 8x8 PeSTO) gives 8x8 scores that need to be summed to get the eval. That is the score is what you order your alphabeta tree on. With a fixed depth you should just selfplay a few thousand of games with randomized PeSTO inputs and as a solution you will get thousands of possibilities that will be stronger than the fixed values you posted at the beginning.
Also
Publish the better values once you are done! Nothing is preventing anyone to use float values or generally go to uint32 - which will yield improvement also.
Worlds-fastest-Bitboard-Chess-Movegenerator
Daniel Inführ - Software Developer
Daniel Inführ - Software Developer
-
- Posts: 547
- Joined: Tue Feb 04, 2014 12:25 pm
- Location: Gower, Wales
- Full name: Colin Jenkins
Re: Stuck trying to come up with my own PST values
"Curiouser and curiouser!"dangi12012 wrote: ↑Fri Feb 25, 2022 5:27 pm The obvious solution was never mentioned by anyone here:
Gradient descent.