-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Correction for each nominal game stage, depending on the total quantity of material #1725
Conversation
It is possible that there may be some more elo here. But as it turned out it looks quite difficult to configure. If to leave "k2" as it is, probably can get 0-4 patch. When setting up k2 - there may be difficulties: |
Hi @GuardianRM , congratulation to make this pass LTC! I find the patch currently still a bit invasive. Here my remarks:
|
I think that all this suggestions @Stefano80 can be tried in future so this patch will look more pretty and compact. Usually a good way to do such stuff is to commit what we have and then try to simplify to pinpoint where exactly the elo of this idea is. |
I consider this great, since the trade of speed for accuracy is almost always scaling well, both in practice and in theory. The sprts are never a proof for this, but its nice to show in the same direction. Accurate (and more detailed/sophisticated) game phase has very strong and positive interaction with contempt, as eval (ct,ct/2) affects very much the search tree direction. Further testing could be tried for even more accuracy, and maybe long LTC tuning together with the ct/2 gradient. ct/2 gradient so far showed to be close to optimal and very sensitive. 25%, 75% failed hard, and my suggestion of 60% also failed. So imo this field offers great potential in general. If this can be done in less invasive way is something technical. For me I think its very fruitful to explore subtleties of the gamephase conditioning even further, because always some "endgames" will be better classified as middlegames, and the reverse. |
I think that since the formula for the k2 is additive, it can be simplified away. For example, assuming
we can simply have
and similar adjustment for the other pieces. bench should be the same |
@Rocky640 wrote:
Amen to that. The coefficients in this patch are hugely redundant against the coefficients we already have.
Bench might not be exactly the same because computation of k1 clips when there are more than 3 knights, bishops or rooks. I refuse to believe this is significant though. Here are more steps that could be taken to simplify. I'm not going to code or test this. Note after stage 2 my Knight values are { -6, 10, 18 } in agreement with @Rocky640. All the other arithmetic was done by hand. Expect mistakes.
In summary it looks like we can already express all of this patch in terms of existing coefficients except for the GameStagePawns array. |
Thanks for the comments. I agree that the construction looks cumbersome and is not against simplification. Apparently so far it is possible to find better coefficients k1, k3, since these are the coefficients after the 1st setting. After this, it is possible to find better coefficients k2. But it is possible that the linearity of the coefficients after the transformations may not be sufficiently linear. |
what is the k3 multiplier? |
k3 was used by @GuardianRM in the original post:
In the code k3 is 16 on line 108 but I forgot about it. It seems that @Rocky640 and I agree on how to get rid of the k2 part of the bonus but I forgot about k3 in my extra steps. |
Time for some code instead of just hand-waving. On top of this PR I made a crude debugging commit ceebo/Stockfish@263a8c2 and a commit ceebo/Stockfish@caf0e0a which I believe is very close to a non-functional change. Evidence for this is: Further debugging idea: if any material counts are outside the normal range then use the exact same method as in this PR, otherwise use the method in commit 2. Fingers crossed benches would be identical then. |
Under the (unproved) assumption that the adjustments of the values for the 2nd Q or 3rd N, B, or R are useless, I confirm that @ceebo latest values are good. For my proof, I kept the PR values for the 2nd Q or 3rd N, B or R, a) I based GuardianRM patch on top of "Remove Condition For Passed Pawns" b) https://github.com/Rocky640/Stockfish/tree/Imb1 So I pushed two NumGames 50000 tests against master "Remove Condition For Passed Pawns" STC http://tests.stockfishchess.org/tests/view/5b6f879d0ebc5902bdba1b05 |
This PR #1733 overlaps with this one (changed piece values). So one of them should be retested one top of the other. |
And one of these versions passed STC and LTC: Congrats to everyone involved (I will open a pull request with GuardianRM as patch author, but with full credit to Alain and Chris for the help! ) |
This patch introduces a non-linear bonus for pawns, along with some (linear) corrections for the other pieces types. The original values were obtained by a massive non-linear tuning of both pawns and other pieces by GuardianRM, while Alain Savard and Chris Cain later simplified the patch by observing that, apart from the pawn case, the tuned corrections were in fact almost affine and could be incorporated in our current code base via the piece values in types.h (offset) and the diagonal of the quadratic matrix (slope). See discussion in PR#1725 : #1725 STC: LLR: 2.97 (-2.94,2.94) [0.00,5.00] Total: 42948 W: 9662 L: 9317 D: 23969 http://tests.stockfishchess.org/tests/view/5b6ff6e60ebc5902bdba1d87 LTC: LLR: 2.97 (-2.94,2.94) [0.00,5.00] Total: 19683 W: 3409 L: 3206 D: 13068 http://tests.stockfishchess.org/tests/view/5b702dbd0ebc5902bdba216b How to continue from there? - Maybe the non-linearity for the pawn value could be somewhat tempered again and a simpler linear correction for pawns would work? Closes #1734 Bench: 4681496
The pull request #1734 having been merged, I now close this one. |
This patch introduces a non-linear bonus for pawns, along with some (linear) corrections for the other pieces types. The original values were obtained by a massive non-linear tuning of both pawns and other pieces by GuardianRM, while Alain Savard and Chris Cain later simplified the patch by observing that, apart from the pawn case, the tuned corrections were in fact almost affine and could be incorporated in our current code base via the piece values in types.h (offset) and the diagonal of the quadratic matrix (slope). See discussion in PR#1725 : official-stockfish#1725 STC: LLR: 2.97 (-2.94,2.94) [0.00,5.00] Total: 42948 W: 9662 L: 9317 D: 23969 http://tests.stockfishchess.org/tests/view/5b6ff6e60ebc5902bdba1d87 LTC: LLR: 2.97 (-2.94,2.94) [0.00,5.00] Total: 19683 W: 3409 L: 3206 D: 13068 http://tests.stockfishchess.org/tests/view/5b702dbd0ebc5902bdba216b How to continue from there? - Maybe the non-linearity for the pawn value could be somewhat tempered again and a simpler linear correction for pawns would work? Closes official-stockfish#1734 Bench: 4681496
This patch introduces a non-linear bonus for pawns, along with some (linear) corrections for the other pieces types. The original values were obtained by a massive non-linear tuning of both pawns and other pieces by GuardianRM, while Alain Savard and Chris Cain later simplified the patch by observing that, apart from the pawn case, the tuned corrections were in fact almost affine and could be incorporated in our current code base via the piece values in types.h (offset) and the diagonal of the quadratic matrix (slope). See discussion in PR#1725 : official-stockfish#1725 STC: LLR: 2.97 (-2.94,2.94) [0.00,5.00] Total: 42948 W: 9662 L: 9317 D: 23969 http://tests.stockfishchess.org/tests/view/5b6ff6e60ebc5902bdba1d87 LTC: LLR: 2.97 (-2.94,2.94) [0.00,5.00] Total: 19683 W: 3409 L: 3206 D: 13068 http://tests.stockfishchess.org/tests/view/5b702dbd0ebc5902bdba216b How to continue from there? - Maybe the non-linearity for the pawn value could be somewhat tempered again and a simpler linear correction for pawns would work? Closes official-stockfish#1734 Bench: 4681496
This patch introduces a non-linear bonus for pawns, along with some (linear) corrections for the other pieces types. The original values were obtained by a massive non-linear tuning of both pawns and other pieces by GuardianRM, while Alain Savard and Chris Cain later simplified the patch by observing that, apart from the pawn case, the tuned corrections were in fact almost affine and could be incorporated in our current code base via the piece values in types.h (offset) and the diagonal of the quadratic matrix (slope). See discussion in PR#1725 : official-stockfish#1725 STC: LLR: 2.97 (-2.94,2.94) [0.00,5.00] Total: 42948 W: 9662 L: 9317 D: 23969 http://tests.stockfishchess.org/tests/view/5b6ff6e60ebc5902bdba1d87 LTC: LLR: 2.97 (-2.94,2.94) [0.00,5.00] Total: 19683 W: 3409 L: 3206 D: 13068 http://tests.stockfishchess.org/tests/view/5b702dbd0ebc5902bdba216b How to continue from there? - Maybe the non-linearity for the pawn value could be somewhat tempered again and a simpler linear correction for pawns would work? Closes official-stockfish#1734 Bench: 4681496
This patch introduces a non-linear bonus for pawns, along with some (linear) corrections for the other pieces types. The original values were obtained by a massive non-linear tuning of both pawns and other pieces by GuardianRM, while Alain Savard and Chris Cain later simplified the patch by observing that, apart from the pawn case, the tuned corrections were in fact almost affine and could be incorporated in our current code base via the piece values in types.h (offset) and the diagonal of the quadratic matrix (slope). See discussion in PR#1725 : official-stockfish#1725 STC: LLR: 2.97 (-2.94,2.94) [0.00,5.00] Total: 42948 W: 9662 L: 9317 D: 23969 http://tests.stockfishchess.org/tests/view/5b6ff6e60ebc5902bdba1d87 LTC: LLR: 2.97 (-2.94,2.94) [0.00,5.00] Total: 19683 W: 3409 L: 3206 D: 13068 http://tests.stockfishchess.org/tests/view/5b702dbd0ebc5902bdba216b How to continue from there? - Maybe the non-linearity for the pawn value could be somewhat tempered again and a simpler linear correction for pawns would work? Closes official-stockfish#1734 Bench: 4681496
This patch introduces a non-linear bonus for pawns, along with some (linear) corrections for the other pieces types. The original values were obtained by a massive non-linear tuning of both pawns and other pieces by GuardianRM, while Alain Savard and Chris Cain later simplified the patch by observing that, apart from the pawn case, the tuned corrections were in fact almost affine and could be incorporated in our current code base via the piece values in types.h (offset) and the diagonal of the quadratic matrix (slope). See discussion in PR#1725 : official-stockfish#1725 STC: LLR: 2.97 (-2.94,2.94) [0.00,5.00] Total: 42948 W: 9662 L: 9317 D: 23969 http://tests.stockfishchess.org/tests/view/5b6ff6e60ebc5902bdba1d87 LTC: LLR: 2.97 (-2.94,2.94) [0.00,5.00] Total: 19683 W: 3409 L: 3206 D: 13068 http://tests.stockfishchess.org/tests/view/5b702dbd0ebc5902bdba216b How to continue from there? - Maybe the non-linearity for the pawn value could be somewhat tempered again and a simpler linear correction for pawns would work? Closes official-stockfish#1734 Bench: 4681496
This patch introduces a non-linear bonus for pawns, along with some (linear) corrections for the other pieces types. The original values were obtained by a massive non-linear tuning of both pawns and other pieces by GuardianRM, while Alain Savard and Chris Cain later simplified the patch by observing that, apart from the pawn case, the tuned corrections were in fact almost affine and could be incorporated in our current code base via the piece values in types.h (offset) and the diagonal of the quadratic matrix (slope). See discussion in PR#1725 : official-stockfish#1725 STC: LLR: 2.97 (-2.94,2.94) [0.00,5.00] Total: 42948 W: 9662 L: 9317 D: 23969 http://tests.stockfishchess.org/tests/view/5b6ff6e60ebc5902bdba1d87 LTC: LLR: 2.97 (-2.94,2.94) [0.00,5.00] Total: 19683 W: 3409 L: 3206 D: 13068 http://tests.stockfishchess.org/tests/view/5b702dbd0ebc5902bdba216b How to continue from there? - Maybe the non-linearity for the pawn value could be somewhat tempered again and a simpler linear correction for pawns would work? Closes official-stockfish#1734 Bench: 4681496
Correction for each nominal game stage, depending on the total quantity of material -
The system of bonuses and penalties, for the position estimate correction, determined by the formula
Bonus = (k1 - k2) * k3.
Where:
k1 - is a configurable tabular value, that depends on the current set of pieces.
k2 - the index of the nominal current game stage, determined by the total conventional weight of the pieces (the values are taken: pawn = 1 knight = 3 bishop = 3 rook = 5 queen = 10).
k3 - the coefficient of significance.
STC: [Yellow]
LLR: -2.95 (-2.94,2.94) [0.00,5.00]
Total: 88523 W: 19994 L: 19683 D: 48846
http://tests.stockfishchess.org/tests/view/5b6b33d50ebc5902bdb9e0e1
LTC: [Green]
LLR: 2.95 (-2.94,2.94) [0.00,5.00]
Total: 14179 W: 2507 L: 2326 D: 9346
http://tests.stockfishchess.org/tests/view/5b6ba46f0ebc5902bdb9e6c6
Bench: 4645525