evonet 0.1.0.dev3__tar.gz → 0.1.0.dev4__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.dev3 → evonet-0.1.0.dev4}/PKG-INFO +1 -1
- {evonet-0.1.0.dev3 → evonet-0.1.0.dev4}/evonet/mutation.py +4 -3
- {evonet-0.1.0.dev3 → evonet-0.1.0.dev4}/evonet.egg-info/PKG-INFO +1 -1
- {evonet-0.1.0.dev3 → evonet-0.1.0.dev4}/pyproject.toml +1 -1
- {evonet-0.1.0.dev3 → evonet-0.1.0.dev4}/LICENSE +0 -0
- {evonet-0.1.0.dev3 → evonet-0.1.0.dev4}/README.md +0 -0
- {evonet-0.1.0.dev3 → evonet-0.1.0.dev4}/evonet/__init__.py +0 -0
- {evonet-0.1.0.dev3 → evonet-0.1.0.dev4}/evonet/activation.py +0 -0
- {evonet-0.1.0.dev3 → evonet-0.1.0.dev4}/evonet/connection.py +0 -0
- {evonet-0.1.0.dev3 → evonet-0.1.0.dev4}/evonet/core.py +0 -0
- {evonet-0.1.0.dev3 → evonet-0.1.0.dev4}/evonet/enums.py +0 -0
- {evonet-0.1.0.dev3 → evonet-0.1.0.dev4}/evonet/io.py +0 -0
- {evonet-0.1.0.dev3 → evonet-0.1.0.dev4}/evonet/layer.py +0 -0
- {evonet-0.1.0.dev3 → evonet-0.1.0.dev4}/evonet/neuron.py +0 -0
- {evonet-0.1.0.dev3 → evonet-0.1.0.dev4}/evonet/utils.py +0 -0
- {evonet-0.1.0.dev3 → evonet-0.1.0.dev4}/evonet/visualize.py +0 -0
- {evonet-0.1.0.dev3 → evonet-0.1.0.dev4}/evonet.egg-info/SOURCES.txt +0 -0
- {evonet-0.1.0.dev3 → evonet-0.1.0.dev4}/evonet.egg-info/dependency_links.txt +0 -0
- {evonet-0.1.0.dev3 → evonet-0.1.0.dev4}/evonet.egg-info/requires.txt +0 -0
- {evonet-0.1.0.dev3 → evonet-0.1.0.dev4}/evonet.egg-info/top_level.txt +0 -0
- {evonet-0.1.0.dev3 → evonet-0.1.0.dev4}/setup.cfg +0 -0
- {evonet-0.1.0.dev3 → evonet-0.1.0.dev4}/tests/test_activation.py +0 -0
- {evonet-0.1.0.dev3 → evonet-0.1.0.dev4}/tests/test_core.py +0 -0
- {evonet-0.1.0.dev3 → evonet-0.1.0.dev4}/tests/test_nnet_io_and_forward.py +0 -0
- {evonet-0.1.0.dev3 → evonet-0.1.0.dev4}/tests/test_recurrent_dynamics.py +0 -0
|
@@ -91,7 +91,7 @@ def mutate_biases(net: Nnet, probability: float = 1.0, std: float = 0.1) -> None
|
|
|
91
91
|
def add_random_connection(
|
|
92
92
|
net: Nnet,
|
|
93
93
|
allowed_recurrent: Optional[Collection[RecurrentKind | str]] = None,
|
|
94
|
-
) ->
|
|
94
|
+
) -> bool:
|
|
95
95
|
"""
|
|
96
96
|
Add a valid connection between two randomly chosen neurons.
|
|
97
97
|
|
|
@@ -114,7 +114,7 @@ def add_random_connection(
|
|
|
114
114
|
|
|
115
115
|
all_neurons = net.get_all_neurons()
|
|
116
116
|
if len(all_neurons) < 2:
|
|
117
|
-
return
|
|
117
|
+
return False
|
|
118
118
|
|
|
119
119
|
# Build a dict of existing connections
|
|
120
120
|
existing: set[tuple[Neuron, Neuron]] = {
|
|
@@ -152,7 +152,7 @@ def add_random_connection(
|
|
|
152
152
|
candidates.append((src, dst)) # recurrent allowed by policy
|
|
153
153
|
|
|
154
154
|
if not candidates:
|
|
155
|
-
return
|
|
155
|
+
return False
|
|
156
156
|
|
|
157
157
|
src, dst = random.choice(candidates)
|
|
158
158
|
src_layer_idx, dst_layer_idx = layer_of[src], layer_of[dst]
|
|
@@ -163,6 +163,7 @@ def add_random_connection(
|
|
|
163
163
|
)
|
|
164
164
|
|
|
165
165
|
net.add_connection(src, dst, conn_type=conn_type)
|
|
166
|
+
return True
|
|
166
167
|
|
|
167
168
|
|
|
168
169
|
def remove_random_connection(net: Nnet) -> None:
|
|
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
|