Answers.Body: <p>Very old thread, but i will try to answer anyway. The configuration seems fine.</p>
  <p>Try to implement a simple NE (without augmenting topologies) and check if it works.</p>
  <pre><code>If it works:
      the problem is with augmenting topologies
      -----------------------------------------
      here is a large topic, there are different 
      implementations for it. One problem that i found 
      and might be the problem is the offspring 
      breeding. The paper says to kill the worst 
      individuals from the population, not the works 
      from each species. This is not good at all, since 
      an offspring that mutates and he's bad will be 
      killed instantly. Also, i recommend to keep at 
      least the champion of each species alive.
  else:
      the problem is with the network
      -------------------------------
      i recommend you to try different activation 
      functions, not only the one from the paper 
      1/(1+e^(-4.9f*x)). My solutions seem to have only 
      1 hidden neuron with activation functions like 
      squared, absolute, gaussian (check difference- 
      based mutation operation for NEAT paper). Never 
      found the sigmoid.
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2023-03-08T20:57:07.037Z
Answers.LastActivityDate: 2023-03-08T20:57:07.037Z
Answers.UserDisplayName: Formula PS4
Body: <p>I'm currently implementing the NEAT algorithm. But problems occur when testing it with problems which don't have a linear solution(for example xor). My xor only produces 3 correct outputs once at a time:</p>
  <pre><code>1, 0 -&gt; 0.99
  0, 0 -&gt; 0
  1, 1 -&gt; 0
  0, 1 -&gt; 0
  </code></pre>
  <p>My genome class works fine, so I guess that the problem occurs on breeding or that my config is wrong.</p>
  <p><strong>Config</strong></p>
  <pre><code>const size_t population_size = 150;
  const size_t inputs = 3 (2 inputs + bias);
  const size_t outputs = 1;
  double compatibility_threshold = 3;
  double steps = 0.01;
  double perturb_weight = 0.9;
  double mutate_connection = 0.05;
  double mutate_node = 0.03;
  double mutate_weights = 0.8;
  double mutate_disable = 0.1;
  double mutate_enable = 0.2;
  double c_excess = 1;
  double c_disjoint = 1;
  double c_weight = 0.4;
  double crossover_chance = 0.75;
  </code></pre>
  <p>Does anyone has an idea what the problem might be? I proof read my code multiple times, but wasnt able the figure it out.</p>
  <p>Here is the github link to my code(not documented): <a href="https://github.com/Creepsy/neat" rel="nofollow noreferrer">click</a></p>
  
Tags: <machine-learning><evolutionary-algorithms><unsupervised-learning><neat>
Title: NEAT can't solve XOR completely
UserDisplayName: Creepsy
ThreadText: # NEAT can't solve XOR completely
  
  (Asked by: username_0 on 2020-07-19)
  
  I'm currently implementing the NEAT algorithm. But problems occur when testing it with problems which don't have a linear solution(for example xor). My xor only produces 3 correct outputs once at a time:
  
  ```
  1, 0 -> 0.99
  0, 0 -> 0
  1, 1 -> 0
  0, 1 -> 0
  
  ```
  
  My genome class works fine, so I guess that the problem occurs on breeding or that my config is wrong.
  
  **Config**
  
  ```
  const size_t population_size = 150;
  const size_t inputs = 3 (2 inputs + bias);
  const size_t outputs = 1;
  double compatibility_threshold = 3;
  double steps = 0.01;
  double perturb_weight = 0.9;
  double mutate_connection = 0.05;
  double mutate_node = 0.03;
  double mutate_weights = 0.8;
  double mutate_disable = 0.1;
  double mutate_enable = 0.2;
  double c_excess = 1;
  double c_disjoint = 1;
  double c_weight = 0.4;
  double crossover_chance = 0.75;
  
  ```
  
  Does anyone has an idea what the problem might be? I proof read my code multiple times, but wasnt able the figure it out.
  
  Here is the github link to my code(not documented): [click](https://github.com/username_0/neat)
  
  **Tags:** machine-learning, evolutionary-algorithms, unsupervised-learning, neat
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2023-03-08. Score: 0
  
  Very old thread, but i will try to answer anyway. The configuration seems fine.
  
  Try to implement a simple NE (without augmenting topologies) and check if it works.
  
  ```
  If it works:
      the problem is with augmenting topologies
      -----------------------------------------
      here is a large topic, there are different 
      implementations for it. One problem that i found 
      and might be the problem is the offspring 
      breeding. The paper says to kill the worst 
      individuals from the population, not the works 
      from each species. This is not good at all, since 
      an offspring that mutates and he's bad will be 
      killed instantly. Also, i recommend to keep at 
      least the champion of each species alive.
  else:
      the problem is with the network
      -------------------------------
      i recommend you to try different activation 
      functions, not only the one from the paper 
      1/(1+e^(-4.9f*x)). My solutions seem to have only 
      1 hidden neuron with activation functions like 
      squared, absolute, gaussian (check difference- 
      based mutation operation for NEAT paper). Never 
      found the sigmoid.
  
  ```
  
  
  ---
  
  