Handles conversion between Win-Draw-Loss probabilities and centipawn scores.
More...
#include <WDLConverter.hpp>
|
| struct | WDL |
| | Holds Win, Draw, and Loss probabilities. More...
|
|
| int | convert (float win, float draw, float loss) const |
|
| static constexpr int | MAX_CP = 15000 |
| static constexpr float | WDL_SCALE = 1.0f / 0.00368208f |
|
| int | convertWDL (float win, float draw, float loss) const |
Handles conversion between Win-Draw-Loss probabilities and centipawn scores.
◆ convert()
| int WDLConverter::convert |
( |
float | win, |
|
|
float | draw, |
|
|
float | loss ) const |
|
inline |
Convert WDL to centipawn evaluation.
- Parameters
-
| win | Win probability [0, 1] |
| draw | Draw probability [0, 1] |
| loss | Loss probability [0, 1] |
- Returns
- Centipawn score (positive = STM is winning)
◆ convertWDL()
| int WDLConverter::convertWDL |
( |
float | win, |
|
|
float | draw, |
|
|
float | loss ) const |
|
inlineprivate |
Convert WDL to centipawns - CORRECT INVERSE of WDLNormalizer.
The key insight is that the 0.3 factor creates a ratio that we can invert. From training: if cp > 0: w = sigmoid(cp/S), l = (1-w)*0.3 → w/(w+l) = w/(w + 0.3*(1-w)) = w/(0.3 + 0.7*w) if cp < 0: l = 1-sigmoid(cp/S), w = sigmoid(cp/S)*0.3 → w/(w+l) = 0.3*sig / (0.3*sig + 1-sig) = sig (after solving)
Actually, the simplest correct inverse: win_ratio = w / (w + l) – this extracts the sigmoid! sigmoid(x) = 1 / (1 + exp(-x)) x = ln(win_ratio / (1 - win_ratio)) cp = SCALE * ln(win_ratio / (1 - win_ratio))
Aggression adjusts draw distribution before computing ratio.
◆ aggression
| float WDLConverter::aggression = 0.0f |
◆ MAX_CP
| int WDLConverter::MAX_CP = 15000 |
|
staticconstexpr |
◆ WDL_SCALE
| float WDLConverter::WDL_SCALE = 1.0f / 0.00368208f |
|
staticconstexpr |
The documentation for this class was generated from the following file: