Body: <p>I saw the excellent <a href="https://hxim.github.io/Stockfish-Evaluation-Guide/" rel="noreferrer">Javascript-based guide</a> to how Stockfish evaluates (non-NNUE). Is there a python version out there, perhaps using python-chess?</p>
  <p>What I am trying to do (in case you have other suggestions for skinning this particular catfish): I plan to use this for didactic purposes. For various openings, I want to analyze how the different components of the evaluation function change in different lines (not sure what I am looking for, precisely, but clearly there is a trade-off between material/mobility/... that such an analysis may reveal).</p>
  <p>In short, for a few thousand positions (not millions), I want a dictionary with keys such as &quot;King Ring&quot;, &quot;Weak Unopposed Pawn&quot;, etc.</p>
  <p>If there is a python port of that javascript code, I can easily tweak it to my needs.</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2020-12-31T05:57:36.923Z
Comments.Text: How about https://stackoverflow.com/a/58557648?
Comments.UserDisplayName: double-beep
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2020-12-31T06:30:52.933Z
Comments.Text: @double-beep, what that returns is the sum of all components (e.g., middle game eval and end game eval, each of which is made up of several components such as mobility, space, material). I am after the individual components.
Comments.UserDisplayName: Abhijit Mahabal
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2023-08-18T15:55:55.587Z
Comments.Text: @AbhijitMahabal - Have you seen this? https://github.com/glinscott/nnue-pytorch
Comments.UserDisplayName: JohnP
Tags: <engines><programming><python>
Title: Stockfish position evaluation component terms in Python?
ThreadText: # Stockfish position evaluation component terms in Python?
  
  (Asked by: username_0 on 2020-12-30)
  
  I saw the excellent [Javascript-based guide](https://hxim.github.io/Stockfish-Evaluation-Guide/) to how Stockfish evaluates (non-NNUE). Is there a python version out there, perhaps using python-chess?
  
  What I am trying to do (in case you have other suggestions for skinning this particular catfish): I plan to use this for didactic purposes. For various openings, I want to analyze how the different components of the evaluation function change in different lines (not sure what I am looking for, precisely, but clearly there is a trade-off between material/mobility/... that such an analysis may reveal).
  
  In short, for a few thousand positions (not millions), I want a dictionary with keys such as "King Ring", "Weak Unopposed Pawn", etc.
  
  If there is a python port of that javascript code, I can easily tweak it to my needs.
  
  **Tags:** engines, programming, python
  
  > **Comments:**
  > **username_1**: How about https://stackoverflow.com/a/58557648?  
  > **username_0**: @username_1, what that returns is the sum of all components (e.g., middle game eval and end game eval, each of which is made up of several components such as mobility, space, material). I am after the individual components.  
  > **username_2**: @username_0 - Have you seen this? https://github.com/glinscott/nnue-pytorch  
  
  ---
  
  ## 0 answers
  
  