flok wrote: ↑Fri Jun 01, 2018 8:35 am

Am looking at texel tuning.

From the wiki: "K is a scaling constant. Compute the K that minimizes E."

How to do so?

Also the wiki says to run a QS. But if I use quiet positions, isn't it enough to run only eval and use the result of that?

sigmoid is like scoring rate and varies from engine to engine. If your engine evaluates a certain position at 100 cp, what is its scoring rate?, Is it 100%, 90%, 80% etc? This scoring rate can be adjusted using a factor of K in the following formula.

Example:

s = 100 cp

k = 1

sigmoid = 0.64

If you use K = 1, can your engine achieve a scoring rate of 0.64 or 64% against equal to stronger opponents?

If we can find the scoring rate of the engine when it evaluates a position with an advantage of 1 pawn, then we can get the K based from the sigmoid formula.

One approach to find your engine's scoring rate is by collecting its games and extracting positions where it is to move and get its score then get the average.

Example:

Game 1: Win

[White "yourengine"]

[Black "opp"]

[Result "1-0"]

1. e4 {book} e5 {book} 2. Nf3 {book} Nc6 {book} 3. Bb5 {book} a6 {book}

4. Ba4 {book} Nf6 {book} 5. O-O {book} Be7 {book} 6. Re1 {book} b5 {book}

7. Bb3 {book} O-O {book} 8. d3 {book} d6 {book} 9. a4 {book} b4 {book}

10. Nbd2 {book} Na5 {book} 11. Ba2 {book} c5 {book} 12. Nc4 {+0.21/13 0.75s}

Nxc4 {-0.11/16 0.73s} 13. Bxc4 {+0.08/17 0.55s} Be6 {-0.04/16 0.67s} ...

12. +0.21

13. +0.08

...

Say

35. +1.0

36. +1.05

37. +1.10

Since your engine won the game, count it as a win for that sample score range.

[1.0, 1.10] = 1.0

Game 2: Draw

[1.0, 1.10] = 1.5

Game 3: Win

[1.0, 1.10] = 2.5

scoring rate = 2.5/3 = 0.83

More games are better.

Now if you have that scoring rate, we can solve for K in sigmoid.

sigmoid = 1 / (1 + 10^(-ks/400))

a = -ks/400

sigmoid = 1 / (1 + 10^a)

sigmoid * (1 + 10^a) = 1

1 + 10^a = 1/sigmoid

10^a = (1/sigmoid) - 1

b = (1/sigmoid) - 1

10^a = b

log10(b) = a

a = -ks/400

log10(b) = -ks/400

-ks/400 = log10(b)

-ks = 400 * log10(b)

-k = 400/s * log10(b)

k = -400/s * log10(b)

b = (1/sigmoid) - 1

**k = -400/s * log10((1/sigmoid) - 1)**
Given:

s = 100 or 1 pawn

sigmoid or scoring rate = 0.58

k = -400/100 * log10((1/0.58) - 1)

k = -400/100 * (-0.1402)

**k = 0.56**
Plot Deuterium's (D2018 and D2014) scoring rate (extracted from games) playing against different common opponents of similar or lower strength. Also plot the sigmoid with varying K values.