Answers.Body: <p>Your species count will increase as the chance of mutation increases. This is because in every generation, so many genes will be mutated that they have little resemblance of each other, and the distance function doesn't factor in historical markings / innovation numbers.</p>
  
  <p>Try lowering the mutation rates.</p>
  
  <p>Below is the distance function from <a href="http://nn.cs.utexas.edu/downloads/papers/stanley.ec02.pdf" rel="nofollow noreferrer">here</a> page 110</p>
  
  <p><span class="math-container">$$\delta = \frac{c_1E}{N} + \frac{c_2D}{N} + c_3 \cdot \overline{W}.  $$</span></p>
  
  <p>If your fitness vary a lot, try ranking the fitnesses in each specie and setting the survival chance based on its rank.</p>
  
  <p>If you mean a large action space by changing environment, you can set the number of output nodes to the total number of actions, and rank each action, best to worst, then pick the best available action for the state. </p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-08-13T04:09:12.900Z
Answers.LastActivityDate: 2019-08-13T21:29:49.000Z
Answers.LastEditDate: 2019-08-13T21:29:49.000Z
Answers.UserDisplayName: Terry T.
Answers.Body: <p>If the compatibility distances are coming out to be > float.max that tells me something may be wrong with that calculation, I would suggest setting break points and debugging that code, I usually have my threshold set 5-10 and can noticeably tell when a change in species size when i move the threshold to something like 10 </p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-09-13T13:45:57.517Z
Answers.LastActivityDate: 2019-09-13T14:11:35.257Z
Answers.LastEditDate: 2019-09-13T14:11:35.257Z
Answers.UserDisplayName: nickw
Body: <p>I am using the following library:
  <a href="https://github.com/vishnugh/evo-NEAT" rel="nofollow noreferrer">https://github.com/vishnugh/evo-NEAT</a></p>
  
  <p>which seems to be a pretty simple NEAT-implementation. 
  Therefore I am using the following Config:</p>
  
  <pre><code>package com.evo.NEAT.com.evo.NEAT.config;
  
  /**
   * Created by vishnughosh on 01/03/17.
   */
  public class NEAT_Config {
  
      public static final int INPUTS = 11;
      public static final int OUTPUTS = 2;
      public static final int HIDDEN_NODES = 100;
      public static final int POPULATION =300;
  
      public static final float COMPATIBILITY_THRESHOLD = Float.MAX_VALUE;
      public static final float EXCESS_COEFFICENT = 1;
      public static final float DISJOINT_COEFFICENT = 1;
      public static final float WEIGHT_COEFFICENT = 5;
  
      public static final float STALE_SPECIES = 2;
  
  
      public static final float STEPS = 0.1f;
      public static final float PERTURB_CHANCE = 0.9f;
      public static final float WEIGHT_CHANCE = 0.5f;
      public static final float WEIGHT_MUTATION_CHANCE = 0.5f;
      public static final float NODE_MUTATION_CHANCE = 0.1f;
      public static final float CONNECTION_MUTATION_CHANCE = 0.1f;
      public static final float BIAS_CONNECTION_MUTATION_CHANCE = 0.1f;
      public static final float DISABLE_MUTATION_CHANCE = 0.1f;
      public static final float ENABLE_MUTATION_CHANCE = 0.2f ;
      public static final float CROSSOVER_CHANCE = 0.1f;
  
      public static final int STALE_POOL = 10;
  }
  </code></pre>
  
  <p>However, there are way too much species (about 60). I do not know how to reduce this number, given the fact that the COMPATIBILITY_THRESHOLD is already maximized.</p>
  
  <p>So what's my fault?</p>
  
  <p>Note: I am not using: <a href="http://nn.cs.utexas.edu/keyword?stanley:ec02" rel="nofollow noreferrer">http://nn.cs.utexas.edu/keyword?stanley:ec02</a> 
  since this algorithm seems not to work in a changing environment (where fitness can vary hardly)</p>
  
Tags: <evolutionary-algorithms><neat>
Title: How to reduce amount of species in NEAT?
UserDisplayName: TVSuchty
ThreadText: # How to reduce amount of species in NEAT?
  
  (Asked by: username_0 on 2019-05-21)
  
  I am using the following library:
  https://github.com/vishnugh/evo-NEAT
  which seems to be a pretty simple NEAT-implementation. 
  Therefore I am using the following Config:
  package com.evo.NEAT.com.evo.NEAT.config;
  
  /**
   * Created by vishnughosh on 01/03/17.
   */
  public class NEAT_Config {
  
      public static final int INPUTS = 11;
      public static final int OUTPUTS = 2;
      public static final int HIDDEN_NODES = 100;
      public static final int POPULATION =300;
  
      public static final float COMPATIBILITY_THRESHOLD = Float.MAX_VALUE;
      public static final float EXCESS_COEFFICENT = 1;
      public static final float DISJOINT_COEFFICENT = 1;
      public static final float WEIGHT_COEFFICENT = 5;
  
      public static final float STALE_SPECIES = 2;
  
  
      public static final float STEPS = 0.1f;
      public static final float PERTURB_CHANCE = 0.9f;
      public static final float WEIGHT_CHANCE = 0.5f;
      public static final float WEIGHT_MUTATION_CHANCE = 0.5f;
      public static final float NODE_MUTATION_CHANCE = 0.1f;
      public static final float CONNECTION_MUTATION_CHANCE = 0.1f;
      public static final float BIAS_CONNECTION_MUTATION_CHANCE = 0.1f;
      public static final float DISABLE_MUTATION_CHANCE = 0.1f;
      public static final float ENABLE_MUTATION_CHANCE = 0.2f ;
      public static final float CROSSOVER_CHANCE = 0.1f;
  
      public static final int STALE_POOL = 10;
  }
  
  However, there are way too much species (about 60). I do not know how to reduce this number, given the fact that the COMPATIBILITY_THRESHOLD is already maximized.
  So what's my fault?
  Note: I am not using: http://nn.cs.utexas.edu/keyword?stanley:ec02 
  since this algorithm seems not to work in a changing environment (where fitness can vary hardly)
  
  **Tags:** evolutionary-algorithms, neat
  
  ---
  
  ## 2 answers
  
  ### Answer by username_1 on 2019-08-13. Score: 1
  
  Your species count will increase as the chance of mutation increases. This is because in every generation, so many genes will be mutated that they have little resemblance of each other, and the distance function doesn't factor in historical markings / innovation numbers.
  
  Try lowering the mutation rates.
  
  Below is the distance function from [here](http://nn.cs.utexas.edu/downloads/papers/stanley.ec02.pdf) page 110
  
  $$\delta = \frac{c\_1E}{N} + \frac{c\_2D}{N} + c\_3 \cdot \overline{W}. $$
  
  If your fitness vary a lot, try ranking the fitnesses in each specie and setting the survival chance based on its rank.
  
  If you mean a large action space by changing environment, you can set the number of output nodes to the total number of actions, and rank each action, best to worst, then pick the best available action for the state.
  
  
  ---
  
  ### Answer by username_2 on 2019-09-13. Score: 0
  
  If the compatibility distances are coming out to be > float.max that tells me something may be wrong with that calculation, I would suggest setting break points and debugging that code, I usually have my threshold set 5-10 and can noticeably tell when a change in species size when i move the threshold to something like 10
  
  
  ---
  
  