Answers.Body: <p>Both approaches will work.</p>
  <ul>
  <li>In the second approach, you will have <strong>better accuracy</strong> of your evaluations but you may miss an important move. For example, if 20...Rxc3 positional exchange sacrifice is a strong move, you will probably miss it with a 1-2s quick engine search.</li>
  <li>In the first approach, you will lose accuracy but you won't miss a strong hidden resource like in the second approach.</li>
  </ul>
  <p>Classical example of sensitivity vs false positives. The second approach is more sensitive but you trade it with higher false positive rate.</p>
  <p>In Chessable engine analysis, I adopted the second approach. I gave about 10s for each legal move (there could be many!). Filter out only the top moves, then seek evaluation for each individual move. 1-2s is too little.</p>
  <p><strong>PS:</strong> MultiPV is causing lose in accuracy because the engine has to evaluate the moves before those moves are played on the board.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-08-26T01:17:31.910Z
Answers.Text: That answers my question perfectly. Thank you.
Answers.UserDisplayName: Cory Butzon
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-08-26T00:20:03.860Z
Answers.LastActivityDate: 2020-08-28T00:22:17.723Z
Answers.LastEditDate: 2020-08-28T00:22:17.723Z
Answers.UserDisplayName: SmallChess
Body: <p>I want to use python-chess to get the top 5 Stockfish moves from a given position with a numerical evaluation for each move. Is it more accurate to run the engine for 10 minutes with MultiPV=5, or to quickly rank all the legal moves (with maybe 1-2 seconds engine time each) and then let the engine think about the top 5 or so one at a time for 2 minutes?</p>
  
Tags: <analysis><stockfish><python>
Title: What's the best way to get the top n engine moves?
ThreadText: # What's the best way to get the top n engine moves?
  
  (Asked by: username_0 on 2020-08-25)
  
  I want to use python-chess to get the top 5 Stockfish moves from a given position with a numerical evaluation for each move. Is it more accurate to run the engine for 10 minutes with MultiPV=5, or to quickly rank all the legal moves (with maybe 1-2 seconds engine time each) and then let the engine think about the top 5 or so one at a time for 2 minutes?
  
  **Tags:** analysis, stockfish, python
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2020-08-26. Score: 4 | Accepted answer
  
  Both approaches will work.
  
  * In the second approach, you will have **better accuracy** of your evaluations but you may miss an important move. For example, if 20...Rxc3 positional exchange sacrifice is a strong move, you will probably miss it with a 1-2s quick engine search.
  * In the first approach, you will lose accuracy but you won't miss a strong hidden resource like in the second approach.
  
  Classical example of sensitivity vs false positives. The second approach is more sensitive but you trade it with higher false positive rate.
  
  In Chessable engine analysis, I adopted the second approach. I gave about 10s for each legal move (there could be many!). Filter out only the top moves, then seek evaluation for each individual move. 1-2s is too little.
  
  **PS:** MultiPV is causing lose in accuracy because the engine has to evaluate the moves before those moves are played on the board.
  
  > **Comments:**
  > **username_0**: That answers my question perfectly. Thank you.  
  
  ---
  
  