evonet 0.1.0.dev20__tar.gz → 0.1.0.dev21__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.dev20 → evonet-0.1.0.dev21}/PKG-INFO +1 -1
- {evonet-0.1.0.dev20 → evonet-0.1.0.dev21}/evonet/mutation.py +0 -53
- {evonet-0.1.0.dev20 → evonet-0.1.0.dev21}/evonet.egg-info/PKG-INFO +1 -1
- {evonet-0.1.0.dev20 → evonet-0.1.0.dev21}/pyproject.toml +1 -1
- {evonet-0.1.0.dev20 → evonet-0.1.0.dev21}/LICENSE +0 -0
- {evonet-0.1.0.dev20 → evonet-0.1.0.dev21}/README.md +0 -0
- {evonet-0.1.0.dev20 → evonet-0.1.0.dev21}/evonet/__init__.py +0 -0
- {evonet-0.1.0.dev20 → evonet-0.1.0.dev21}/evonet/activation.py +0 -0
- {evonet-0.1.0.dev20 → evonet-0.1.0.dev21}/evonet/connection.py +0 -0
- {evonet-0.1.0.dev20 → evonet-0.1.0.dev21}/evonet/core.py +0 -0
- {evonet-0.1.0.dev20 → evonet-0.1.0.dev21}/evonet/core_mit_plot_simple.py +0 -0
- {evonet-0.1.0.dev20 → evonet-0.1.0.dev21}/evonet/enums.py +0 -0
- {evonet-0.1.0.dev20 → evonet-0.1.0.dev21}/evonet/io.py +0 -0
- {evonet-0.1.0.dev20 → evonet-0.1.0.dev21}/evonet/layer.py +0 -0
- {evonet-0.1.0.dev20 → evonet-0.1.0.dev21}/evonet/neuron.py +0 -0
- {evonet-0.1.0.dev20 → evonet-0.1.0.dev21}/evonet/serialization.py +0 -0
- {evonet-0.1.0.dev20 → evonet-0.1.0.dev21}/evonet/utils.py +0 -0
- {evonet-0.1.0.dev20 → evonet-0.1.0.dev21}/evonet/visualize.py +0 -0
- {evonet-0.1.0.dev20 → evonet-0.1.0.dev21}/evonet.egg-info/SOURCES.txt +0 -0
- {evonet-0.1.0.dev20 → evonet-0.1.0.dev21}/evonet.egg-info/dependency_links.txt +0 -0
- {evonet-0.1.0.dev20 → evonet-0.1.0.dev21}/evonet.egg-info/requires.txt +0 -0
- {evonet-0.1.0.dev20 → evonet-0.1.0.dev21}/evonet.egg-info/top_level.txt +0 -0
- {evonet-0.1.0.dev20 → evonet-0.1.0.dev21}/setup.cfg +0 -0
- {evonet-0.1.0.dev20 → evonet-0.1.0.dev21}/tests/test_activation.py +0 -0
- {evonet-0.1.0.dev20 → evonet-0.1.0.dev21}/tests/test_core.py +0 -0
- {evonet-0.1.0.dev20 → evonet-0.1.0.dev21}/tests/test_nnet_io_and_forward.py +0 -0
- {evonet-0.1.0.dev20 → evonet-0.1.0.dev21}/tests/test_recurrent_dynamics.py +0 -0
|
@@ -337,56 +337,3 @@ def remove_random_neuron(net: Nnet) -> bool:
|
|
|
337
337
|
break
|
|
338
338
|
|
|
339
339
|
return True
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
def split_connection(
|
|
343
|
-
net: Nnet, activation: str = "tanh", noise: float = 0.1
|
|
344
|
-
) -> Neuron | None:
|
|
345
|
-
"""
|
|
346
|
-
Insert a neuron in the middle of an existing connection.
|
|
347
|
-
|
|
348
|
-
The old connection is removed, and two new ones are created:
|
|
349
|
-
- from source → new neuron
|
|
350
|
-
- from new neuron → target
|
|
351
|
-
|
|
352
|
-
Args:
|
|
353
|
-
net (Nnet): The target network.
|
|
354
|
-
activation (str): Activation function for the new neuron.
|
|
355
|
-
noise (float): Optional noise applied to new weights.
|
|
356
|
-
|
|
357
|
-
Returns:
|
|
358
|
-
Neuron: Added neuron, or None
|
|
359
|
-
"""
|
|
360
|
-
|
|
361
|
-
all_connections = net.get_all_connections()
|
|
362
|
-
if not all_connections:
|
|
363
|
-
return None
|
|
364
|
-
|
|
365
|
-
conn = random.choice(all_connections)
|
|
366
|
-
src, dst = conn.source, conn.target
|
|
367
|
-
|
|
368
|
-
insert_idx = None
|
|
369
|
-
for idx, layer in enumerate(net.layers):
|
|
370
|
-
if src in layer.neurons:
|
|
371
|
-
insert_idx = idx + 1
|
|
372
|
-
break
|
|
373
|
-
|
|
374
|
-
if insert_idx is None or insert_idx >= len(net.layers):
|
|
375
|
-
return None
|
|
376
|
-
|
|
377
|
-
new_neuron = net.add_neuron(
|
|
378
|
-
layer_idx=insert_idx,
|
|
379
|
-
role=NeuronRole.HIDDEN,
|
|
380
|
-
activation=activation,
|
|
381
|
-
connection_init="none",
|
|
382
|
-
)[0]
|
|
383
|
-
|
|
384
|
-
# Set new connections
|
|
385
|
-
src.outgoing.remove(conn)
|
|
386
|
-
dst.incoming.remove(conn)
|
|
387
|
-
|
|
388
|
-
weight = 1.0 + np.random.normal(0, noise)
|
|
389
|
-
net.add_connection(src, new_neuron, weight=weight)
|
|
390
|
-
net.add_connection(new_neuron, dst, weight=conn.weight)
|
|
391
|
-
|
|
392
|
-
return new_neuron
|
|
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
|