Also, his EPD has the best move already if that best move is capture or a promote move or even a check evasion move, perhaps that position can be considered already as a non-quiet.chrisw wrote: ↑Tue May 26, 2020 8:36 pmIf the definition of “quiet” is kept to material only, it would be relatively trivial to write a quiet-epd parser using standard stuff in Python-Chess to do the qsearch. It would be no surprise if Ferdy has already done one.cucumber wrote: ↑Tue May 26, 2020 2:57 pmYep, exactly this. I don't even need (or at least I don't think I need...) the part where I play out the PV until the end of the line. That idea had not occurred to me but it seems very reasonable.chrisw wrote: ↑Tue May 26, 2020 2:11 pmFrom a programmer perspective, best is to perform a qsearch, if that comes back with nothing better than stand pat then the position is quiet.Ferdy wrote: ↑Tue May 26, 2020 5:47 amI have some python scripts, but what are your criteria for quiet positions? Can you post an example EPD?cucumber wrote: ↑Sun May 24, 2020 9:40 pm Hello,
I'm looking for ways to extract quiet positions from an epd file while preserving existing comments, bestmove, etc., information. I have a few million positions and just need to get rid of the noisiest ones.
Are there any scripts or programs to do this? If not, does anyone have recommendations for the best way forward?
Thank you.
You can take it a bit further and if qsearch comes back with a pv, then play the pv out until the end of the line and use that as the position
Extracting quiet positions?
Moderators: hgm, Rebel, chrisw
-
- Posts: 4833
- Joined: Sun Aug 10, 2008 3:15 pm
- Location: Philippines
Re: Extracting quiet positions?
-
- Posts: 4319
- Joined: Tue Apr 03, 2012 4:28 pm
Re: Extracting quiet positions?
Yup. Of course, as ever, it depends on what is meant by quiet. If Stockfish programmer, and probably inevitably most engine programmers by now, it’s not the position that is “quiet”, it’s a move from the position that the definition applies to. Eg, if the position is mate in one by e2e4 for example and not mate at all by d2xd4 for example, then the non capture, non promotion mate move would be defined as “quiet” and the capturing non-mating d2d4 defined as not-quiet.Ferdy wrote: ↑Thu May 28, 2020 2:39 amAlso, his EPD has the best move already if that best move is capture or a promote move or even a check evasion move, perhaps that position can be considered already as a non-quiet.chrisw wrote: ↑Tue May 26, 2020 8:36 pmIf the definition of “quiet” is kept to material only, it would be relatively trivial to write a quiet-epd parser using standard stuff in Python-Chess to do the qsearch. It would be no surprise if Ferdy has already done one.cucumber wrote: ↑Tue May 26, 2020 2:57 pmYep, exactly this. I don't even need (or at least I don't think I need...) the part where I play out the PV until the end of the line. That idea had not occurred to me but it seems very reasonable.chrisw wrote: ↑Tue May 26, 2020 2:11 pmFrom a programmer perspective, best is to perform a qsearch, if that comes back with nothing better than stand pat then the position is quiet.Ferdy wrote: ↑Tue May 26, 2020 5:47 amI have some python scripts, but what are your criteria for quiet positions? Can you post an example EPD?cucumber wrote: ↑Sun May 24, 2020 9:40 pm Hello,
I'm looking for ways to extract quiet positions from an epd file while preserving existing comments, bestmove, etc., information. I have a few million positions and just need to get rid of the noisiest ones.
Are there any scripts or programs to do this? If not, does anyone have recommendations for the best way forward?
Thank you.
You can take it a bit further and if qsearch comes back with a pv, then play the pv out until the end of the line and use that as the position
What he wants are quiet positions, and I’m not sure there is a standard programmer definition for that. Possibly a position where there is no “obvious“ winning capture or promotion, even though there are possible available capture/promotions. And then you get into the level of what “obvious” means. Qsearch or N ply deep search? Or chess expert search? And do you include types of check and so on?
For simplicity, that’s why I originally assumed “a position where qsearch prefers to stand pat” = quiet position.
If you’re a LCZero programmer, possibly the concept of quiet and non-quiet doesn’t even exist.
-
- Posts: 144
- Joined: Sun Oct 14, 2018 8:21 pm
- Full name: JSmith
Re: Extracting quiet positions?
I'd define quiet, in this circumstance, as a position where the static evaluation best matches the true value of the position--so, for example, a position where there are no recaptures. I'm just extracting this to improve the resolution (for lack of a better word?) of my position testing attempts. If there's an obvious recapture that anyone would see, or if there's a mate in one, then no notable functioning engine should miss it--even Leela sees mates in one now.Ferdy wrote: ↑Thu May 28, 2020 2:39 amAlso, his EPD has the best move already if that best move is capture or a promote move or even a check evasion move, perhaps that position can be considered already as a non-quiet.chrisw wrote: ↑Tue May 26, 2020 8:36 pmIf the definition of “quiet” is kept to material only, it would be relatively trivial to write a quiet-epd parser using standard stuff in Python-Chess to do the qsearch. It would be no surprise if Ferdy has already done one.cucumber wrote: ↑Tue May 26, 2020 2:57 pmYep, exactly this. I don't even need (or at least I don't think I need...) the part where I play out the PV until the end of the line. That idea had not occurred to me but it seems very reasonable.chrisw wrote: ↑Tue May 26, 2020 2:11 pmFrom a programmer perspective, best is to perform a qsearch, if that comes back with nothing better than stand pat then the position is quiet.Ferdy wrote: ↑Tue May 26, 2020 5:47 amI have some python scripts, but what are your criteria for quiet positions? Can you post an example EPD?cucumber wrote: ↑Sun May 24, 2020 9:40 pm Hello,
I'm looking for ways to extract quiet positions from an epd file while preserving existing comments, bestmove, etc., information. I have a few million positions and just need to get rid of the noisiest ones.
Are there any scripts or programs to do this? If not, does anyone have recommendations for the best way forward?
Thank you.
You can take it a bit further and if qsearch comes back with a pv, then play the pv out until the end of the line and use that as the position
Any step, even if imperfect, to improve resolution is useful. Until I have the free time to write something to filter EPDs with Ethereal's qsearch, using the technique described by Chris, I'm going to be using that idea: I just used grep to get all of the lines that don't have a capture, and the difference in position testing resolving power seems huge based on a quick test. And it was only one line of bash! It's a really good idea.
Thanks a lot to you and Chris! You have both been a huge help.
-
- Posts: 4833
- Joined: Sun Aug 10, 2008 3:15 pm
- Location: Philippines
Re: Extracting quiet positions?
Created a repo at https://github.com/fsmosca/Quiet-Position-Extractor
Will read the epd, analyze it with engine, save the pv of engine analysis.
* If score is mate, don't extract.
* If pv has moves below 4 (settable via option pvlen), don't extract
* If there is capture or promote or a check in one of the first 4 moves in the pv, don't extract.
It will not check the bm in the input EPD. Will add it later. Capture/promote/check/check evasion moves.
SF has a command eval to get the static eval of the position, Compare the static eval and search score (movetimems 200 or so), if the difference is high of say 100cp or so, then don't extract. Will implement this later.
No exe yet is uploaded, but you can already try if you have python and python-chess module installed.
Sample run when analyzing wacnew.epd with SF11 at 200ms/pos.
Analysis starts ...
pos: 1
Skip, score is a mate.
pos: 2
[Move.from_uci('b3b8')]
Skip, pv length is below 4 plies.
pos: 3
['Rg3', 'Bg4', 'Rxg4']
Skip, move in the pv has a promote or check or capture move.
pos: 4
Skip, score is a mate.
pos: 5
Skip, score is a mate.
pos: 6
['Rb7', 'Rb5', 'Rxb5']
Skip, move in the pv has a promote or check or capture move.
pos: 7
['Ne3', 'Ngf3', 'Nxd1']
Skip, move in the pv has a promote or check or capture move.
pos: 8
[Move.from_uci('e7f7')]
Skip, pv length is below 4 plies.
pos: 9
Skip, score is a mate.
pos: 10
['Rxh7']
Skip, move in the pv has a promote or check or capture move.
pos: 11
['Bxc6']
Skip, move in the pv has a promote or check or capture move.
pos: 12
Skip, score is a mate.
pos: 13
['Qxf8+']
Skip, move in the pv has a promote or check or capture move.
pos: 14
Skip, score is a mate.
pos: 15
[Move.from_uci('b8b7')]
Skip, pv length is below 4 plies.
pos: 16
['Nc3', 'Qd7', 'Bxc5']
Skip, move in the pv has a promote or check or capture move.
...
Will read the epd, analyze it with engine, save the pv of engine analysis.
* If score is mate, don't extract.
* If pv has moves below 4 (settable via option pvlen), don't extract
* If there is capture or promote or a check in one of the first 4 moves in the pv, don't extract.
It will not check the bm in the input EPD. Will add it later. Capture/promote/check/check evasion moves.
SF has a command eval to get the static eval of the position, Compare the static eval and search score (movetimems 200 or so), if the difference is high of say 100cp or so, then don't extract. Will implement this later.
No exe yet is uploaded, but you can already try if you have python and python-chess module installed.
Sample run when analyzing wacnew.epd with SF11 at 200ms/pos.
Analysis starts ...
pos: 1
Skip, score is a mate.
pos: 2
[Move.from_uci('b3b8')]
Skip, pv length is below 4 plies.
pos: 3
['Rg3', 'Bg4', 'Rxg4']
Skip, move in the pv has a promote or check or capture move.
pos: 4
Skip, score is a mate.
pos: 5
Skip, score is a mate.
pos: 6
['Rb7', 'Rb5', 'Rxb5']
Skip, move in the pv has a promote or check or capture move.
pos: 7
['Ne3', 'Ngf3', 'Nxd1']
Skip, move in the pv has a promote or check or capture move.
pos: 8
[Move.from_uci('e7f7')]
Skip, pv length is below 4 plies.
pos: 9
Skip, score is a mate.
pos: 10
['Rxh7']
Skip, move in the pv has a promote or check or capture move.
pos: 11
['Bxc6']
Skip, move in the pv has a promote or check or capture move.
pos: 12
Skip, score is a mate.
pos: 13
['Qxf8+']
Skip, move in the pv has a promote or check or capture move.
pos: 14
Skip, score is a mate.
pos: 15
[Move.from_uci('b8b7')]
Skip, pv length is below 4 plies.
pos: 16
['Nc3', 'Qd7', 'Bxc5']
Skip, move in the pv has a promote or check or capture move.
...
-
- Posts: 144
- Joined: Sun Oct 14, 2018 8:21 pm
- Full name: JSmith
Re: Extracting quiet positions?
Oh my gosh, this is incredible. Thank you so much for making and sharing this!Ferdy wrote: ↑Sun Jun 07, 2020 4:14 pm Created a repo at https://github.com/fsmosca/Quiet-Position-Extractor
Will read the epd, analyze it with engine, save the pv of engine analysis.
* If score is mate, don't extract.
* If pv has moves below 4 (settable via option pvlen), don't extract
* If there is capture or promote or a check in one of the first 4 moves in the pv, don't extract.
It will not check the bm in the input EPD. Will add it later. Capture/promote/check/check evasion moves.
SF has a command eval to get the static eval of the position, Compare the static eval and search score (movetimems 200 or so), if the difference is high of say 100cp or so, then don't extract. Will implement this later.
No exe yet is uploaded, but you can already try if you have python and python-chess module installed.
Sample run when analyzing wacnew.epd with SF11 at 200ms/pos.
Analysis starts ...
pos: 1
Skip, score is a mate.
pos: 2
[Move.from_uci('b3b8')]
Skip, pv length is below 4 plies.
pos: 3
['Rg3', 'Bg4', 'Rxg4']
Skip, move in the pv has a promote or check or capture move.
pos: 4
Skip, score is a mate.
pos: 5
Skip, score is a mate.
pos: 6
['Rb7', 'Rb5', 'Rxb5']
Skip, move in the pv has a promote or check or capture move.
pos: 7
['Ne3', 'Ngf3', 'Nxd1']
Skip, move in the pv has a promote or check or capture move.
pos: 8
[Move.from_uci('e7f7')]
Skip, pv length is below 4 plies.
pos: 9
Skip, score is a mate.
pos: 10
['Rxh7']
Skip, move in the pv has a promote or check or capture move.
pos: 11
['Bxc6']
Skip, move in the pv has a promote or check or capture move.
pos: 12
Skip, score is a mate.
pos: 13
['Qxf8+']
Skip, move in the pv has a promote or check or capture move.
pos: 14
Skip, score is a mate.
pos: 15
[Move.from_uci('b8b7')]
Skip, pv length is below 4 plies.
pos: 16
['Nc3', 'Qd7', 'Bxc5']
Skip, move in the pv has a promote or check or capture move.
...
-
- Posts: 4833
- Joined: Sun Aug 10, 2008 3:15 pm
- Location: Philippines
Re: Extracting quiet positions?
When using --static-eval in extracting quiet pos and pvlen is 4 as default and using Stockfish 11, it can happen that the pv output is below 4, in this case the program will fail to determine if this position is quiet or not.
Example.
1Qq5/2P1p1kp/3r1pp1/8/8/7P/p4PP1/2R3K1 b - - bm Rc6; id "WAC.206"; Acms 1000; C0 "status: pvlength is below requirement, ucipv: ['d6c6', 'b8b2'], ucipvlen: 2, pvlength required: 4"; Anno "Stockfish 11 64 POPCNT";
pv is only 2, required pvlen is 4.
Example.
1Qq5/2P1p1kp/3r1pp1/8/8/7P/p4PP1/2R3K1 b - - bm Rc6; id "WAC.206"; Acms 1000; C0 "status: pvlength is below requirement, ucipv: ['d6c6', 'b8b2'], ucipvlen: 2, pvlength required: 4"; Anno "Stockfish 11 64 POPCNT";
pv is only 2, required pvlen is 4.