Nonlinear eval terms
Moderators: bob, hgm, Harvey Williamson
Forum rules
This textbox is used to restore diagrams posted with the [d] tag before the upgrade.
This textbox is used to restore diagrams posted with the [d] tag before the upgrade.
Nonlinear eval terms
How do you determine if eval term or terms are nonlinear and what function would best represent them?
Re: Nonlinear eval terms
I'm not entirely sure what you mean.jwes wrote:How do you determine if eval term or terms are nonlinear and what function would best represent them?
If the evaluation function is
Code: Select all
Eval = sum eval_term_i
Code: Select all
eval_term_i = weight_i * feature_i
Code: Select all
eval_term_i = weight_ijk feature_ijk (implied sum over indices j and k)
If it has the form
Code: Select all
eval_term_i = weight_ij feature_ik feature jk
A function f(x) is linear if f(lambda x) = lambda f(x).
Now, if you meant to ask: how do I know which evaluation terms should be linear and which shouldn't  you don't. That's one of the things you have to experiment with. There's also no absolute rule that says what sort of functional form terms should take. There are a few pointers though. For instance, what is more valuable: passed pawns on c4 and f6, or passed pawns on c5 and f5? A term that is linear in the distance to promotion squares considers these equal. A term that is quadratic in the distance considers the first preferable (which I think is what most programs have). Similar for pressure on the king: it becomes much stronger as pieces are added. Note that these things are typically nonlinear in the feature they measure (attack pressure against the king, distance to promotion) but not in the evaluation weight.
As for what form you should use  a question is whether it really matters that much. I personally like logisticlike functions because they saturate as their argument approaches infinity (as opposed to blowing up, as quadratic functions would). Of course chess boards are pretty small, so I suspect that you can approximate any more complicated function on it quite reasonably by a multinomial with only a few terms.
Re: Nonlinear eval terms
In neural networks they use Sigmoid which looks like an arctangent.
Or maybe search on radial basis functions.
Or maybe search on radial basis functions.

 Posts: 3952
 Joined: Fri Mar 10, 2006 4:23 am
 Location: http://www.arasanchess.org
Re: Nonlinear eval terms
Many engines have used nonlinear formulas to derive eval terms, for example this can be done for passed pawns. One reason to do this is that you have fewer eval terms to tune. So for example if the passed pawn formula is quadratic, you can get away with 3 terms (the coefficients) instead of 6 terms (each possible passed pawn rank).
But if you are using an automatic tuning method based on linear weights, as I do now, it is actually simpler and better to just have a lot of independent terms each of which is triggered by a unique feature. It costs practically no more to tune a large set vs. a small set of parameters using gradient descent (as opposed to say, using something like CLOP, where tuning large parameter sets is hard).
I now have very few nonlinear terms. The main ones remaining are related to king cover and king safety. The scores for king cover and king attacks interact and combine in a fairly complex nonlinear way. I have tuned the parameters for this using various methods but can't readily use the automated tuner for it.
Jon
But if you are using an automatic tuning method based on linear weights, as I do now, it is actually simpler and better to just have a lot of independent terms each of which is triggered by a unique feature. It costs practically no more to tune a large set vs. a small set of parameters using gradient descent (as opposed to say, using something like CLOP, where tuning large parameter sets is hard).
I now have very few nonlinear terms. The main ones remaining are related to king cover and king safety. The scores for king cover and king attacks interact and combine in a fairly complex nonlinear way. I have tuned the parameters for this using various methods but can't readily use the automated tuner for it.
Jon