evonet 0.1.0.dev27__tar.gz → 0.1.0.dev28__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.dev27 → evonet-0.1.0.dev28}/PKG-INFO +1 -1
- {evonet-0.1.0.dev27 → evonet-0.1.0.dev28}/evonet/connection.py +3 -1
- {evonet-0.1.0.dev27 → evonet-0.1.0.dev28}/evonet/core.py +14 -2
- {evonet-0.1.0.dev27 → evonet-0.1.0.dev28}/evonet.egg-info/PKG-INFO +1 -1
- {evonet-0.1.0.dev27 → evonet-0.1.0.dev28}/pyproject.toml +1 -1
- {evonet-0.1.0.dev27 → evonet-0.1.0.dev28}/LICENSE +0 -0
- {evonet-0.1.0.dev27 → evonet-0.1.0.dev28}/README.md +0 -0
- {evonet-0.1.0.dev27 → evonet-0.1.0.dev28}/evonet/__init__.py +0 -0
- {evonet-0.1.0.dev27 → evonet-0.1.0.dev28}/evonet/activation.py +0 -0
- {evonet-0.1.0.dev27 → evonet-0.1.0.dev28}/evonet/core_mit_plot_simple.py +0 -0
- {evonet-0.1.0.dev27 → evonet-0.1.0.dev28}/evonet/enums.py +0 -0
- {evonet-0.1.0.dev27 → evonet-0.1.0.dev28}/evonet/io.py +0 -0
- {evonet-0.1.0.dev27 → evonet-0.1.0.dev28}/evonet/layer.py +0 -0
- {evonet-0.1.0.dev27 → evonet-0.1.0.dev28}/evonet/mutation.py +0 -0
- {evonet-0.1.0.dev27 → evonet-0.1.0.dev28}/evonet/neuron.py +0 -0
- {evonet-0.1.0.dev27 → evonet-0.1.0.dev28}/evonet/serialization.py +0 -0
- {evonet-0.1.0.dev27 → evonet-0.1.0.dev28}/evonet/utils.py +0 -0
- {evonet-0.1.0.dev27 → evonet-0.1.0.dev28}/evonet/visualize.py +0 -0
- {evonet-0.1.0.dev27 → evonet-0.1.0.dev28}/evonet.egg-info/SOURCES.txt +0 -0
- {evonet-0.1.0.dev27 → evonet-0.1.0.dev28}/evonet.egg-info/dependency_links.txt +0 -0
- {evonet-0.1.0.dev27 → evonet-0.1.0.dev28}/evonet.egg-info/requires.txt +0 -0
- {evonet-0.1.0.dev27 → evonet-0.1.0.dev28}/evonet.egg-info/top_level.txt +0 -0
- {evonet-0.1.0.dev27 → evonet-0.1.0.dev28}/setup.cfg +0 -0
- {evonet-0.1.0.dev27 → evonet-0.1.0.dev28}/tests/test_activation.py +0 -0
- {evonet-0.1.0.dev27 → evonet-0.1.0.dev28}/tests/test_core.py +0 -0
- {evonet-0.1.0.dev27 → evonet-0.1.0.dev28}/tests/test_nnet_io_and_forward.py +0 -0
- {evonet-0.1.0.dev27 → evonet-0.1.0.dev28}/tests/test_recurrent_dynamics.py +0 -0
|
@@ -7,7 +7,6 @@ Supports optional connection types for specialized behaviors (e.g. inhibitory,
|
|
|
7
7
|
recurrent).
|
|
8
8
|
"""
|
|
9
9
|
|
|
10
|
-
|
|
11
10
|
from collections import deque
|
|
12
11
|
from typing import TYPE_CHECKING, Deque, Optional
|
|
13
12
|
|
|
@@ -41,6 +40,9 @@ class Connection:
|
|
|
41
40
|
if delay < 0:
|
|
42
41
|
raise ValueError("delay must be >= 0")
|
|
43
42
|
|
|
43
|
+
if conn_type is not ConnectionType.RECURRENT:
|
|
44
|
+
delay = 0
|
|
45
|
+
|
|
44
46
|
# Normalize: recurrent implies delay >= 1
|
|
45
47
|
if conn_type is ConnectionType.RECURRENT and delay == 0:
|
|
46
48
|
delay = 1
|
|
@@ -354,7 +354,7 @@ class Nnet:
|
|
|
354
354
|
# Normalize recurrent delays
|
|
355
355
|
if conn_type is ConnectionType.RECURRENT and delay <= 0:
|
|
356
356
|
delay = 1
|
|
357
|
-
if conn_type is not ConnectionType.RECURRENT
|
|
357
|
+
if conn_type is not ConnectionType.RECURRENT:
|
|
358
358
|
delay = 0
|
|
359
359
|
|
|
360
360
|
conn = Connection(
|
|
@@ -403,7 +403,7 @@ class Nnet:
|
|
|
403
403
|
for i, n in enumerate(input_layer.neurons):
|
|
404
404
|
n.input = float(input_values[i])
|
|
405
405
|
|
|
406
|
-
# Preload recurrent contributions from
|
|
406
|
+
# Preload recurrent contributions from delay buffers.
|
|
407
407
|
for layer in self.layers:
|
|
408
408
|
for n in layer.neurons:
|
|
409
409
|
for c in n.incoming:
|
|
@@ -479,6 +479,7 @@ class Nnet:
|
|
|
479
479
|
colors_on: bool = True,
|
|
480
480
|
thickness_on: bool = False,
|
|
481
481
|
fillcolors_on: bool = False,
|
|
482
|
+
delay_on: bool = True,
|
|
482
483
|
) -> None:
|
|
483
484
|
"""
|
|
484
485
|
Render a visual representation of the network using Graphviz.
|
|
@@ -490,6 +491,7 @@ class Nnet:
|
|
|
490
491
|
colors_on (bool): Whether to color edges by sign.
|
|
491
492
|
thickness_on (bool): Whether to scale edge thickness by weight.
|
|
492
493
|
fillcolors_on (bool): Whether to color neurons by role.
|
|
494
|
+
delay_on (bool): Whether to show delay values on recurrent connections.
|
|
493
495
|
"""
|
|
494
496
|
|
|
495
497
|
if not self.layers:
|
|
@@ -542,14 +544,24 @@ class Nnet:
|
|
|
542
544
|
# Add edges
|
|
543
545
|
for conn in self.get_all_connections():
|
|
544
546
|
label = f"{conn.weight:.2f}" if labels_on else ""
|
|
547
|
+
|
|
548
|
+
# Optional delay annotation (only meaningful for recurrent connections)
|
|
549
|
+
if delay_on and labels_on and conn.type.name == "RECURRENT":
|
|
550
|
+
if label:
|
|
551
|
+
label = f"{label}\\nd={conn.delay}"
|
|
552
|
+
else:
|
|
553
|
+
label = f"d={conn.delay}"
|
|
554
|
+
|
|
545
555
|
color = (
|
|
546
556
|
"green"
|
|
547
557
|
if colors_on and conn.weight >= 0
|
|
548
558
|
else "red" if colors_on else "black"
|
|
549
559
|
)
|
|
560
|
+
|
|
550
561
|
penwidth = (
|
|
551
562
|
str(max(1, min(5, abs(conn.weight * 5)))) if thickness_on else "1"
|
|
552
563
|
)
|
|
564
|
+
|
|
553
565
|
style = "dashed" if conn.type.name == "RECURRENT" else "solid"
|
|
554
566
|
|
|
555
567
|
dot.edge(
|
|
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
|