evonet 0.1.0.dev13__tar.gz → 0.1.0.dev14__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.
Files changed (27) hide show
  1. {evonet-0.1.0.dev13 → evonet-0.1.0.dev14}/PKG-INFO +1 -1
  2. {evonet-0.1.0.dev13 → evonet-0.1.0.dev14}/evonet/core.py +5 -4
  3. {evonet-0.1.0.dev13 → evonet-0.1.0.dev14}/evonet/enums.py +18 -0
  4. {evonet-0.1.0.dev13 → evonet-0.1.0.dev14}/evonet/mutation.py +6 -2
  5. {evonet-0.1.0.dev13 → evonet-0.1.0.dev14}/evonet.egg-info/PKG-INFO +1 -1
  6. {evonet-0.1.0.dev13 → evonet-0.1.0.dev14}/pyproject.toml +1 -1
  7. {evonet-0.1.0.dev13 → evonet-0.1.0.dev14}/LICENSE +0 -0
  8. {evonet-0.1.0.dev13 → evonet-0.1.0.dev14}/README.md +0 -0
  9. {evonet-0.1.0.dev13 → evonet-0.1.0.dev14}/evonet/__init__.py +0 -0
  10. {evonet-0.1.0.dev13 → evonet-0.1.0.dev14}/evonet/activation.py +0 -0
  11. {evonet-0.1.0.dev13 → evonet-0.1.0.dev14}/evonet/connection.py +0 -0
  12. {evonet-0.1.0.dev13 → evonet-0.1.0.dev14}/evonet/core_mit_plot_simple.py +0 -0
  13. {evonet-0.1.0.dev13 → evonet-0.1.0.dev14}/evonet/io.py +0 -0
  14. {evonet-0.1.0.dev13 → evonet-0.1.0.dev14}/evonet/layer.py +0 -0
  15. {evonet-0.1.0.dev13 → evonet-0.1.0.dev14}/evonet/neuron.py +0 -0
  16. {evonet-0.1.0.dev13 → evonet-0.1.0.dev14}/evonet/serialization.py +0 -0
  17. {evonet-0.1.0.dev13 → evonet-0.1.0.dev14}/evonet/utils.py +0 -0
  18. {evonet-0.1.0.dev13 → evonet-0.1.0.dev14}/evonet/visualize.py +0 -0
  19. {evonet-0.1.0.dev13 → evonet-0.1.0.dev14}/evonet.egg-info/SOURCES.txt +0 -0
  20. {evonet-0.1.0.dev13 → evonet-0.1.0.dev14}/evonet.egg-info/dependency_links.txt +0 -0
  21. {evonet-0.1.0.dev13 → evonet-0.1.0.dev14}/evonet.egg-info/requires.txt +0 -0
  22. {evonet-0.1.0.dev13 → evonet-0.1.0.dev14}/evonet.egg-info/top_level.txt +0 -0
  23. {evonet-0.1.0.dev13 → evonet-0.1.0.dev14}/setup.cfg +0 -0
  24. {evonet-0.1.0.dev13 → evonet-0.1.0.dev14}/tests/test_activation.py +0 -0
  25. {evonet-0.1.0.dev13 → evonet-0.1.0.dev14}/tests/test_core.py +0 -0
  26. {evonet-0.1.0.dev13 → evonet-0.1.0.dev14}/tests/test_nnet_io_and_forward.py +0 -0
  27. {evonet-0.1.0.dev13 → evonet-0.1.0.dev14}/tests/test_recurrent_dynamics.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: evonet
3
- Version: 0.1.0.dev13
3
+ Version: 0.1.0.dev14
4
4
  Summary: Evolvable neural network core for integration with EvoLib
5
5
  Author-email: EvoLib <evolib@dismail.de>
6
6
  License: MIT License
@@ -102,7 +102,7 @@ class Nnet:
102
102
  label: str = "",
103
103
  role: NeuronRole = NeuronRole.HIDDEN,
104
104
  count: int = 1,
105
- connection_init: Literal["random", "zero", "none"] = "random",
105
+ connection_init: Literal["random", "zero", "near_zero", "none"] = "zero",
106
106
  recurrent: Optional[set[RecurrentKind]] = None,
107
107
  ) -> list[Neuron]:
108
108
  """
@@ -116,9 +116,10 @@ class Nnet:
116
116
  role: Role of the neuron (INPUT, HIDDEN, OUTPUT).
117
117
  count: Number of neurons to add (default: 1).
118
118
  connection_init:
119
- "random" – connect with random weights (feedforward + recurrent)
120
- "zero" – connect with weight 0.0 (feedforward + recurrent)
121
- "none" – do not create connections (feedforward + recurrent)
119
+ "random" - connect with random weights (feedforward + recurrent)
120
+ "zero" - connect with weight 0.0 (feedforward + recurrent)
121
+ "near_zero" – connect with small random weights (-0.05, 0.05)
122
+ "none" - do not create connections (feedforward + recurrent)
122
123
  recurrent: Optional recurrent connection types.
123
124
 
124
125
  Returns:
@@ -48,3 +48,21 @@ class RecurrentKind(str, Enum):
48
48
  DIRECT = "direct" # src == dst
49
49
  LATERAL = "lateral" # same layer, src != dst
50
50
  INDIRECT = "indirect" # src_layer > dst_layer (back edge)
51
+
52
+
53
+ # Neutral activation functions
54
+ # These functions satisfy f(0) ≈ 0 and are safe for zero-weight initialization.
55
+ NEUTRAL_ACTIVATIONS: list[str] = [
56
+ "tanh",
57
+ "relu",
58
+ "relu_max1",
59
+ "leaky_relu",
60
+ "elu",
61
+ "selu",
62
+ "linear",
63
+ "linear_max1",
64
+ "invert",
65
+ "swish",
66
+ "mish",
67
+ "softsign",
68
+ ]
@@ -265,7 +265,11 @@ def remove_random_connection(net: Nnet) -> None:
265
265
  conn.target.incoming.remove(conn)
266
266
 
267
267
 
268
- def add_random_neuron(net: Nnet, activations: list[str] | None = None) -> None:
268
+ def add_random_neuron(
269
+ net: Nnet,
270
+ activations: list[str] | None = None,
271
+ connection_init: Literal["zero", "random", "near_zero", "none"] = "zero",
272
+ ) -> None:
269
273
  """
270
274
  Insert a new hidden neuron into a random layer.
271
275
 
@@ -293,7 +297,7 @@ def add_random_neuron(net: Nnet, activations: list[str] | None = None) -> None:
293
297
  layer_idx=net.layers.index(layer),
294
298
  activation=random_function_name(activations),
295
299
  role=NeuronRole.HIDDEN,
296
- connection_init="random",
300
+ connection_init=connection_init,
297
301
  )
298
302
 
299
303
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: evonet
3
- Version: 0.1.0.dev13
3
+ Version: 0.1.0.dev14
4
4
  Summary: Evolvable neural network core for integration with EvoLib
5
5
  Author-email: EvoLib <evolib@dismail.de>
6
6
  License: MIT License
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "evonet"
7
- version = "0.1.0.dev13"
7
+ version = "0.1.0.dev14"
8
8
  description = "Evolvable neural network core for integration with EvoLib"
9
9
  authors = [
10
10
  { name = "EvoLib", email = "evolib@dismail.de" }
File without changes
File without changes
File without changes
File without changes