evonet 0.1.0.dev20__tar.gz → 0.1.0.dev22__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.dev20 → evonet-0.1.0.dev22}/PKG-INFO +1 -1
  2. {evonet-0.1.0.dev20 → evonet-0.1.0.dev22}/evonet/core.py +13 -0
  3. {evonet-0.1.0.dev20 → evonet-0.1.0.dev22}/evonet/mutation.py +0 -53
  4. {evonet-0.1.0.dev20 → evonet-0.1.0.dev22}/evonet.egg-info/PKG-INFO +1 -1
  5. {evonet-0.1.0.dev20 → evonet-0.1.0.dev22}/pyproject.toml +1 -1
  6. {evonet-0.1.0.dev20 → evonet-0.1.0.dev22}/LICENSE +0 -0
  7. {evonet-0.1.0.dev20 → evonet-0.1.0.dev22}/README.md +0 -0
  8. {evonet-0.1.0.dev20 → evonet-0.1.0.dev22}/evonet/__init__.py +0 -0
  9. {evonet-0.1.0.dev20 → evonet-0.1.0.dev22}/evonet/activation.py +0 -0
  10. {evonet-0.1.0.dev20 → evonet-0.1.0.dev22}/evonet/connection.py +0 -0
  11. {evonet-0.1.0.dev20 → evonet-0.1.0.dev22}/evonet/core_mit_plot_simple.py +0 -0
  12. {evonet-0.1.0.dev20 → evonet-0.1.0.dev22}/evonet/enums.py +0 -0
  13. {evonet-0.1.0.dev20 → evonet-0.1.0.dev22}/evonet/io.py +0 -0
  14. {evonet-0.1.0.dev20 → evonet-0.1.0.dev22}/evonet/layer.py +0 -0
  15. {evonet-0.1.0.dev20 → evonet-0.1.0.dev22}/evonet/neuron.py +0 -0
  16. {evonet-0.1.0.dev20 → evonet-0.1.0.dev22}/evonet/serialization.py +0 -0
  17. {evonet-0.1.0.dev20 → evonet-0.1.0.dev22}/evonet/utils.py +0 -0
  18. {evonet-0.1.0.dev20 → evonet-0.1.0.dev22}/evonet/visualize.py +0 -0
  19. {evonet-0.1.0.dev20 → evonet-0.1.0.dev22}/evonet.egg-info/SOURCES.txt +0 -0
  20. {evonet-0.1.0.dev20 → evonet-0.1.0.dev22}/evonet.egg-info/dependency_links.txt +0 -0
  21. {evonet-0.1.0.dev20 → evonet-0.1.0.dev22}/evonet.egg-info/requires.txt +0 -0
  22. {evonet-0.1.0.dev20 → evonet-0.1.0.dev22}/evonet.egg-info/top_level.txt +0 -0
  23. {evonet-0.1.0.dev20 → evonet-0.1.0.dev22}/setup.cfg +0 -0
  24. {evonet-0.1.0.dev20 → evonet-0.1.0.dev22}/tests/test_activation.py +0 -0
  25. {evonet-0.1.0.dev20 → evonet-0.1.0.dev22}/tests/test_core.py +0 -0
  26. {evonet-0.1.0.dev20 → evonet-0.1.0.dev22}/tests/test_nnet_io_and_forward.py +0 -0
  27. {evonet-0.1.0.dev20 → evonet-0.1.0.dev22}/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.dev20
3
+ Version: 0.1.0.dev22
4
4
  Summary: Evolvable neural network core for integration with EvoLib
5
5
  Author-email: EvoLib <evolib@dismail.de>
6
6
  License: MIT License
@@ -54,6 +54,19 @@ class Nnet:
54
54
  count += 1
55
55
  return count
56
56
 
57
+ @property
58
+ def num_hidden(self) -> int:
59
+ """Return the number of hidden neurons."""
60
+ count = 0
61
+ for layer in self.layers:
62
+ for neuron in layer.neurons:
63
+ if (
64
+ neuron.role is not NeuronRole.INPUT
65
+ and neuron.role is not NeuronRole.OUTPUT
66
+ ):
67
+ count += 1
68
+ return count
69
+
57
70
  @property
58
71
  def num_params(self) -> int:
59
72
  """Total parameter count = weights + biases."""
@@ -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
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: evonet
3
- Version: 0.1.0.dev20
3
+ Version: 0.1.0.dev22
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.dev20"
7
+ version = "0.1.0.dev22"
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