Learning a board game using a genetic neural network
I've never really done any practical machine learning, this is just a hobby for me.
I'm trying to create a process using a neural network to learn the board game 7 Wonders. Here's how I want this experiment to be done:
- Take all inputs (I've calculated 1278 of them to start with).
- Send the inputs through a neural network with an arbitrary amount of hidden layers, randomly initialize weights, and calculate values for all possible actions to take (231 outputs with some valid or invalid at any given time. If the chosen action is invalid, pick the next best output based on q-value.)
- For an initial round, use the same hidden layers with their biases/weights for the entirety of a game for 100 games and get the average score (fitness) this set of biases/weights produces.
- Mutate the hidden layers biases/weights by a small amount.
- Run another 100 games using the new set of biases/weights. If this set produces better scores, use this new set as the next generation (a new successful generation). Otherwise, mutate a new set based on the original parent.
As I understand this, what I've described so far is stochastic gradient descent. This can produce suboptimal minima so to avoid that, I want to introduce new parents to mate by doing the same process. And after an arbitrary amount of generations for 2 parents, combine their biases/weights, and reapply the process above to the new child. I would repeat this process until a child is produced that almost always wins games.
My questions are as follows:
- Does this experiment as I've described make sense?
- I'm trying to write this all in Python. I've been trying to use sklearn's
MLPClassifier
but I can't seem to figure out how to randomly initialize my hidden layer nor can I figure out how to manually manipulate the hidden layer. I'm not trying to train an MLP using a supervised approach (as far as I understand) which is what this class in sklearn seems to be used for. Is this a good library to use? Does anyone have a suggestion on a different library for this?
Topic game neural-network python
Category Data Science