Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Explore dynamic weights for position evaluation #28

Open
zxul767 opened this issue Mar 22, 2022 · 0 comments
Open

Explore dynamic weights for position evaluation #28

zxul767 opened this issue Mar 22, 2022 · 0 comments

Comments

@zxul767
Copy link
Owner

zxul767 commented Mar 22, 2022

One of the major weaknesses of pawn at the moment is that its evaluation function is a linear combination of features. This means that even if we tune the weights to their best possible value (e.g., via genetic algorithms optimization), it is still unable to play various phases of the game with enough precision because what is relevant in one phase (e.g., king protection during the opening and middle game), becomes less relevant in another (e.g., with few pieces on the board, it is no longer a good idea to keep the king away from the battle.)

I first noticed this while I was watching it play against crafty and realized that even though at some point it seemed to have an interesting advantage, it wasn't able to capitalize on it because of the above.

It seems to me that one solution might be to define a set of weights w_i as a function of the features F, according to something along the lines of:

where

This last equation shows that the weight for a given feature is a non-linear function (sigma could be a sigmoid function, a ReLU or any other non-linear function) of all features. In other words, the importance of a feature at any point in the game is determined by all other features at that moment. Of course, this last mapping (w*) must be learned in some way to reach optimal play, so this again becomes an optimization problem, except that we must now learn a matrix of weights instead of a single vector.

The possibilities to learn this matrix of weights are many (e.g., genetic algorithms framework, temporal differences learning, supervised learning using other chess engines, etc.)

This idea can also be roughly but imprecisely implemented by using a ser of different weights in discrete phases of the game (i.e., opening, middle game, ending), which are usually determined via heuristics (e.g., the ending starts after a certain amount of material is left; the weight for mobility is smaller in the end than in the opening; etc.) Of course, this can help improve the engine's performance, but it's always limited by our own human prejudices about what's good or bad in chess. As AlphaZero has proven, humans aren't necessarily at the top of the knowledge pyramid in any given domain.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant