evonet 0.1.0.dev8__tar.gz → 0.1.0.dev9__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.dev8 → evonet-0.1.0.dev9}/PKG-INFO +1 -1
- {evonet-0.1.0.dev8 → evonet-0.1.0.dev9}/evonet/activation.py +1 -0
- {evonet-0.1.0.dev8 → evonet-0.1.0.dev9}/evonet/core.py +22 -3
- {evonet-0.1.0.dev8 → evonet-0.1.0.dev9}/evonet.egg-info/PKG-INFO +1 -1
- {evonet-0.1.0.dev8 → evonet-0.1.0.dev9}/pyproject.toml +1 -1
- {evonet-0.1.0.dev8 → evonet-0.1.0.dev9}/LICENSE +0 -0
- {evonet-0.1.0.dev8 → evonet-0.1.0.dev9}/README.md +0 -0
- {evonet-0.1.0.dev8 → evonet-0.1.0.dev9}/evonet/__init__.py +0 -0
- {evonet-0.1.0.dev8 → evonet-0.1.0.dev9}/evonet/connection.py +0 -0
- {evonet-0.1.0.dev8 → evonet-0.1.0.dev9}/evonet/enums.py +0 -0
- {evonet-0.1.0.dev8 → evonet-0.1.0.dev9}/evonet/io.py +0 -0
- {evonet-0.1.0.dev8 → evonet-0.1.0.dev9}/evonet/layer.py +0 -0
- {evonet-0.1.0.dev8 → evonet-0.1.0.dev9}/evonet/mutation.py +0 -0
- {evonet-0.1.0.dev8 → evonet-0.1.0.dev9}/evonet/neuron.py +0 -0
- {evonet-0.1.0.dev8 → evonet-0.1.0.dev9}/evonet/utils.py +0 -0
- {evonet-0.1.0.dev8 → evonet-0.1.0.dev9}/evonet/visualize.py +0 -0
- {evonet-0.1.0.dev8 → evonet-0.1.0.dev9}/evonet.egg-info/SOURCES.txt +0 -0
- {evonet-0.1.0.dev8 → evonet-0.1.0.dev9}/evonet.egg-info/dependency_links.txt +0 -0
- {evonet-0.1.0.dev8 → evonet-0.1.0.dev9}/evonet.egg-info/requires.txt +0 -0
- {evonet-0.1.0.dev8 → evonet-0.1.0.dev9}/evonet.egg-info/top_level.txt +0 -0
- {evonet-0.1.0.dev8 → evonet-0.1.0.dev9}/setup.cfg +0 -0
- {evonet-0.1.0.dev8 → evonet-0.1.0.dev9}/tests/test_activation.py +0 -0
- {evonet-0.1.0.dev8 → evonet-0.1.0.dev9}/tests/test_core.py +0 -0
- {evonet-0.1.0.dev8 → evonet-0.1.0.dev9}/tests/test_nnet_io_and_forward.py +0 -0
- {evonet-0.1.0.dev8 → evonet-0.1.0.dev9}/tests/test_recurrent_dynamics.py +0 -0
|
@@ -14,6 +14,7 @@ from typing import Literal, Optional
|
|
|
14
14
|
import graphviz
|
|
15
15
|
import numpy as np
|
|
16
16
|
|
|
17
|
+
from evonet.activation import softmax as softmax_vec
|
|
17
18
|
from evonet.connection import Connection
|
|
18
19
|
from evonet.enums import ConnectionType, NeuronRole, RecurrentKind
|
|
19
20
|
from evonet.layer import Layer
|
|
@@ -274,10 +275,28 @@ class Nnet:
|
|
|
274
275
|
|
|
275
276
|
# Feed-forward by layers: activate first, then propagate non-recurrent edges
|
|
276
277
|
for layer in self.layers:
|
|
278
|
+
|
|
279
|
+
# Apply softmax to all neurons with activation_name == "softmax"
|
|
280
|
+
softmax_neurons = [
|
|
281
|
+
n for n in layer.neurons if n.activation_name == "softmax"
|
|
282
|
+
]
|
|
283
|
+
if softmax_neurons:
|
|
284
|
+
if len(softmax_neurons) >= 2:
|
|
285
|
+
# Normal softmax behaviour
|
|
286
|
+
totals = [n.input + n.bias for n in softmax_neurons]
|
|
287
|
+
probabilities = softmax_vec(totals)
|
|
288
|
+
for n, p in zip(softmax_neurons, probabilities):
|
|
289
|
+
n.output = float(p)
|
|
290
|
+
else:
|
|
291
|
+
# Fallback: single softmax neuron acts like identity
|
|
292
|
+
n = softmax_neurons[0]
|
|
293
|
+
n.output = n.input + n.bias
|
|
294
|
+
|
|
277
295
|
# Activate all neurons in this layer
|
|
278
296
|
for n in layer.neurons:
|
|
279
|
-
|
|
280
|
-
|
|
297
|
+
if n.activation_name != "softmax":
|
|
298
|
+
total = n.input + n.bias
|
|
299
|
+
n.output = n.activation(total)
|
|
281
300
|
|
|
282
301
|
# Propagate to targets (exclude recurrent edges)
|
|
283
302
|
for n in layer.neurons:
|
|
@@ -344,7 +363,7 @@ class Nnet:
|
|
|
344
363
|
ratio="fill",
|
|
345
364
|
splines="spline",
|
|
346
365
|
size="6.68,5!",
|
|
347
|
-
dpi="
|
|
366
|
+
dpi="600",
|
|
348
367
|
)
|
|
349
368
|
dot.node_attr.update(
|
|
350
369
|
shape="circle", style="filled", fixedsize="shape", width="1.8"
|
|
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
|