Hi Pio, of course I appreciate your support!Pio wrote: ↑Mon Jan 11, 2021 1:07 amI tried my best to read your code but I have only programmed very little in C++ 15 years ago.Desperado wrote: ↑Mon Jan 11, 2021 12:25 am Hi Pio,
... What do you mean by the tuner cannot split the average term for a term? ...In the simpleEval() the tuner will produce an average score of 300Code: Select all
simpleEval(){ int mat[PID] = {0,100,300,300,500,900}; score = materialscore(); return score }
for a minor piece. The score for a knight cannot be devided into sth. like
(100+500)/2 which is also 300 for that term (knight value).
In the tapered eval() the tuner gets the opportunity to divide the term (knight value),Code: Select all
taperedEval() { int mgMat[PID] = {0, 50, 60, 70 150, 200}; int egMat[PID] = {0,150,540,530,850,1600}; mg = materialMG(); eg = materialEG(); score = (mg * phase + eg *(PHASE_MAX-phase)) / PHASE_MAX return score; }
into something like (60+540)/2 which is also 300. The tuner tries to keep the 300 BUT
If you have 10000 positions and the average mg-phase is 13 of 24, the weights are 13(mg):11(eg)
code speaks more than words...The tuner will bring the mg value to its minum because the phase factor is dominant.Code: Select all
const int mg_eg_sum = 200; // pawnvalue (90,110) int mg, eg; for(int i = 0; i < mg_eg_sum; i++) { mg = (mg_eg_sum - i); eg = i; printf("\n[%d %d %.4f] ", mg, eg, (double) ((mg * 13) + (eg * 11)) / 24); } getchar();
Now, a short answer to your last post. Please look at the routines minimize() and solve().Code: Select all
[200 0 108.3333] [199 1 108.2500] [198 2 108.1667] [197 3 108.0833] [196 4 108.0000] [195 5 107.9167] [194 6 107.8333] [193 7 107.7500] [192 8 107.6667] [191 9 107.5833] [190 10 107.5000] ... [1 199 91.7500]
There is a pretty simple documentation what the functions are doing. One Epoch loops over all parameters,
modifiying each single one by a tiny amount, as long it can be improved. The minimizing code is at most 50 lines
of code (with code duplication). The complete logic can be seen in this routine it is very simple.
I gladly accept suggestions for improvement, especially if the code shown was also read
Thanks anyway for your ideas and comments.
Regards.
I got the impression that you tried to get a very good estimate of every term by itself with the following code.
I have no idea about what you mean byCode: Select all
offset; do { // copies current score values. If the result does not improve // we will restore the scores. updateParameters(BACKUP); // modify and compute resulting mse *param[id].score -= offset; lo = mse(); // no further improvement, there is nothing more todo for // the current parameter. restore the score from the latest // modification and continue parameter loop. if(lo >= bestFitness) { updateParameters(RESET); break; } bestFitness = lo; printParameters(param); printf(" %f ", bestFitness); } while(1);
The values tuned won’t change their values in a direct way depending on the phase at all (if the phase is not also tuned). Only the sensitivity will go up with the weight (or phase it has) since the term will contribute more to the error.The tuner will bring the mg value to its minum because the phase factor is dominant.
I have read the code you posted, but I have no idea of how you are handling the tuning of your tapered eval. The tuning of the tapered eval should not be any different than with not having a tapered eval. You can just see the different MG EG terms as completely distinct terms that they are.
I am trying to help but I cannot guess code you haven’t posted. If you don’t want my advice such as speeding up the convergence exponentially I won’t answer any more.
The point has only been that I have already implemented your explanations (at least I think so).
There is also no further code. It is as simple as it is described.
The things you dont see are loading an epd file, loading(setting) the parameters and some helper functions.
The param_t includes a reference on the eval variable and a backup score and a stepsize.
Nothing more to see. It works, and getting convergence between 20 to 50 epochs and talking of minutes isn't bad at all, i think.
So, what concrete changes do you suggest? And what part of the code (in c++ relation) don't you understand?
I am not sure which parts cannot be read in abstract way. Let me know and i will explain in simple words.
These numbers are an example how the tuner will "weight" the error with a average distribution
of the phases of 13:11. (max phase 24)
In the example i thought of a pawn value 100 mg(100),eg(100)
Code: Select all
[mg|eg|phase(13:11)
[200 0 108.3333]
[199 1 108.2500]
[198 2 108.1667]
[197 3 108.0833]
...
[1 199 91.7500]
the average eg-score is multiplied with 11. This weights the error depending on the ratio.
So, even if the error given by the mg score equals the error of the eg score, the tuner will
set the mg score to "0" and the eg score "200" because 200 * 11 is less than 200 * 13.
This is a continuous function, which leads to the one or the other extreme [0,200] or [200,0].
For a better explanation you need to plug in the code snippets in your environment and follow the code.
Thanks for your help.