evonet 0.1.0.dev16__tar.gz → 0.1.0.dev17__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {evonet-0.1.0.dev16 → evonet-0.1.0.dev17}/PKG-INFO +1 -1
- {evonet-0.1.0.dev16 → evonet-0.1.0.dev17}/evonet/core.py +37 -35
- {evonet-0.1.0.dev16 → evonet-0.1.0.dev17}/evonet.egg-info/PKG-INFO +1 -1
- {evonet-0.1.0.dev16 → evonet-0.1.0.dev17}/pyproject.toml +1 -1
- {evonet-0.1.0.dev16 → evonet-0.1.0.dev17}/LICENSE +0 -0
- {evonet-0.1.0.dev16 → evonet-0.1.0.dev17}/README.md +0 -0
- {evonet-0.1.0.dev16 → evonet-0.1.0.dev17}/evonet/__init__.py +0 -0
- {evonet-0.1.0.dev16 → evonet-0.1.0.dev17}/evonet/activation.py +0 -0
- {evonet-0.1.0.dev16 → evonet-0.1.0.dev17}/evonet/connection.py +0 -0
- {evonet-0.1.0.dev16 → evonet-0.1.0.dev17}/evonet/core_mit_plot_simple.py +0 -0
- {evonet-0.1.0.dev16 → evonet-0.1.0.dev17}/evonet/enums.py +0 -0
- {evonet-0.1.0.dev16 → evonet-0.1.0.dev17}/evonet/io.py +0 -0
- {evonet-0.1.0.dev16 → evonet-0.1.0.dev17}/evonet/layer.py +0 -0
- {evonet-0.1.0.dev16 → evonet-0.1.0.dev17}/evonet/mutation.py +0 -0
- {evonet-0.1.0.dev16 → evonet-0.1.0.dev17}/evonet/neuron.py +0 -0
- {evonet-0.1.0.dev16 → evonet-0.1.0.dev17}/evonet/serialization.py +0 -0
- {evonet-0.1.0.dev16 → evonet-0.1.0.dev17}/evonet/utils.py +0 -0
- {evonet-0.1.0.dev16 → evonet-0.1.0.dev17}/evonet/visualize.py +0 -0
- {evonet-0.1.0.dev16 → evonet-0.1.0.dev17}/evonet.egg-info/SOURCES.txt +0 -0
- {evonet-0.1.0.dev16 → evonet-0.1.0.dev17}/evonet.egg-info/dependency_links.txt +0 -0
- {evonet-0.1.0.dev16 → evonet-0.1.0.dev17}/evonet.egg-info/requires.txt +0 -0
- {evonet-0.1.0.dev16 → evonet-0.1.0.dev17}/evonet.egg-info/top_level.txt +0 -0
- {evonet-0.1.0.dev16 → evonet-0.1.0.dev17}/setup.cfg +0 -0
- {evonet-0.1.0.dev16 → evonet-0.1.0.dev17}/tests/test_activation.py +0 -0
- {evonet-0.1.0.dev16 → evonet-0.1.0.dev17}/tests/test_core.py +0 -0
- {evonet-0.1.0.dev16 → evonet-0.1.0.dev17}/tests/test_nnet_io_and_forward.py +0 -0
- {evonet-0.1.0.dev16 → evonet-0.1.0.dev17}/tests/test_recurrent_dynamics.py +0 -0
|
@@ -161,41 +161,43 @@ class Nnet:
|
|
|
161
161
|
return new_neurons
|
|
162
162
|
|
|
163
163
|
weight = connection_init_value(connection_init)
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
164
|
+
|
|
165
|
+
# Build connections for each new neuron
|
|
166
|
+
for n in new_neurons:
|
|
167
|
+
|
|
168
|
+
possible_in: list[Neuron] = []
|
|
169
|
+
possible_out: list[Neuron] = []
|
|
170
|
+
|
|
171
|
+
# ADJACENT connections
|
|
172
|
+
if connection_scope == "adjacent":
|
|
173
|
+
if layer_idx > 0:
|
|
174
|
+
possible_in.extend(self.layers[layer_idx - 1].neurons)
|
|
175
|
+
if role == NeuronRole.HIDDEN and layer_idx < len(self.layers) - 1:
|
|
176
|
+
possible_out.extend(self.layers[layer_idx + 1].neurons)
|
|
177
|
+
|
|
178
|
+
# CROSSLAYER connections
|
|
179
|
+
elif connection_scope == "crosslayer":
|
|
180
|
+
# All earlier layers ---> new neuron
|
|
181
|
+
for i in range(0, layer_idx):
|
|
182
|
+
possible_in.extend(self.layers[i].neurons)
|
|
183
|
+
# New neuron ---> all later layers
|
|
184
|
+
for j in range(layer_idx + 1, len(self.layers)):
|
|
185
|
+
possible_out.extend(self.layers[j].neurons)
|
|
186
|
+
|
|
187
|
+
# Density control per neuron
|
|
188
|
+
if connection_density < 1.0:
|
|
189
|
+
if possible_in:
|
|
190
|
+
k_in = max(1, int(len(possible_in) * connection_density))
|
|
191
|
+
possible_in = random.sample(possible_in, k_in)
|
|
192
|
+
if possible_out:
|
|
193
|
+
k_out = max(1, int(len(possible_out) * connection_density))
|
|
194
|
+
possible_out = random.sample(possible_out, k_out)
|
|
195
|
+
|
|
196
|
+
# Create the actual connections
|
|
197
|
+
for src in possible_in:
|
|
198
|
+
self.add_connection(src, n, weight=weight)
|
|
199
|
+
for dst in possible_out:
|
|
200
|
+
self.add_connection(n, dst, weight=weight)
|
|
199
201
|
|
|
200
202
|
# Recurrent connections
|
|
201
203
|
if recurrent:
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|