io-chess
UCI chess engine
Loading...
Searching...
No Matches
WDLNormalizer Class Reference

#include <WDLNormalizer.hpp>

Static Public Member Functions

static WDLOutput convert (const std::string &eval_str, bool is_white_to_move)
static float to_centipawns (const std::string &eval_str, bool is_white_to_move)

Static Public Attributes

static constexpr float SCALE = 1.0f / 0.00368208
static constexpr float MATE_CP = 15000.0f

Static Private Member Functions

static WDLOutput handle_centipawns (float cp)
static WDLOutput handle_mate (std::string s)

Detailed Description

WDLNormalizer - Converts eval strings to WDL probabilities.

Uses:

  • Sigmoid with SCALE=272 (Lichess constant) for centipawn → win probability
  • Side-to-Move perspective (positive = we are winning)

Member Function Documentation

◆ convert()

WDLOutput WDLNormalizer::convert ( const std::string & eval_str,
bool is_white_to_move )
inlinestatic

Parse eval string into WDL (Side-to-Move perspective).

CSV evals are from White's perspective. This function flips the result when Black is to move, so the output is always from the current player's view.

Parameters
eval_strRaw eval string: "35", "-400", "#5", "#-3"
is_white_to_moveTrue if White is the side to move
Returns
WDLOutput with probabilities summing to 1.0 (from STM perspective)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handle_centipawns()

WDLOutput WDLNormalizer::handle_centipawns ( float cp)
inlinestaticprivate

Convert centipawn score to WDL. Uses logistic sigmoid: P(win) = 1 / (1 + exp(-cp/SCALE))

Here is the caller graph for this function:

◆ handle_mate()

WDLOutput WDLNormalizer::handle_mate ( std::string s)
inlinestaticprivate

Convert mate score to WDL. "#5" = we mate in 5, "#-3" = they mate us in 3.

Here is the caller graph for this function:

◆ to_centipawns()

float WDLNormalizer::to_centipawns ( const std::string & eval_str,
bool is_white_to_move )
inlinestatic

Extract raw centipawns for ExpertRouter (Killer/Survivor thresholds). Returns value from Side-to-Move perspective: positive = STM is winning.

Parameters
eval_strRaw eval string
is_white_to_moveTrue if White is to move
Returns
Centipawn value (positive = side to move is winning)
Here is the caller graph for this function:

Member Data Documentation

◆ MATE_CP

float WDLNormalizer::MATE_CP = 15000.0f
staticconstexpr

◆ SCALE

float WDLNormalizer::SCALE = 1.0f / 0.00368208
staticconstexpr

The documentation for this class was generated from the following file: