I want this thread to serve as another example of how to get Texel Tuning going. I'll talk about what I tried (and what worked) in hopes that the guy after me can make use of it.

For tuning I used the quiet positions found here:

http://www.talkchess.com/forum/viewtopic.php?t=61427

http://www.talkchess.com/forum/viewtopi ... 594#733594

Had a great deal of difficulty getting Texel Tuning to work for my engine. After reading the responses to the above thread, I implemented a simple SGD method for the tuner. This required the ability to reconstruct the eval as a linear function of terms, so I wrapped a method of "tracing" each evaluation term added during the evaluation calls.

Once I cleaned up the bugs with this, I was still having no luck. I then wrote a method to scale the learning rates of each parameter, relative to how often they occur (by game phases) in the test positions. This extremely simple method allowed much quicker convergence, and I believe a better result.

Code: Select all

```
void calculateLearningRates(TexelEntry * tes, double rates[NT][PHASE_NB]){
int i, j;
double avgByPhase[PHASE_NB] = {0};
double occurances[NT][PHASE_NB] = {{0}, {0}};
// NP = Number Of Test Positions
// NT = Number Of Evaluation Terms
// tes[i].coeffs is the coefficient for each evaluation. IE, -2 if black up two pawns, 1 if white up one pawn...
// tes[i].factors is just the midgame phase factor, and endgame phase factor, a la Fruit
for (i = 0; i < NP; i++){
for (j = 0; j < NT; j++){
occurances[j][MG] += abs(tes[i].coeffs[j]) * tes[i].factors[MG];
occurances[j][EG] += abs(tes[i].coeffs[j]) * tes[i].factors[EG];
avgByPhase[MG] += abs(tes[i].coeffs[j]) * tes[i].factors[MG];
avgByPhase[EG] += abs(tes[i].coeffs[j]) * tes[i].factors[EG];
}
}
avgByPhase[MG] /= NT;
avgByPhase[EG] /= NT;
for (i = 0; i < NT; i++){
if (occurances[i][MG] >= 1.0)
rates[i][MG] = avgByPhase[MG] / occurances[i][MG];
if (occurances[i][EG] >= 1.0)
rates[i][EG] = avgByPhase[EG] / occurances[i][EG];
}
}
```

This implementation can be found in texel.c, texel.h, and evaluate.c in my source directory (once I add them, in a few hours, for future readers)

I tuned in two stages (I was able to get good PSQT values from a different tuner) and found the elo gains of +24, and then +48 when tested at 30s+.03s.