Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -61,7 +61,7 @@ class GeneticAlgorithm:
|
|
61 |
|
62 |
def mutation(self):
|
63 |
for net in self.population:
|
64 |
-
|
65 |
weights = net.get_weights()
|
66 |
new_weights = [np.array(w) + np.random.randn(*w.shape) * 0.1 for w in weights]
|
67 |
net.set_weights(new_weights)
|
|
|
61 |
|
62 |
def mutation(self):
|
63 |
for net in self.population:
|
64 |
+
if random.random() < 0.1:
|
65 |
weights = net.get_weights()
|
66 |
new_weights = [np.array(w) + np.random.randn(*w.shape) * 0.1 for w in weights]
|
67 |
net.set_weights(new_weights)
|