Sephfox commited on
Commit
9a1cd91
·
verified ·
1 Parent(s): ad73055

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -2
app.py CHANGED
@@ -45,7 +45,7 @@ class GeneticAlgorithm:
45
  self.population = [self.population[i] for i in np.argsort(fitness)[-len(self.population)//2:]]
46
 
47
  def crossover(self):
48
- offspring = []
49
  for _ in range(len(self.population)//2):
50
  parent1, parent2 = random.sample(self.population, 2)
51
  child = Net()
@@ -65,7 +65,7 @@ class GeneticAlgorithm:
65
  child.fc2.set_weights(child_weights[2:4])
66
  child.fc3.set_weights(child_weights[4:])
67
 
68
- offspring.append(child)
69
  self.population += offspring
70
 
71
  def mutation(self):
 
45
  self.population = [self.population[i] for i in np.argsort(fitness)[-len(self.population)//2:]]
46
 
47
  def crossover(self):
48
+ offspring = []
49
  for _ in range(len(self.population)//2):
50
  parent1, parent2 = random.sample(self.population, 2)
51
  child = Net()
 
65
  child.fc2.set_weights(child_weights[2:4])
66
  child.fc3.set_weights(child_weights[4:])
67
 
68
+ offspring.append(child)
69
  self.population += offspring
70
 
71
  def mutation(self):