evonet 0.1.0.dev6__tar.gz → 0.1.0.dev7__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.dev6 → evonet-0.1.0.dev7}/PKG-INFO +1 -1
- {evonet-0.1.0.dev6 → evonet-0.1.0.dev7}/evonet/mutation.py +8 -3
- {evonet-0.1.0.dev6 → evonet-0.1.0.dev7}/evonet.egg-info/PKG-INFO +1 -1
- {evonet-0.1.0.dev6 → evonet-0.1.0.dev7}/pyproject.toml +1 -1
- {evonet-0.1.0.dev6 → evonet-0.1.0.dev7}/LICENSE +0 -0
- {evonet-0.1.0.dev6 → evonet-0.1.0.dev7}/README.md +0 -0
- {evonet-0.1.0.dev6 → evonet-0.1.0.dev7}/evonet/__init__.py +0 -0
- {evonet-0.1.0.dev6 → evonet-0.1.0.dev7}/evonet/activation.py +0 -0
- {evonet-0.1.0.dev6 → evonet-0.1.0.dev7}/evonet/connection.py +0 -0
- {evonet-0.1.0.dev6 → evonet-0.1.0.dev7}/evonet/core.py +0 -0
- {evonet-0.1.0.dev6 → evonet-0.1.0.dev7}/evonet/enums.py +0 -0
- {evonet-0.1.0.dev6 → evonet-0.1.0.dev7}/evonet/io.py +0 -0
- {evonet-0.1.0.dev6 → evonet-0.1.0.dev7}/evonet/layer.py +0 -0
- {evonet-0.1.0.dev6 → evonet-0.1.0.dev7}/evonet/neuron.py +0 -0
- {evonet-0.1.0.dev6 → evonet-0.1.0.dev7}/evonet/utils.py +0 -0
- {evonet-0.1.0.dev6 → evonet-0.1.0.dev7}/evonet/visualize.py +0 -0
- {evonet-0.1.0.dev6 → evonet-0.1.0.dev7}/evonet.egg-info/SOURCES.txt +0 -0
- {evonet-0.1.0.dev6 → evonet-0.1.0.dev7}/evonet.egg-info/dependency_links.txt +0 -0
- {evonet-0.1.0.dev6 → evonet-0.1.0.dev7}/evonet.egg-info/requires.txt +0 -0
- {evonet-0.1.0.dev6 → evonet-0.1.0.dev7}/evonet.egg-info/top_level.txt +0 -0
- {evonet-0.1.0.dev6 → evonet-0.1.0.dev7}/setup.cfg +0 -0
- {evonet-0.1.0.dev6 → evonet-0.1.0.dev7}/tests/test_activation.py +0 -0
- {evonet-0.1.0.dev6 → evonet-0.1.0.dev7}/tests/test_core.py +0 -0
- {evonet-0.1.0.dev6 → evonet-0.1.0.dev7}/tests/test_nnet_io_and_forward.py +0 -0
- {evonet-0.1.0.dev6 → evonet-0.1.0.dev7}/tests/test_recurrent_dynamics.py +0 -0
|
@@ -242,11 +242,16 @@ def remove_random_connection(net: Nnet) -> None:
|
|
|
242
242
|
conn.target.incoming.remove(conn)
|
|
243
243
|
|
|
244
244
|
|
|
245
|
-
def add_random_neuron(net: Nnet) -> None:
|
|
245
|
+
def add_random_neuron(net: Nnet, activations: list[str] | None = None) -> None:
|
|
246
246
|
"""
|
|
247
247
|
Insert a new hidden neuron into a random layer.
|
|
248
248
|
|
|
249
249
|
If the network has only input/output, a hidden layer is inserted.
|
|
250
|
+
|
|
251
|
+
Args:
|
|
252
|
+
net (Nnet): The target network.
|
|
253
|
+
activations (list[str] | None): Optional list of allowed activation functions.
|
|
254
|
+
If None, all registered activations are used.
|
|
250
255
|
"""
|
|
251
256
|
if len(net.layers) < 2:
|
|
252
257
|
return
|
|
@@ -254,7 +259,7 @@ def add_random_neuron(net: Nnet) -> None:
|
|
|
254
259
|
if len(net.layers) == 2:
|
|
255
260
|
net.insert_layer(1)
|
|
256
261
|
|
|
257
|
-
#
|
|
262
|
+
# Choose target layer (not input, not output)
|
|
258
263
|
candidate_layers = net.layers[1:-1]
|
|
259
264
|
if not candidate_layers:
|
|
260
265
|
return
|
|
@@ -263,7 +268,7 @@ def add_random_neuron(net: Nnet) -> None:
|
|
|
263
268
|
|
|
264
269
|
net.add_neuron(
|
|
265
270
|
layer_idx=net.layers.index(layer),
|
|
266
|
-
activation=
|
|
271
|
+
activation=random_function_name(activations),
|
|
267
272
|
role=NeuronRole.HIDDEN,
|
|
268
273
|
connect_layer=True,
|
|
269
274
|
)
|
|
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
|