I wrote a simple NN library, if anyone is interested in developping their own trainer. https://github.com/lucasart/nn
Simple code, documented, tested, easily extensible. Happy coding!
What it does:
Create network (fully connected MLP) with arbitrary dimensions and activation functions (linear, relu, sigmoid; trivial to add new ones).
Flexible functions to print network, or individual layers (for debugging or experimenting).
Load/Save network from/to binary file.
Feed forward.
Backpropagation (computes deltas given (input,output) example). Choice of absolute |x-y| or squared (x-y)^2 objective function (absolute probably makes more sense for chess).
Gradient (deduce gradient from deltas).
Computing the gradient for an example is really the fundamental building block. After that, you can calculate a more robust gradient estimation by averaging many samples (aka. batch or mini-batch). Follow constant * gradient steps (aka. SGD). And experiment with more advanced gradient descent methods. An excellent article on the topic https://ruder.io/optimizing-gradient-descent/.
Of course, you also need to some data (positions, eval, game result). Conviniently, https://github.com/lucasart/c-chess-cli can generate it with any UCI engine.
Theory and practice sometimes clash. And when that happens, theory loses. Every single time.
lucasart wrote: ↑Sun Apr 11, 2021 1:45 pm
I wrote a simple NN library, if anyone is interested in developping their own trainer. https://github.com/lucasart/nn
Simple code, documented, tested, easily extensible. Happy coding!
What it does:
Create network (fully connected MLP) with arbitrary dimensions and activation functions (linear, relu, sigmoid; trivial to add new ones).
Flexible functions to print network, or individual layers (for debugging or experimenting).
Load/Save network from/to binary file.
Feed forward.
Backpropagation (computes deltas given (input,output) example). Choice of absolute |x-y| or squared (x-y)^2 objective function (absolute probably makes more sense for chess).
Gradient (deduce gradient from deltas).
Computing the gradient for an example is really the fundamental building block. After that, you can calculate a more robust gradient estimation by averaging many samples (aka. batch or mini-batch). Follow constant * gradient steps (aka. SGD). And experiment with more advanced gradient descent methods. An excellent article on the topic https://ruder.io/optimizing-gradient-descent/.
Of course, you also need to some data (positions, eval, game result). Conviniently, https://github.com/lucasart/c-chess-cli can generate it with any UCI engine.
Thanks!, for this and all the other contributions to chess programming.
lucasart wrote: ↑Sun Apr 11, 2021 1:45 pm
I wrote a simple NN library, if anyone is interested in developping their own trainer. https://github.com/lucasart/nn
Simple code, documented, tested, easily extensible. Happy coding!
What it does:
Create network (fully connected MLP) with arbitrary dimensions and activation functions (linear, relu, sigmoid; trivial to add new ones).
Flexible functions to print network, or individual layers (for debugging or experimenting).
Load/Save network from/to binary file.
Feed forward.
Backpropagation (computes deltas given (input,output) example). Choice of absolute |x-y| or squared (x-y)^2 objective function (absolute probably makes more sense for chess).
Gradient (deduce gradient from deltas).
Computing the gradient for an example is really the fundamental building block. After that, you can calculate a more robust gradient estimation by averaging many samples (aka. batch or mini-batch). Follow constant * gradient steps (aka. SGD). And experiment with more advanced gradient descent methods. An excellent article on the topic https://ruder.io/optimizing-gradient-descent/.
Of course, you also need to some data (positions, eval, game result). Conviniently, https://github.com/lucasart/c-chess-cli can generate it with any UCI engine.
It sounds interesting! I'll take a look at it some time.
I actually began working on something similar a couple of weeks ago, but I got stuck . I know the math required to train and use neural networks, but since I am a first-timer when it comes to actually creating such libraries, I struggle with the implementation.
My repository is private at the moment since the code is such a mess that it probably shouldn't see daylight anytime soon haha
Have you tried using the library to train an evaluation function yet? If so, how was the strength results?