Answers.Body: <p>Re: Should I also have it randomly delete nodes and connections, in case they also make improvements?<br>
  You may read about "dropout". In this case it's not preferred since overfitting is actually a benefit.  </p>
  
  <p>Re: Should the nodes in the hidden layer perform a logical AND on all of their inputs or an OR?<br>
  There are no logical operations in Neural Networks. You need to multiply the input by the weights. At the end you will arrive to a fraction number that you need to convert back to 1 or 0, here I suggest to look into "softmax" that is an activation function exactly for this.  </p>
  
  <p>Re:how do I know if it will ever get above 90% accuracy, or even just 50%?<br>
  As Jaden suggested you will need a benchmark. You may simply take my results from your other post. (i.e 100% in 20 epochs)  </p>
  
  <p>I agree with Jaden, you have a lot on your table. Perhaps it would make sense to first develop a DNN to learn the GOL, you will need the activations, the loss calculation and at least one optimizer. Once this is tested and working you could start with the second model for the genetic algorithm that will need a different loss function and also the genetic operations, population selection etc. Nice big project, good luck!</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-08-08T13:05:45.970Z
Answers.Text: A big project yes, but one I have until christmas to complete and write up.
Answers.UserDisplayName: Aric
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-08-08T12:50:15.443Z
Answers.LastActivityDate: 2017-08-08T12:50:15.443Z
Answers.UserDisplayName: Manngo
Body: <p>I'm aiming to create a neural network that can learn to predict the next state of a board using the rules of Conway's Game of Life.</p>
  <p>Technically, I have three questions, but I felt that they needed to be together to get the full picture.</p>
  <p>My network will look at each cell individually (to reduce the computing power needed and to increase learning speed) and its surrounding cells. 9 input nodes for the network will go into one hidden layer. The output layer will be one node for the state of that cell in the next state of the game.</p>
  <p>Nodes have two states (alive and dead) and connections between nodes can either transfer that value or invert it.</p>
  <p>For the learning part, I was going to make use of mutation and natural selection. The starting network will have the input and output layers with no hidden layer and no connections. My idea was then to introduce mutation by randomly generating a number of new networks by adding nodes and randomly connecting them to inputs and to the output. The number of nodes in the middle layer will be limited to 512, since there are 512 possible inputs; however, I may reduce this if it is too slow.</p>
  <p><strong>Should I also have it randomly delete nodes and connections, in case they also make improvements?</strong></p>
  <p>Each network will be tested on the same board state, and their accuracy will be calculated by comparing their output to a correct output generated by a computer program. The most accurate network will then be used for the next generation.</p>
  <p>My issue is that I don't know how to program the nodes. <strong>Should the nodes in the hidden layer perform a logical AND on all of their inputs or an OR?</strong></p>
  <p>I know that the network won't learn the rules within the first few turns, but <strong>how do I know if it will ever get above 90% accuracy, or even just 50%?</strong></p>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2017-08-04T19:28:32.220Z
Comments.Text: Since GOL is a deterministic model, is the purpose of this endeavor to predict future board states more efficiently?  *(i.e. running a GOL gametree is indistinguishable from running the game, in that there is a single node for each ply.)*  I ask because I find this question quite interesting, but wasn't sure if this process would be applied to GOL, or other models.  Welcome to Stack AI!
Comments.UserDisplayName: DukeZhou
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2017-08-04T21:26:08.550Z
Comments.Text: You can cut your maximum number of inputs down to 128 from 512 by recognizing that the rest of the inputs can be generated by rotating the input.
  [1,1,0]                       [1,0,1]
  [0,0,1]  rotated 90 =  [0,0,1]
  [1,0,1]                       [1,1,0]
  this will require a little preprocessing before the state is fed into the network but shouldn't be too hard to figure out.
