Skip to content

Instantly share code, notes, and snippets.

@rooklift
Last active July 20, 2024 14:31
Show Gist options
  • Save rooklift/a5fad4d955f098243712757f581157e9 to your computer and use it in GitHub Desktop.
Save rooklift/a5fad4d955f098243712757f581157e9 to your computer and use it in GitHub Desktop.
KaTrain accuracy statistic
For each move in the game history:
Generate a difficulty statistic for the position in which the move was made, as follows:
- For each candidate move (i.e. each entry in moveInfos) multiply the prior by the points the move
loses, which is the rootInfo scoreLead minus the moveInfo scoreLead, adjusted for colour if needed
and clamped so it's not less than 0.
- Sum the values produced in this manner (from all the moveInfos).
Generate a raw weight, as follows:
- Divide the difficulty stat by the sum of the moveInfos priors (usually this is close to 1; so
you could skip this step).
- Clamp the value so it's not more than 1.
Generate an adjusted weight, as follows:
- Take the points lost by the actually-played move [*] and divide it by 4.
- If this value is higher than the raw weight, use it as the adjusted weight.
- Otherwise just use the raw weight as the adjusted weight.
- Clamp the value so it's not less than 0.05 and not more than 1.
Generate an adjusted points loss value for the actually-played move, as follows:
- Take the points lost by the actually-played move [*].
- Multiply that figure by the adjusted weight.
Now, with these values available for all moves of a player:
Calculate wt_loss:
- Calculate the sum of adjusted points losses by the actually-played moves [*].
- Divide this sum by the sum of the adjusted weights.
You can now calculate accuracy as follows:
accuracy = 100 * 0.75 ^ wt_loss
Note [*]: To get the points lost for an actually-played move, don't use the moveInfos of the position (which might
not even contain the move), but just compare the rootInfo scoreLead of the positions before and after the move.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment