Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -62,9 +62,9 @@ class GeneticAlgorithm:
|
|
62 |
def mutation(self):
|
63 |
for net in self.population:
|
64 |
if random.random() < 0.1:
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
|
69 |
# Streamlit app
|
70 |
st.title("Evolution of Sub-Models")
|
|
|
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)
|
68 |
|
69 |
# Streamlit app
|
70 |
st.title("Evolution of Sub-Models")
|