user25434: I have a chess GUI which I've recently been updating to do preemptive searches (that is, depth searches for all possible opponent moves) that I'd like to speed up, since the bot searches go to at least depth 16 for every move, and each move runs a new Stockfish 11 command line (with minimum settings) in a separate thread.
Now, I have some solutions for the threading issue, but one would involve knowing more chess math than I know now.
I noticed that, after a certain search depth, the PV's first move, and then first few moves, really don't change that often, and I'd like to know if there's a formula out there, similar to one that I used to calculate winning odds.
I considered the following:

Do a depth search of n on the position after hypothetical opponent move m.
Retrieve the pv for depth n.
Append it to a corpus.
Do a depth search of n+1 on the same position.
Retrieve the pv for depth n+1.
If a text prediction algorithm using the corpus will produce n+1[pv][0:x], such that x is sufficiently large (needs more math) to be reliable, cease the depth searches and recommend n+1[pv][0].

I'm thinking that there might be a simpler way of reaching a similar outcome, since pv[0] would have to arise every time in the text prediction.
What other Stockfish info might I want to consider in generating a statistical confidence that the recommendation need not search any deeper?

user30545: I did a study using stockfish 14.1 on all positions (6 games) played Hikaru in the 2022 FIDE Grand Prix Leg 1.
Procedure

Get all positions where Hikaru is to move.
Analyze those positions with stockfish 14.1 at different base depths and depths+1 and save the bestmoves.

Results
    base_depth  adv_depth  match(%)
0            8          9  77.06
1            9         10  80.09
2           10         11  85.28
3           11         12  83.55
4           12         13  85.71
5           13         14  84.42
6           14         15  92.64
7           15         16  85.28
8           16         17  88.31
9           17         18  89.61
10          18         19  87.01

The match column is the percentage that the bestmove in base_depth is similar to the bestmove in base_depth+1 or adv_depth.
The highest match is in base_depth 14 at 92.64%.
Plot

Run a linear regression on that data using statsmodel and comes up with the following formula and margin of error of +/-6% at 95% confidence level and an R-squared of 0.641.
margin of error = rmse * 1.96

Formula
match_rate_pct = 1.1218 x base_depth + 70.1277  [+/- margin of error]

Example
If base depth is 17 the approximate match_rate will be:

match_rate_pct = 1.1218 x base_depth + 70.1277
match_rate_pct = 1.1218 x 17 + 70.1277

match_rate_pct = 89.2% +/- 6%

min match_rate_pct = 83.2%
max match_rate_pct = 95.2%


25434: <p>I have a chess GUI which I've recently been updating to do preemptive searches (that is, depth searches for all possible opponent moves) that I'd like to speed up, since the bot searches go to at least depth 16 for every move, and each move runs a new Stockfish 11 command line (with minimum settings) in a separate thread.</p>
<p>Now, I have some solutions for the threading issue, but one would involve knowing more chess math than I know now.</p>
<p>I noticed that, after a certain search depth, the PV's first move, and then first few moves, really don't change that often, and I'd like to know if there's a formula out there, similar to <a href="https://www.chessprogramming.org/Pawn_Advantage,_Win_Percentage,_and_Elo" rel="nofollow noreferrer">one that I used to calculate winning odds</a>.</p>
<p>I considered the following:</p>
<ul>
<li>Do a depth search of n on the position after hypothetical opponent move m.</li>
<li>Retrieve the pv for depth n.</li>
<li>Append it to a corpus.</li>
<li>Do a depth search of n+1 on the same position.</li>
<li>Retrieve the pv for depth n+1.</li>
<li>If a text prediction algorithm using the corpus will produce n+1[pv][0:x], such that x is sufficiently large (needs more math) to be reliable, cease the depth searches and recommend n+1[pv][0].</li>
</ul>
<p>I'm thinking that there might be a simpler way of reaching a similar outcome, since pv[0] would have to arise every time in the text prediction.</p>
<p>What other Stockfish info might I want to consider in generating a statistical confidence that the recommendation need not search any deeper?</p>
 30545: <p>I did a study using stockfish 14.1 on all positions (6 games) played Hikaru in the 2022 FIDE Grand Prix Leg 1.</p>
<p><strong>Procedure</strong></p>
<ul>
<li>Get all positions where Hikaru is to move.</li>
<li>Analyze those positions with stockfish 14.1 at different base depths and depths+1 and save the bestmoves.</li>
</ul>
<p><strong>Results</strong></p>
<pre><code>    base_depth  adv_depth  match(%)
0            8          9  77.06
1            9         10  80.09
2           10         11  85.28
3           11         12  83.55
4           12         13  85.71
5           13         14  84.42
6           14         15  92.64
7           15         16  85.28
8           16         17  88.31
9           17         18  89.61
10          18         19  87.01
</code></pre>
<p>The match column is the percentage that the bestmove in base_depth is similar to the bestmove in base_depth+1 or adv_depth.</p>
<p>The highest match is in base_depth 14 at 92.64%.</p>
<p><strong>Plot</strong><br />
<a href="https://i.stack.imgur.com/D6SI5.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/D6SI5.png" alt="enter image description here" /></a></p>
<p>Run a linear regression on that data using statsmodel and comes up with the following formula and margin of error of +/-6% at 95% confidence level and an R-squared of 0.641.</p>
<pre><code>margin of error = rmse * 1.96
</code></pre>
<p><strong>Formula</strong></p>
<pre><code>match_rate_pct = 1.1218 x base_depth + 70.1277  [+/- margin of error]
</code></pre>
<p><strong>Example</strong></p>
<pre><code>If base depth is 17 the approximate match_rate will be:

match_rate_pct = 1.1218 x base_depth + 70.1277
match_rate_pct = 1.1218 x 17 + 70.1277

match_rate_pct = 89.2% +/- 6%

min match_rate_pct = 83.2%
max match_rate_pct = 95.2%
</code></pre>