Comments.UserDisplayName: Jaden Travnik
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2017-08-04T21:35:44.027Z
Comments.Text: I think you may have a few too many things going on in the same project, I think you should focus on being able to predict the game of life and once you have a network that does this, you can explore natural selection methods. From your question, you want to use natural selection methods to solve this problem but I think you should make a network using other methods before trying the natural selection approach. I say this because it will help you design a network evaluation codebase and then you will have a benchmark to test against.
Comments.UserDisplayName: Jaden Travnik
Tags: <neural-networks><genetic-algorithms><convergence>
Title: How to create and train (with mutation and selection) a neural network to predict the next state of a board?
UserDisplayName: Aric
ThreadText: # How to create and train (with mutation and selection) a neural network to predict the next state of a board?
  
  (Asked by: username_0 on 2017-08-04)
  
  I'm aiming to create a neural network that can learn to predict the next state of a board using the rules of Conway's Game of Life.
  
  Technically, I have three questions, but I felt that they needed to be together to get the full picture.
  
  My network will look at each cell individually (to reduce the computing power needed and to increase learning speed) and its surrounding cells. 9 input nodes for the network will go into one hidden layer. The output layer will be one node for the state of that cell in the next state of the game.
  
  Nodes have two states (alive and dead) and connections between nodes can either transfer that value or invert it.
  
  For the learning part, I was going to make use of mutation and natural selection. The starting network will have the input and output layers with no hidden layer and no connections. My idea was then to introduce mutation by randomly generating a number of new networks by adding nodes and randomly connecting them to inputs and to the output. The number of nodes in the middle layer will be limited to 512, since there are 512 possible inputs; however, I may reduce this if it is too slow.
  
  **Should I also have it randomly delete nodes and connections, in case they also make improvements?**
  
  Each network will be tested on the same board state, and their accuracy will be calculated by comparing their output to a correct output generated by a computer program. The most accurate network will then be used for the next generation.
  
  My issue is that I don't know how to program the nodes. **Should the nodes in the hidden layer perform a logical AND on all of their inputs or an OR?**
  
  I know that the network won't learn the rules within the first few turns, but **how do I know if it will ever get above 90% accuracy, or even just 50%?**
  
  **Tags:** neural-networks, genetic-algorithms, convergence
  > **Comments:**
  > **username_1**: Since GOL is a deterministic model, is the purpose of this endeavor to predict future board states more efficiently?  *(i.e. running a GOL gametree is indistinguishable from running the game, in that there is a single node for each ply.)*  I ask because I find this question quite interesting, but wasn't sure if this process would be applied to GOL, or other models.  Welcome to Stack AI!  
  > **username_2**: You can cut your maximum number of inputs down to 128 from 512 by recognizing that the rest of the inputs can be generated by rotating the input. [1,1,0]                       [1,0,1] [0,0,1]  rotated 90 =  [0,0,1] [1,0,1]                       [1,1,0] this will require a little preprocessing before the state is fed into the network but shouldn't be too hard to figure out.  
  > **username_2**: I think you may have a few too many things going on in the same project, I think you should focus on being able to predict the game of life and once you have a network that does this, you can explore natural selection methods. From your question, you want to use natural selection methods to solve this problem but I think you should make a network using other methods before trying the natural selection approach. I say this because it will help you design a network evaluation codebase and then you will have a benchmark to test against.  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_3 on 2017-08-08. Score: 2 | Accepted answer
  
  Re: Should I also have it randomly delete nodes and connections, in case they also make improvements?  
  You may read about "dropout". In this case it's not preferred since overfitting is actually a benefit.
  
  Re: Should the nodes in the hidden layer perform a logical AND on all of their inputs or an OR?  
  There are no logical operations in Neural Networks. You need to multiply the input by the weights. At the end you will arrive to a fraction number that you need to convert back to 1 or 0, here I suggest to look into "softmax" that is an activation function exactly for this.
  
  Re:how do I know if it will ever get above 90% accuracy, or even just 50%?  
  As Jaden suggested you will need a benchmark. You may simply take my results from your other post. (i.e 100% in 20 epochs)
  
  I agree with Jaden, you have a lot on your table. Perhaps it would make sense to first develop a DNN to learn the GOL, you will need the activations, the loss calculation and at least one optimizer. Once this is tested and working you could start with the second model for the genetic algorithm that will need a different loss function and also the genetic operations, population selection etc. Nice big project, good luck!
  
  > **Comments:**
  > **username_0**: A big project yes, but one I have until christmas to complete and write up.  
  
  ---
  
  