-
Notifications
You must be signed in to change notification settings - Fork 119
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
Randomly flip training positions #97
base: master
Are you sure you want to change the base?
Conversation
Castling rights are determined from the current position. It's possible for history to contain positions with flipped board and flipped castling.
I trained NN to predict if a chess position is flipped or not using the flipping logic in this PR. 41% of the positions were flipped and the network's success rate in predicting if the position is flipped was 89%. It looks like most of the flipped positions are clearly different enough from regular positions. |
Don't flip positions with too many pieces or positions where kings are in default or castling places as those are too easy to predict to be flipped.
The latest commit flips position with 50% probability if there are less than 16 pieces and both kings are not in the starting or castling squares in the oldest move in the history. This gets rid of opposite castling moves and positions that can be very easily determined to be flipped. With this change about 40% of the positions can be flipped on T40 data. There were some strange positions on T40 data with nans on Q and positions without kings, the latest commit also replaces assert with dropping the bad positions to avoid crashing on them. Training NN to predict if the positions are flipped or not gets about the same 90% correct with 20% of the positions flipped, so it can still predict if the position is flipped with better than random chance. The net trained with flipping is little stronger on my tests, but it could be within the random variation:
The test losses without flipping are similar on both nets trained with and without flipping. Before the test losses seemed to be worse with flipping. This still defaults off. Add |
This should become obsolete if the migration to input format 4 is successful, but that is still pending. |
When castling is not possible randomly flip the board including policy probabilities.
Currently this seems to result in a weaker net:
Since castling is determined from the current position history may contain positions where king is on the wrong square. Some positions are not equally likely to be encountered in match play in a flipped state and it's probably not useful to train NN on those cases. This probably makes more sense when training with Fischer random training data. For ordinary chess more care should be used to determine if position can be flipped.