@reicek/neataptic-ts 0.1.0

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 (272) hide show
  1. package/.github/ISSUE_TEMPLATE/bug_report.md +33 -0
  2. package/.github/ISSUE_TEMPLATE/feature_request.md +27 -0
  3. package/.github/PULL_REQUEST_TEMPLATE.md +28 -0
  4. package/.github/workflows/ci.yml +41 -0
  5. package/.github/workflows/deploy-pages.yml +29 -0
  6. package/.github/workflows/manual_release_pipeline.yml +62 -0
  7. package/.github/workflows/publish.yml +85 -0
  8. package/.github/workflows/release_dispatch.yml +38 -0
  9. package/.travis.yml +5 -0
  10. package/CONTRIBUTING.md +92 -0
  11. package/LICENSE +24 -0
  12. package/ONNX_EXPORT.md +87 -0
  13. package/README.md +1173 -0
  14. package/RELEASE.md +54 -0
  15. package/dist-docs/package.json +1 -0
  16. package/dist-docs/scripts/generate-docs.d.ts +2 -0
  17. package/dist-docs/scripts/generate-docs.d.ts.map +1 -0
  18. package/dist-docs/scripts/generate-docs.js +536 -0
  19. package/dist-docs/scripts/generate-docs.js.map +1 -0
  20. package/dist-docs/scripts/render-docs-html.d.ts +2 -0
  21. package/dist-docs/scripts/render-docs-html.d.ts.map +1 -0
  22. package/dist-docs/scripts/render-docs-html.js +148 -0
  23. package/dist-docs/scripts/render-docs-html.js.map +1 -0
  24. package/docs/FOLDERS.md +14 -0
  25. package/docs/README.md +1173 -0
  26. package/docs/architecture/README.md +1391 -0
  27. package/docs/architecture/index.html +938 -0
  28. package/docs/architecture/network/README.md +1210 -0
  29. package/docs/architecture/network/index.html +908 -0
  30. package/docs/assets/ascii-maze.bundle.js +16542 -0
  31. package/docs/assets/ascii-maze.bundle.js.map +7 -0
  32. package/docs/index.html +1419 -0
  33. package/docs/methods/README.md +670 -0
  34. package/docs/methods/index.html +477 -0
  35. package/docs/multithreading/README.md +274 -0
  36. package/docs/multithreading/index.html +215 -0
  37. package/docs/multithreading/workers/README.md +23 -0
  38. package/docs/multithreading/workers/browser/README.md +39 -0
  39. package/docs/multithreading/workers/browser/index.html +70 -0
  40. package/docs/multithreading/workers/index.html +57 -0
  41. package/docs/multithreading/workers/node/README.md +33 -0
  42. package/docs/multithreading/workers/node/index.html +66 -0
  43. package/docs/neat/README.md +1284 -0
  44. package/docs/neat/index.html +906 -0
  45. package/docs/src/README.md +2659 -0
  46. package/docs/src/index.html +1579 -0
  47. package/jest.config.ts +32 -0
  48. package/package.json +99 -0
  49. package/plans/HyperMorphoNEAT.md +293 -0
  50. package/plans/ONNX_EXPORT_PLAN.md +46 -0
  51. package/scripts/generate-docs.ts +486 -0
  52. package/scripts/render-docs-html.ts +138 -0
  53. package/scripts/types.d.ts +2 -0
  54. package/src/README.md +2659 -0
  55. package/src/architecture/README.md +1391 -0
  56. package/src/architecture/activationArrayPool.ts +135 -0
  57. package/src/architecture/architect.ts +635 -0
  58. package/src/architecture/connection.ts +148 -0
  59. package/src/architecture/group.ts +406 -0
  60. package/src/architecture/layer.ts +804 -0
  61. package/src/architecture/network/README.md +1210 -0
  62. package/src/architecture/network/network.activate.ts +223 -0
  63. package/src/architecture/network/network.connect.ts +157 -0
  64. package/src/architecture/network/network.deterministic.ts +167 -0
  65. package/src/architecture/network/network.evolve.ts +426 -0
  66. package/src/architecture/network/network.gating.ts +186 -0
  67. package/src/architecture/network/network.genetic.ts +247 -0
  68. package/src/architecture/network/network.mutate.ts +624 -0
  69. package/src/architecture/network/network.onnx.ts +463 -0
  70. package/src/architecture/network/network.prune.ts +216 -0
  71. package/src/architecture/network/network.remove.ts +96 -0
  72. package/src/architecture/network/network.serialize.ts +309 -0
  73. package/src/architecture/network/network.slab.ts +262 -0
  74. package/src/architecture/network/network.standalone.ts +246 -0
  75. package/src/architecture/network/network.stats.ts +59 -0
  76. package/src/architecture/network/network.topology.ts +86 -0
  77. package/src/architecture/network/network.training.ts +1278 -0
  78. package/src/architecture/network.ts +1302 -0
  79. package/src/architecture/node.ts +1288 -0
  80. package/src/architecture/onnx.ts +3 -0
  81. package/src/config.ts +83 -0
  82. package/src/methods/README.md +670 -0
  83. package/src/methods/activation.ts +372 -0
  84. package/src/methods/connection.ts +31 -0
  85. package/src/methods/cost.ts +347 -0
  86. package/src/methods/crossover.ts +63 -0
  87. package/src/methods/gating.ts +43 -0
  88. package/src/methods/methods.ts +8 -0
  89. package/src/methods/mutation.ts +300 -0
  90. package/src/methods/rate.ts +257 -0
  91. package/src/methods/selection.ts +65 -0
  92. package/src/multithreading/README.md +274 -0
  93. package/src/multithreading/multi.ts +339 -0
  94. package/src/multithreading/workers/README.md +23 -0
  95. package/src/multithreading/workers/browser/README.md +39 -0
  96. package/src/multithreading/workers/browser/testworker.ts +99 -0
  97. package/src/multithreading/workers/node/README.md +33 -0
  98. package/src/multithreading/workers/node/testworker.ts +72 -0
  99. package/src/multithreading/workers/node/worker.ts +70 -0
  100. package/src/multithreading/workers/workers.ts +22 -0
  101. package/src/neat/README.md +1284 -0
  102. package/src/neat/neat.adaptive.ts +544 -0
  103. package/src/neat/neat.compat.ts +164 -0
  104. package/src/neat/neat.constants.ts +20 -0
  105. package/src/neat/neat.diversity.ts +217 -0
  106. package/src/neat/neat.evaluate.ts +328 -0
  107. package/src/neat/neat.evolve.ts +1026 -0
  108. package/src/neat/neat.export.ts +249 -0
  109. package/src/neat/neat.helpers.ts +235 -0
  110. package/src/neat/neat.lineage.ts +220 -0
  111. package/src/neat/neat.multiobjective.ts +260 -0
  112. package/src/neat/neat.mutation.ts +718 -0
  113. package/src/neat/neat.objectives.ts +157 -0
  114. package/src/neat/neat.pruning.ts +190 -0
  115. package/src/neat/neat.selection.ts +269 -0
  116. package/src/neat/neat.speciation.ts +460 -0
  117. package/src/neat/neat.species.ts +151 -0
  118. package/src/neat/neat.telemetry.exports.ts +469 -0
  119. package/src/neat/neat.telemetry.ts +933 -0
  120. package/src/neat/neat.types.ts +275 -0
  121. package/src/neat.ts +1042 -0
  122. package/src/neataptic.ts +10 -0
  123. package/test/architecture/activationArrayPool.capacity.test.ts +19 -0
  124. package/test/architecture/activationArrayPool.test.ts +46 -0
  125. package/test/architecture/connection.test.ts +290 -0
  126. package/test/architecture/group.test.ts +950 -0
  127. package/test/architecture/layer.test.ts +1535 -0
  128. package/test/architecture/network.pruning.test.ts +65 -0
  129. package/test/architecture/node.test.ts +1602 -0
  130. package/test/examples/asciiMaze/asciiMaze.e2e.test.ts +499 -0
  131. package/test/examples/asciiMaze/asciiMaze.ts +41 -0
  132. package/test/examples/asciiMaze/browser-entry.ts +164 -0
  133. package/test/examples/asciiMaze/browserLogger.ts +221 -0
  134. package/test/examples/asciiMaze/browserTerminalUtility.ts +48 -0
  135. package/test/examples/asciiMaze/colors.ts +119 -0
  136. package/test/examples/asciiMaze/dashboardManager.ts +968 -0
  137. package/test/examples/asciiMaze/evolutionEngine.ts +1248 -0
  138. package/test/examples/asciiMaze/fitness.ts +136 -0
  139. package/test/examples/asciiMaze/index.html +128 -0
  140. package/test/examples/asciiMaze/index.ts +26 -0
  141. package/test/examples/asciiMaze/interfaces.ts +235 -0
  142. package/test/examples/asciiMaze/mazeMovement.ts +996 -0
  143. package/test/examples/asciiMaze/mazeUtils.ts +278 -0
  144. package/test/examples/asciiMaze/mazeVision.ts +402 -0
  145. package/test/examples/asciiMaze/mazeVisualization.ts +585 -0
  146. package/test/examples/asciiMaze/mazes.ts +245 -0
  147. package/test/examples/asciiMaze/networkRefinement.ts +76 -0
  148. package/test/examples/asciiMaze/networkVisualization.ts +901 -0
  149. package/test/examples/asciiMaze/terminalUtility.ts +73 -0
  150. package/test/methods/activation.test.ts +1142 -0
  151. package/test/methods/connection.test.ts +146 -0
  152. package/test/methods/cost.test.ts +1123 -0
  153. package/test/methods/crossover.test.ts +202 -0
  154. package/test/methods/gating.test.ts +144 -0
  155. package/test/methods/mutation.test.ts +451 -0
  156. package/test/methods/optimizers.advanced.test.ts +80 -0
  157. package/test/methods/optimizers.behavior.test.ts +105 -0
  158. package/test/methods/optimizers.formula.test.ts +89 -0
  159. package/test/methods/rate.cosineWarmRestarts.test.ts +44 -0
  160. package/test/methods/rate.linearWarmupDecay.test.ts +41 -0
  161. package/test/methods/rate.reduceOnPlateau.test.ts +45 -0
  162. package/test/methods/rate.test.ts +684 -0
  163. package/test/methods/selection.test.ts +245 -0
  164. package/test/multithreading/activations.functions.test.ts +54 -0
  165. package/test/multithreading/multi.test.ts +290 -0
  166. package/test/multithreading/worker.node.process.test.ts +39 -0
  167. package/test/multithreading/workers.coverage.test.ts +36 -0
  168. package/test/multithreading/workers.dynamic.import.test.ts +8 -0
  169. package/test/neat/neat.adaptive.complexityBudget.test.ts +34 -0
  170. package/test/neat/neat.adaptive.criterion.complexity.test.ts +50 -0
  171. package/test/neat/neat.adaptive.mutation.strategy.test.ts +37 -0
  172. package/test/neat/neat.adaptive.operator.decay.test.ts +31 -0
  173. package/test/neat/neat.adaptive.phasedComplexity.test.ts +25 -0
  174. package/test/neat/neat.adaptive.pruning.test.ts +25 -0
  175. package/test/neat/neat.adaptive.targetSpecies.test.ts +43 -0
  176. package/test/neat/neat.additional.coverage.test.ts +126 -0
  177. package/test/neat/neat.advanced.enhancements.test.ts +85 -0
  178. package/test/neat/neat.advanced.test.ts +589 -0
  179. package/test/neat/neat.diversity.autocompat.test.ts +47 -0
  180. package/test/neat/neat.diversity.metrics.test.ts +21 -0
  181. package/test/neat/neat.diversity.stats.test.ts +44 -0
  182. package/test/neat/neat.enhancements.test.ts +79 -0
  183. package/test/neat/neat.entropy.ancestorAdaptive.test.ts +133 -0
  184. package/test/neat/neat.entropy.compat.csv.test.ts +108 -0
  185. package/test/neat/neat.evolution.pruning.test.ts +39 -0
  186. package/test/neat/neat.fastmode.autotune.test.ts +42 -0
  187. package/test/neat/neat.innovation.test.ts +134 -0
  188. package/test/neat/neat.lineage.antibreeding.test.ts +35 -0
  189. package/test/neat/neat.lineage.entropy.test.ts +56 -0
  190. package/test/neat/neat.lineage.inbreeding.test.ts +49 -0
  191. package/test/neat/neat.lineage.pressure.test.ts +29 -0
  192. package/test/neat/neat.multiobjective.adaptive.test.ts +57 -0
  193. package/test/neat/neat.multiobjective.dynamic.schedule.test.ts +46 -0
  194. package/test/neat/neat.multiobjective.dynamic.test.ts +31 -0
  195. package/test/neat/neat.multiobjective.fastsort.delegation.test.ts +51 -0
  196. package/test/neat/neat.multiobjective.prune.test.ts +39 -0
  197. package/test/neat/neat.multiobjective.test.ts +21 -0
  198. package/test/neat/neat.mutation.undefined.pool.test.ts +24 -0
  199. package/test/neat/neat.objective.events.test.ts +26 -0
  200. package/test/neat/neat.objective.importance.test.ts +21 -0
  201. package/test/neat/neat.objective.lifetimes.test.ts +33 -0
  202. package/test/neat/neat.offspring.allocation.test.ts +22 -0
  203. package/test/neat/neat.operator.bandit.test.ts +17 -0
  204. package/test/neat/neat.operator.phases.test.ts +38 -0
  205. package/test/neat/neat.pruneInactive.behavior.test.ts +54 -0
  206. package/test/neat/neat.reenable.adaptation.test.ts +18 -0
  207. package/test/neat/neat.rng.state.test.ts +22 -0
  208. package/test/neat/neat.spawn.add.test.ts +123 -0
  209. package/test/neat/neat.speciation.test.ts +96 -0
  210. package/test/neat/neat.species.allocation.telemetry.test.ts +26 -0
  211. package/test/neat/neat.species.history.csv.test.ts +24 -0
  212. package/test/neat/neat.telemetry.advanced.test.ts +226 -0
  213. package/test/neat/neat.telemetry.csv.lineage.test.ts +19 -0
  214. package/test/neat/neat.telemetry.parity.test.ts +42 -0
  215. package/test/neat/neat.telemetry.stream.test.ts +19 -0
  216. package/test/neat/neat.telemetry.test.ts +16 -0
  217. package/test/neat/neat.test.ts +422 -0
  218. package/test/neat/neat.utilities.test.ts +44 -0
  219. package/test/network/__suppress_console.ts +9 -0
  220. package/test/network/acyclic.topoorder.test.ts +17 -0
  221. package/test/network/checkpoint.metricshook.test.ts +36 -0
  222. package/test/network/error.handling.test.ts +581 -0
  223. package/test/network/evolution.test.ts +285 -0
  224. package/test/network/genetic.test.ts +208 -0
  225. package/test/network/learning.capability.test.ts +244 -0
  226. package/test/network/mutation.effects.test.ts +492 -0
  227. package/test/network/network.activate.test.ts +115 -0
  228. package/test/network/network.activateBatch.test.ts +30 -0
  229. package/test/network/network.deterministic.test.ts +64 -0
  230. package/test/network/network.evolve.branches.test.ts +75 -0
  231. package/test/network/network.evolve.multithread.branches.test.ts +83 -0
  232. package/test/network/network.evolve.test.ts +100 -0
  233. package/test/network/network.gating.removal.test.ts +93 -0
  234. package/test/network/network.mutate.additional.test.ts +145 -0
  235. package/test/network/network.mutate.edgecases.test.ts +101 -0
  236. package/test/network/network.mutate.test.ts +101 -0
  237. package/test/network/network.prune.earlyexit.test.ts +38 -0
  238. package/test/network/network.remove.errors.test.ts +45 -0
  239. package/test/network/network.slab.fallbacks.test.ts +22 -0
  240. package/test/network/network.stats.test.ts +45 -0
  241. package/test/network/network.training.advanced.test.ts +149 -0
  242. package/test/network/network.training.basic.test.ts +228 -0
  243. package/test/network/network.training.helpers.test.ts +183 -0
  244. package/test/network/onnx.export.test.ts +310 -0
  245. package/test/network/onnx.import.test.ts +129 -0
  246. package/test/network/pruning.topology.test.ts +282 -0
  247. package/test/network/regularization.determinism.test.ts +83 -0
  248. package/test/network/regularization.dropconnect.test.ts +17 -0
  249. package/test/network/regularization.dropconnect.validation.test.ts +18 -0
  250. package/test/network/regularization.stochasticdepth.test.ts +27 -0
  251. package/test/network/regularization.test.ts +843 -0
  252. package/test/network/regularization.weightnoise.test.ts +30 -0
  253. package/test/network/setupTests.ts +2 -0
  254. package/test/network/standalone.test.ts +332 -0
  255. package/test/network/structure.serialization.test.ts +660 -0
  256. package/test/training/training.determinism.mixed-precision.test.ts +134 -0
  257. package/test/training/training.earlystopping.test.ts +91 -0
  258. package/test/training/training.edge-cases.test.ts +91 -0
  259. package/test/training/training.extensions.test.ts +47 -0
  260. package/test/training/training.gradient.features.test.ts +110 -0
  261. package/test/training/training.gradient.refinements.test.ts +170 -0
  262. package/test/training/training.gradient.separate-bias.test.ts +41 -0
  263. package/test/training/training.optimizer.test.ts +48 -0
  264. package/test/training/training.plateau.smoothing.test.ts +58 -0
  265. package/test/training/training.smoothing.types.test.ts +174 -0
  266. package/test/training/training.train.options.coverage.test.ts +52 -0
  267. package/test/utils/console-helper.ts +76 -0
  268. package/test/utils/jest-setup.ts +60 -0
  269. package/test/utils/test-helpers.ts +175 -0
  270. package/tsconfig.docs.json +12 -0
  271. package/tsconfig.json +21 -0
  272. package/webpack.config.js +49 -0
@@ -0,0 +1,1579 @@
1
+ <!DOCTYPE html><html><head><meta charset="utf-8"><title>## config.ts</title>
2
+ <meta name="viewport" content="width=device-width,initial-scale=1">
3
+ <style>
4
+ body{font-family:system-ui,-apple-system,Segoe UI,Arial,sans-serif;margin:0 auto;padding:0 20px 60px;line-height:1.55;background:#fff;color:#222;display:grid;grid-template-columns:260px 1fr 280px;grid-gap:32px;}
5
+ nav.site{position:sticky;top:0;align-self:start;max-height:100vh;overflow:auto;padding:24px 0 40px;}
6
+ nav.site h1{font-size:1.05rem;margin:0 0 .75rem;font-weight:600;}
7
+ .doc-nav{list-style:none;margin:0;padding:0;font-size:.85rem;}
8
+ .doc-nav li{margin:2px 0;}
9
+ .doc-nav a{display:block;padding:4px 8px;border-radius:4px;color:#2c3963;text-decoration:none;}
10
+ .doc-nav li.current>a{background:#2c3963;color:#fff;font-weight:600;}
11
+ .doc-nav a:hover{background:#e4e8f3;}
12
+ main{padding:40px 0;}
13
+ aside.page-index{position:sticky;top:0;align-self:start;max-height:100vh;overflow:auto;padding:32px 0 40px;font-size:.85rem;}
14
+ aside.page-index h2{font-size:.9rem;margin:0 0 .75rem;text-transform:uppercase;letter-spacing:.5px;color:#444;}
15
+ aside.page-index .toc-file{margin:0 0 .5rem;}
16
+ aside.page-index ul{list-style:none;margin:.25rem 0 .5rem .25rem;padding:0;}
17
+ aside.page-index li{margin:0;}
18
+ aside.page-index a{color:#444;text-decoration:none;}
19
+ aside.page-index a:hover{color:#2c3963;}
20
+ pre{background:#1e1e1e;color:#eee;padding:12px;border-radius:6px;overflow:auto;}
21
+ code{background:#f5f5f5;padding:2px 4px;border-radius:4px;font-size:90%;}
22
+ pre code{background:transparent;padding:0;font-size:90%;}
23
+ a{color:#2c3963;text-decoration:none;}a:hover{text-decoration:underline;}
24
+ h1,h2,h3,h4{scroll-margin-top:70px;}
25
+ blockquote{border-left:4px solid #ddd;margin:1em 0;padding:.5em 1em;color:#555;}
26
+ table{border-collapse:collapse}th,td{border:1px solid #ccc;padding:4px 8px;text-align:left;}
27
+ footer{margin-top:64px;font-size:.75rem;color:#666;}
28
+ @media (max-width:1100px){body{grid-template-columns:220px 1fr;}aside.page-index{display:none;} }
29
+ @media (max-width:800px){body{grid-template-columns:1fr;}nav.site{position:relative;top:auto;max-height:none;order:2;}main{order:1;padding-top:24px;}}
30
+ </style></head><body>
31
+ <nav class="site">
32
+ <h1>Docs Index</h1>
33
+ <ul class="doc-nav"><li><a href="../index.html">root</a></li>
34
+ <li><a href="../architecture/index.html">architecture/</a></li>
35
+ <li><a href="../architecture/network/index.html">architecture/network/</a></li>
36
+ <li><a href="../methods/index.html">methods/</a></li>
37
+ <li><a href="../multithreading/index.html">multithreading/</a></li>
38
+ <li><a href="../multithreading/workers/index.html">multithreading/workers/</a></li>
39
+ <li><a href="../multithreading/workers/browser/index.html">multithreading/workers/browser/</a></li>
40
+ <li><a href="../multithreading/workers/node/index.html">multithreading/workers/node/</a></li>
41
+ <li><a href="../neat/index.html">neat/</a></li>
42
+ <li class="current"><a href="./index.html">src/</a></li>
43
+ <li><a href="../../test/examples/asciiMaze/index.html">examples/asciiMaze/</a></li></ul>
44
+ </nav>
45
+ <main>
46
+ <h1 id=""></h1><h2 id="config-ts">config.ts</h2><h3 id="config">config</h3><h3 id="neatapticconfig">NeatapticConfig</h3><p>Global NeatapticTS configuration contract &amp; default instance.</p>
47
+ <h2 id="why-this-exists">WHY THIS EXISTS</h2><p>A central <code>config</code> object offers a convenient, documented surface for end-users (and tests)
48
+ to tweak library behaviour without digging through scattered constants. Centralization also
49
+ lets us validate &amp; evolve feature flags in a single place.</p>
50
+ <h2 id="usage-pattern">USAGE PATTERN</h2><p> import { config } from &#39;neataptic-ts&#39;;
51
+ config.warnings = true; // enable runtime warnings
52
+ config.deterministicChainMode = true // opt into deterministic deep path construction</p>
53
+ <p>Adjust BEFORE constructing networks / invoking evolutionary loops so that subsystems read
54
+ the intended values while initializing internal buffers / metadata.</p>
55
+ <h2 id="design-notes">DESIGN NOTES</h2><ul>
56
+ <li>We intentionally avoid setters / proxies to keep this a plain serializable object.</li>
57
+ <li>Optional flags are conservative by default (disabled) to preserve legacy stochastic
58
+ behaviour unless a test or user explicitly opts in.</li>
59
+ </ul>
60
+ <h2 id="neat-ts">neat.ts</h2><h3 id="neat">neat</h3><h3 id="neatoptions">NeatOptions</h3><h3 id="options">Options</h3><p>Configuration options for Neat evolutionary runs.</p>
61
+ <p>Each property is optional and the class applies sensible defaults when a
62
+ field is not provided. Options control population size, mutation rates,
63
+ compatibility coefficients, selection strategy and other behavioral knobs.</p>
64
+ <p>Example:
65
+ const opts: NeatOptions = { popsize: 100, mutationRate: 0.5 };
66
+ const neat = new Neat(3, 1, fitnessFn, opts);</p>
67
+ <p>Note: this type is intentionally permissive to support staged migration and
68
+ legacy callers; prefer providing a typed options object where possible.</p>
69
+ <h3 id="default">default</h3><h4 id="adaptiveprunelevel">_adaptivePruneLevel</h4><p>Adaptive prune level for complexity control (optional).</p>
70
+ <h4 id="applyfitnesssharing">_applyFitnessSharing</h4><p><code>() =&gt; void</code></p>
71
+ <p>Apply fitness sharing within species. When <code>sharingSigma</code> &gt; 0 this uses a kernel-based
72
+ sharing; otherwise it falls back to classic per-species averaging. Sharing reduces
73
+ effective fitness for similar genomes to promote diversity.</p>
74
+ <h4 id="bestscorelastgen">_bestScoreLastGen</h4><p>Best score observed in the last generation (used for improvement detection).</p>
75
+ <h4 id="compatintegral">_compatIntegral</h4><p>Integral accumulator used by adaptive compatibility controllers.</p>
76
+ <h4 id="compatspeciesema">_compatSpeciesEMA</h4><p>Exponential moving average for compatibility threshold (adaptive speciation).</p>
77
+ <h4 id="computediversitystats">_computeDiversityStats</h4><p><code>() =&gt; void</code></p>
78
+ <p>Compute and cache diversity statistics used by telemetry &amp; tests.</p>
79
+ <h4 id="conninnovations">_connInnovations</h4><p>Map of connection innovations keyed by a string identifier.</p>
80
+ <h4 id="diversitystats">_diversityStats</h4><p>Cached diversity metrics (computed lazily).</p>
81
+ <h4 id="getobjectives">_getObjectives</h4><p><code>() =&gt; import(&quot;D:/code-practice/NeatapticTS/src/neat/neat.types&quot;).ObjectiveDescriptor[]</code></p>
82
+ <p>Internal: return cached objective descriptors, building if stale.</p>
83
+ <h4 id="invalidategenomecaches">_invalidateGenomeCaches</h4><p><code>(genome: any) =&gt; void</code></p>
84
+ <p>Invalidate per-genome caches (compatibility distance, forward pass, etc.).</p>
85
+ <h4 id="lastancestoruniqadjustgen">_lastAncestorUniqAdjustGen</h4><p>Generation when ancestor uniqueness adjustment was last applied.</p>
86
+ <h4 id="lastepsilonadjustgen">_lastEpsilonAdjustGen</h4><p>Generation when epsilon compatibility was last adjusted.</p>
87
+ <h4 id="lastevalduration">_lastEvalDuration</h4><p>Duration of the last evaluation run (ms).</p>
88
+ <h4 id="lastevolveduration">_lastEvolveDuration</h4><p>Duration of the last evolve run (ms).</p>
89
+ <h4 id="lastglobalimprovegeneration">_lastGlobalImproveGeneration</h4><p>Generation index where the last global improvement occurred.</p>
90
+ <h4 id="lastinbreedingcount">_lastInbreedingCount</h4><p>Last observed count of inbreeding (used for detecting excessive cloning).</p>
91
+ <h4 id="lastoffspringalloc">_lastOffspringAlloc</h4><p>Last allocated offspring set (used by adaptive allocators).</p>
92
+ <h4 id="lineageenabled">_lineageEnabled</h4><p>Whether lineage metadata should be recorded on genomes.</p>
93
+ <h4 id="mcthreshold">_mcThreshold</h4><p>Adaptive minimal criterion threshold (optional).</p>
94
+ <h4 id="nextgenomeid">_nextGenomeId</h4><p>Counter for assigning unique genome ids.</p>
95
+ <h4 id="nextglobalinnovation">_nextGlobalInnovation</h4><p>Counter for issuing global innovation numbers when explicit numbers are used.</p>
96
+ <h4 id="nodesplitinnovations">_nodeSplitInnovations</h4><p>Map of node-split innovations used to reuse innovation ids for node splits.</p>
97
+ <h4 id="noveltyarchive">_noveltyArchive</h4><p>Novelty archive used by novelty search (behavior representatives).</p>
98
+ <h4 id="objectiveages">_objectiveAges</h4><p>Map tracking ages for objectives by key.</p>
99
+ <h4 id="objectiveevents">_objectiveEvents</h4><p>Queue of recent objective activation/deactivation events for telemetry.</p>
100
+ <h4 id="objectiveslist">_objectivesList</h4><p>Cached list of registered objectives.</p>
101
+ <h4 id="objectivestale">_objectiveStale</h4><p>Map tracking stale counts for objectives by key.</p>
102
+ <h4 id="operatorstats">_operatorStats</h4><p>Operator statistics used by adaptive operator selection.</p>
103
+ <h4 id="paretoarchive">_paretoArchive</h4><p>Archive of Pareto front metadata for multi-objective tracking.</p>
104
+ <h4 id="paretoobjectivesarchive">_paretoObjectivesArchive</h4><p>Archive storing Pareto objectives snapshots.</p>
105
+ <h4 id="pendingobjectiveadds">_pendingObjectiveAdds</h4><p>Pending objective keys to add during safe phases.</p>
106
+ <h4 id="pendingobjectiveremoves">_pendingObjectiveRemoves</h4><p>Pending objective keys to remove during safe phases.</p>
107
+ <h4 id="phase">_phase</h4><p>Optional phase marker for multi-stage experiments.</p>
108
+ <h4 id="previnbreedingcount">_prevInbreedingCount</h4><p>Previous inbreeding count snapshot.</p>
109
+ <h4 id="prevspeciesmembers">_prevSpeciesMembers</h4><p>Map of species id -&gt; set of member genome ids from previous generation.</p>
110
+ <h4 id="rng">_rng</h4><p>Cached RNG function; created lazily and seeded from <code>_rngState</code> when used.</p>
111
+ <h4 id="rngstate">_rngState</h4><p>Internal numeric state for the deterministic xorshift RNG when no user RNG
112
+ is provided. Stored as a 32-bit unsigned integer.</p>
113
+ <h4 id="sortspeciesmembers">_sortSpeciesMembers</h4><p><code>(sp: { members: import(&quot;D:/code-practice/NeatapticTS/src/architecture/network&quot;).default[]; }) =&gt; void</code></p>
114
+ <p>Sort members of a species in-place by descending score.</p>
115
+ <p>Parameters:</p>
116
+ <ul>
117
+ <li><code>sp</code> - - Species object with <code>members</code> array.</li>
118
+ </ul>
119
+ <h4 id="speciate">_speciate</h4><p><code>() =&gt; void</code></p>
120
+ <p>Assign genomes into species based on compatibility distance and maintain species structures.
121
+ This function creates new species for unassigned genomes and prunes empty species.
122
+ It also records species-level history used for telemetry and adaptive controllers.</p>
123
+ <h4 id="species">_species</h4><p>Array of current species (internal representation).</p>
124
+ <h4 id="speciescreated">_speciesCreated</h4><p>Map of speciesId -&gt; creation generation for bookkeeping.</p>
125
+ <h4 id="specieshistory">_speciesHistory</h4><p>Time-series history of species stats (for exports/telemetry).</p>
126
+ <h4 id="specieslaststats">_speciesLastStats</h4><p>Last recorded stats per species id.</p>
127
+ <h4 id="structuralentropy">_structuralEntropy</h4><p><code>(genome: import(&quot;D:/code-practice/NeatapticTS/src/architecture/network&quot;).default) =&gt; number</code></p>
128
+ <p>Compatibility wrapper retained for tests that reference (neat as any)._structuralEntropy</p>
129
+ <h4 id="telemetry">_telemetry</h4><p>Telemetry buffer storing diagnostic snapshots per generation.</p>
130
+ <h4 id="updatespeciesstagnation">_updateSpeciesStagnation</h4><p><code>() =&gt; void</code></p>
131
+ <p>Update species stagnation tracking and remove species that exceeded the allowed stagnation.</p>
132
+ <h4 id="warnifnobestgenome">_warnIfNoBestGenome</h4><p><code>() =&gt; void</code></p>
133
+ <p>Emit a standardized warning when evolution loop finds no valid best genome (test hook).</p>
134
+ <h4 id="addgenome">addGenome</h4><p><code>(genome: import(&quot;D:/code-practice/NeatapticTS/src/architecture/network&quot;).default, parents: number[] | undefined) =&gt; void</code></p>
135
+ <p>Register an externally-created genome into the <code>Neat</code> population.</p>
136
+ <p>Use this method when code constructs or mutates a <code>Network</code> outside of the
137
+ usual reproduction pipeline and needs to insert it into <code>neat.population</code>
138
+ while preserving lineage, id assignment, and structural invariants. The
139
+ method performs best-effort safety actions and falls back to pushing the
140
+ genome even if invariant enforcement throws, which mirrors the forgiving
141
+ behavior used in dynamic population expansion.</p>
142
+ <p>Behavior summary:</p>
143
+ <ul>
144
+ <li>Clears the genome&#39;s <code>score</code> and assigns <code>_id</code> using Neat&#39;s counter.</li>
145
+ <li>When lineage is enabled, attaches the provided <code>parents</code> array (copied)
146
+ and estimates <code>_depth</code> as <code>max(parent._depth) + 1</code> when parent ids are
147
+ resolvable from the current population.</li>
148
+ <li>Enforces structural invariants (<code>ensureMinHiddenNodes</code> and
149
+ <code>ensureNoDeadEnds</code>) and invalidates caches via
150
+ <code>_invalidateGenomeCaches(genome)</code>.</li>
151
+ <li>Pushes the genome into <code>this.population</code>.</li>
152
+ </ul>
153
+ <p>Note: Because depth estimation requires parent objects to be discoverable
154
+ in <code>this.population</code>, callers that generate intermediate parent genomes
155
+ should register them via <code>addGenome</code> before relying on automatic depth
156
+ estimation for their children.</p>
157
+ <p>Parameters:</p>
158
+ <ul>
159
+ <li><code>genome</code> - - The external <code>Network</code> to add.</li>
160
+ <li><code>parents</code> - - Optional array of parent ids to record on the genome.</li>
161
+ </ul>
162
+ <h4 id="clearobjectives">clearObjectives</h4><p><code>() =&gt; void</code></p>
163
+ <p>Register a custom objective for multi-objective optimization.</p>
164
+ <p>Educational context: multi-objective optimization lets you optimize for
165
+ multiple, potentially conflicting goals (e.g., maximize fitness while
166
+ minimizing complexity). Each objective is identified by a unique key and
167
+ an accessor function mapping a genome to a numeric score. Registering an
168
+ objective makes it visible to the internal MO pipeline and clears any
169
+ cached objective list so changes take effect immediately.</p>
170
+ <p>Parameters:</p>
171
+ <ul>
172
+ <li><code>key</code> - Unique objective key.</li>
173
+ <li><code>direction</code> - &#39;min&#39; or &#39;max&#39; indicating optimization direction.</li>
174
+ <li><code>accessor</code> - Function mapping a genome to a numeric objective value.</li>
175
+ </ul>
176
+ <h4 id="clearparetoarchive">clearParetoArchive</h4><p><code>() =&gt; void</code></p>
177
+ <p>Clear the Pareto archive.</p>
178
+ <p>Removes any stored Pareto-front snapshots retained by the algorithm.</p>
179
+ <h4 id="cleartelemetry">clearTelemetry</h4><p><code>() =&gt; void</code></p>
180
+ <p>Export telemetry as CSV with flattened columns for common nested fields.</p>
181
+ <h4 id="createpool">createPool</h4><p><code>(network: import(&quot;D:/code-practice/NeatapticTS/src/architecture/network&quot;).default | null) =&gt; void</code></p>
182
+ <p>Create initial population pool. Delegates to helpers if present.</p>
183
+ <h4 id="ensureminhiddennodes">ensureMinHiddenNodes</h4><p><code>(network: import(&quot;D:/code-practice/NeatapticTS/src/architecture/network&quot;).default, multiplierOverride: number | undefined) =&gt; void</code></p>
184
+ <p>Ensure a network has the minimum number of hidden nodes according to
185
+ configured policy. Delegates to migrated helper implementation.</p>
186
+ <p>Parameters:</p>
187
+ <ul>
188
+ <li><code>network</code> - Network instance to adjust.</li>
189
+ <li><code>multiplierOverride</code> - Optional multiplier to override configured policy.</li>
190
+ </ul>
191
+ <h4 id="ensurenodeadends">ensureNoDeadEnds</h4><p><code>(network: import(&quot;D:/code-practice/NeatapticTS/src/architecture/network&quot;).default) =&gt; void</code></p>
192
+ <p>Delegate ensureNoDeadEnds to mutation module (added for backward compat).</p>
193
+ <h4 id="evolve">evolve</h4><p><code>() =&gt; Promise&lt;import(&quot;D:/code-practice/NeatapticTS/src/architecture/network&quot;).default&gt;</code></p>
194
+ <p>Evolves the population by selecting, mutating, and breeding genomes.
195
+ This method is delegated to <code>src/neat/neat.evolve.ts</code> during the migration.</p>
196
+ <h4 id="export">export</h4><p><code>() =&gt; any[]</code></p>
197
+ <p>Exports the current population as an array of JSON objects.
198
+ Useful for saving the state of the population for later use.</p>
199
+ <p>Returns: An array of JSON representations of the population.</p>
200
+ <h4 id="exportparetofrontjsonl">exportParetoFrontJSONL</h4><p><code>(maxEntries: number) =&gt; string</code></p>
201
+ <p>Export Pareto front archive as JSON Lines for external analysis.</p>
202
+ <p>Each line is a JSON object representing one archived Pareto snapshot.</p>
203
+ <p>Parameters:</p>
204
+ <ul>
205
+ <li><code>maxEntries</code> - Maximum number of entries to include (default: 100).</li>
206
+ </ul>
207
+ <p>Returns: Newline-separated JSON objects.</p>
208
+ <h4 id="exportrngstate">exportRNGState</h4><p><code>() =&gt; number | undefined</code></p>
209
+ <p>Export the current RNG state for external persistence or tests.</p>
210
+ <h4 id="exportspecieshistorycsv">exportSpeciesHistoryCSV</h4><p><code>(maxEntries: number) =&gt; string</code></p>
211
+ <p>Return an array of {id, parents} for the first <code>limit</code> genomes in population.</p>
212
+ <h4 id="exportspecieshistoryjsonl">exportSpeciesHistoryJSONL</h4><p><code>(maxEntries: number) =&gt; string</code></p>
213
+ <p>Export species history as JSON Lines for storage and analysis.</p>
214
+ <p>Each line is a JSON object containing a generation index and per-species
215
+ stats recorded at that generation. Useful for long-term tracking.</p>
216
+ <p>Parameters:</p>
217
+ <ul>
218
+ <li><code>maxEntries</code> - Maximum history entries to include (default: 200).</li>
219
+ </ul>
220
+ <p>Returns: Newline-separated JSON objects.</p>
221
+ <h4 id="exportstate">exportState</h4><p><code>() =&gt; any</code></p>
222
+ <p>Convenience: export full evolutionary state (meta + population genomes).
223
+ Combines innovation registries and serialized genomes for easy persistence.</p>
224
+ <h4 id="exporttelemetrycsv">exportTelemetryCSV</h4><p><code>(maxEntries: number) =&gt; string</code></p>
225
+ <p>Export recent telemetry entries as CSV.</p>
226
+ <p>The exporter attempts to flatten commonly-used nested fields (complexity,
227
+ perf, lineage) into columns. This is a best-effort exporter intended for
228
+ human inspection and simple ingestion.</p>
229
+ <p>Parameters:</p>
230
+ <ul>
231
+ <li><code>maxEntries</code> - Maximum number of recent telemetry entries to include.</li>
232
+ </ul>
233
+ <p>Returns: CSV string (may be empty when no telemetry present).</p>
234
+ <h4 id="exporttelemetryjsonl">exportTelemetryJSONL</h4><p><code>() =&gt; string</code></p>
235
+ <p>Export telemetry as JSON Lines (one JSON object per line).</p>
236
+ <p>Useful for piping telemetry to external loggers or analysis tools.</p>
237
+ <p>Returns: A newline-separated string of JSON objects.</p>
238
+ <h4 id="getaverage">getAverage</h4><p><code>() =&gt; number</code></p>
239
+ <p>Calculates the average fitness score of the population.
240
+ Ensures that the population is evaluated before calculating the average.</p>
241
+ <p>Returns: The average fitness score of the population.</p>
242
+ <h4 id="getdiversitystats">getDiversityStats</h4><p><code>() =&gt; any</code></p>
243
+ <p>Return the latest cached diversity statistics.</p>
244
+ <p>Educational context: diversity metrics summarize how genetically and
245
+ behaviorally spread the population is. They can include lineage depth,
246
+ pairwise genetic distances, and other aggregated measures used by
247
+ adaptive controllers, novelty search, and telemetry. This accessor returns
248
+ whatever precomputed diversity object the Neat instance holds (may be
249
+ undefined if not computed for the current generation).</p>
250
+ <p>Returns: Arbitrary diversity summary object or undefined.</p>
251
+ <h4 id="getfittest">getFittest</h4><p><code>() =&gt; import(&quot;D:/code-practice/NeatapticTS/src/architecture/network&quot;).default</code></p>
252
+ <p>Retrieves the fittest genome from the population.
253
+ Ensures that the population is evaluated and sorted before returning the result.</p>
254
+ <p>Returns: The fittest genome in the population.</p>
255
+ <h4 id="getlineagesnapshot">getLineageSnapshot</h4><p><code>(limit: number) =&gt; { id: number; parents: number[]; }[]</code></p>
256
+ <p>Get recent objective add/remove events.</p>
257
+ <h4 id="getminimumhiddensize">getMinimumHiddenSize</h4><p><code>(multiplierOverride: number | undefined) =&gt; number</code></p>
258
+ <p>Minimum hidden size considering explicit minHidden or multiplier policy.</p>
259
+ <h4 id="getmultiobjectivemetrics">getMultiObjectiveMetrics</h4><p><code>() =&gt; { rank: number; crowding: number; score: number; nodes: number; connections: number; }[]</code></p>
260
+ <p>Returns compact multi-objective metrics for each genome in the current
261
+ population. The metrics include Pareto rank and crowding distance (if
262
+ computed), along with simple size and score measures useful in
263
+ instructional contexts.</p>
264
+ <p>Returns: Array of per-genome MO metric objects.</p>
265
+ <h4 id="getnoveltyarchivesize">getNoveltyArchiveSize</h4><p><code>() =&gt; number</code></p>
266
+ <p>Returns the number of entries currently stored in the novelty archive.</p>
267
+ <p>Educational context: The novelty archive stores representative behaviors
268
+ used by behavior-based novelty search. Monitoring its size helps teach
269
+ how behavioral diversity accumulates over time and can be used to
270
+ throttle archive growth.</p>
271
+ <p>Returns: Number of archived behaviors.</p>
272
+ <h4 id="getobjectivekeys">getObjectiveKeys</h4><p><code>() =&gt; string[]</code></p>
273
+ <p>Public helper returning just the objective keys (tests rely on).</p>
274
+ <h4 id="getobjectives">getObjectives</h4><p><code>() =&gt; { key: string; direction: &quot;max&quot; | &quot;min&quot;; }[]</code></p>
275
+ <p>Clear all collected telemetry entries.</p>
276
+ <h4 id="getoffspring">getOffspring</h4><p><code>() =&gt; import(&quot;D:/code-practice/NeatapticTS/src/architecture/network&quot;).default</code></p>
277
+ <p>Generates an offspring by crossing over two parent networks.
278
+ Uses the crossover method described in the Instinct algorithm.</p>
279
+ <p>Returns: A new network created from two parents.</p>
280
+ <h4 id="getoperatorstats">getOperatorStats</h4><p><code>() =&gt; { name: string; success: number; attempts: number; }[]</code></p>
281
+ <p>Returns a summary of mutation/operator statistics used by operator
282
+ adaptation and bandit selection.</p>
283
+ <p>Educational context: Operator statistics track how often mutation
284
+ operators are attempted and how often they succeed. These counters are
285
+ used by adaptation mechanisms to bias operator selection towards
286
+ successful operators.</p>
287
+ <p>Returns: Array of { name, success, attempts } objects.</p>
288
+ <h4 id="getparent">getParent</h4><p><code>() =&gt; import(&quot;D:/code-practice/NeatapticTS/src/architecture/network&quot;).default</code></p>
289
+ <p>Selects a parent genome for breeding based on the selection method.
290
+ Supports multiple selection strategies, including POWER, FITNESS_PROPORTIONATE, and TOURNAMENT.</p>
291
+ <p>Returns: The selected parent genome.</p>
292
+ <h4 id="getparetoarchive">getParetoArchive</h4><p><code>(maxEntries: number) =&gt; any[]</code></p>
293
+ <p>Get recent Pareto archive entries (meta information about archived fronts).</p>
294
+ <p>Educational context: when performing multi-objective search we may store
295
+ representative Pareto-front snapshots over time. This accessor returns the
296
+ most recent archive entries up to the provided limit.</p>
297
+ <p>Parameters:</p>
298
+ <ul>
299
+ <li><code>maxEntries</code> - Maximum number of entries to return (default: 50).</li>
300
+ </ul>
301
+ <p>Returns: Array of archived Pareto metadata entries.</p>
302
+ <h4 id="getparetofronts">getParetoFronts</h4><p><code>(maxFronts: number) =&gt; import(&quot;D:/code-practice/NeatapticTS/src/architecture/network&quot;).default[][]</code></p>
303
+ <p>Export species history as CSV.</p>
304
+ <p>Produces rows for each recorded per-species stat entry within the
305
+ specified window. Useful for quick inspection or spreadsheet analysis.</p>
306
+ <p>Parameters:</p>
307
+ <ul>
308
+ <li><code>maxEntries</code> - Maximum history entries to include (default: 200).</li>
309
+ </ul>
310
+ <p>Returns: CSV string (may be empty).</p>
311
+ <h4 id="getperformancestats">getPerformanceStats</h4><p><code>() =&gt; { lastEvalMs: number | undefined; lastEvolveMs: number | undefined; }</code></p>
312
+ <p>Return recent performance statistics (durations in milliseconds) for the
313
+ most recent evaluation and evolve operations.</p>
314
+ <p>Provides wall-clock timing useful for profiling and teaching how runtime
315
+ varies with network complexity or population settings.</p>
316
+ <p>Returns: Object with { lastEvalMs, lastEvolveMs }.</p>
317
+ <h4 id="getspecieshistory">getSpeciesHistory</h4><p><code>() =&gt; import(&quot;D:/code-practice/NeatapticTS/src/neat/neat.types&quot;).SpeciesHistoryEntry[]</code></p>
318
+ <p>Returns the historical species statistics recorded each generation.</p>
319
+ <p>Educational context: Species history captures per-generation snapshots
320
+ of species-level metrics (size, best score, last improvement) and is
321
+ useful for plotting trends, teaching about speciation dynamics, and
322
+ driving adaptive controllers.</p>
323
+ <p>The returned array contains entries with a <code>generation</code> index and a
324
+ <code>stats</code> array containing per-species summaries recorded at that
325
+ generation.</p>
326
+ <p>Returns: An array of generation-stamped species stat snapshots.</p>
327
+ <h4 id="getspeciesstats">getSpeciesStats</h4><p><code>() =&gt; { id: number; size: number; bestScore: number; lastImproved: number; }[]</code></p>
328
+ <p>Return a concise summary for each current species.</p>
329
+ <p>Educational context: In NEAT, populations are partitioned into species based
330
+ on genetic compatibility. Each species groups genomes that are similar so
331
+ selection and reproduction can preserve diversity between groups. This
332
+ accessor provides a lightweight view suitable for telemetry, visualization
333
+ and teaching examples without exposing full genome objects.</p>
334
+ <p>The returned array contains objects with these fields:</p>
335
+ <ul>
336
+ <li>id: numeric species identifier</li>
337
+ <li>size: number of members currently assigned to the species</li>
338
+ <li>bestScore: the best observed fitness score for the species</li>
339
+ <li>lastImproved: generation index when the species last improved its best score</li>
340
+ </ul>
341
+ <p>Notes for learners:</p>
342
+ <ul>
343
+ <li>Species sizes and lastImproved are typical signals used to detect
344
+ stagnation and apply protective or penalizing measures.</li>
345
+ <li>This function intentionally avoids returning full member lists to
346
+ prevent accidental mutation of internal state; use <code>getSpeciesHistory</code>
347
+ for richer historical data.</li>
348
+ </ul>
349
+ <p>Returns: An array of species summary objects.</p>
350
+ <h4 id="gettelemetry">getTelemetry</h4><p><code>() =&gt; any[]</code></p>
351
+ <p>Return the internal telemetry buffer.</p>
352
+ <p>Telemetry entries are produced per-generation when telemetry is enabled
353
+ and include diagnostic metrics (diversity, performance, lineage, etc.).
354
+ This accessor returns the raw buffer for external inspection or export.</p>
355
+ <p>Returns: Array of telemetry snapshot objects.</p>
356
+ <h4 id="import">import</h4><p><code>(json: any[]) =&gt; void</code></p>
357
+ <p>Imports a population from an array of JSON objects.
358
+ Replaces the current population with the imported one.</p>
359
+ <p>Parameters:</p>
360
+ <ul>
361
+ <li><code>json</code> - - An array of JSON objects representing the population.</li>
362
+ </ul>
363
+ <h4 id="importrngstate">importRNGState</h4><p><code>(state: any) =&gt; void</code></p>
364
+ <p>Import an RNG state (alias for restore; kept for compatibility).</p>
365
+ <p>Parameters:</p>
366
+ <ul>
367
+ <li><code>state</code> - Numeric RNG state.</li>
368
+ </ul>
369
+ <h4 id="importstate">importState</h4><p><code>(bundle: any, fitness: (n: import(&quot;D:/code-practice/NeatapticTS/src/architecture/network&quot;).default) =&gt; number) =&gt; import(&quot;D:/code-practice/NeatapticTS/src/neat&quot;).default</code></p>
370
+ <p>Convenience: restore full evolutionary state previously produced by exportState().</p>
371
+ <p>Parameters:</p>
372
+ <ul>
373
+ <li><code>bundle</code> - Object with shape { neat, population }</li>
374
+ <li><code>fitness</code> - Fitness function to attach</li>
375
+ </ul>
376
+ <h4 id="mutate">mutate</h4><p><code>() =&gt; void</code></p>
377
+ <p>Applies mutations to the population based on the mutation rate and amount.
378
+ Each genome is mutated using the selected mutation methods.
379
+ Slightly increases the chance of ADD_CONN mutation for more connectivity.</p>
380
+ <h4 id="resetnoveltyarchive">resetNoveltyArchive</h4><p><code>() =&gt; void</code></p>
381
+ <p>Reset the novelty archive (clear entries).</p>
382
+ <p>The novelty archive is used to keep representative behaviors for novelty
383
+ search. Clearing it removes stored behaviors.</p>
384
+ <h4 id="restorerngstate">restoreRNGState</h4><p><code>(state: any) =&gt; void</code></p>
385
+ <p>Restore a previously-snapshotted RNG state. This restores the internal
386
+ seed but does not re-create the RNG function until next use.</p>
387
+ <p>Parameters:</p>
388
+ <ul>
389
+ <li><code>state</code> - Opaque numeric RNG state produced by <code>snapshotRNGState()</code>.</li>
390
+ </ul>
391
+ <h4 id="samplerandom">sampleRandom</h4><p><code>(count: number) =&gt; number[]</code></p>
392
+ <p>Produce <code>count</code> deterministic random samples using instance RNG.</p>
393
+ <h4 id="selectmutationmethod">selectMutationMethod</h4><p><code>(genome: import(&quot;D:/code-practice/NeatapticTS/src/architecture/network&quot;).default, rawReturnForTest: boolean) =&gt; any</code></p>
394
+ <p>Selects a mutation method for a given genome based on constraints.
395
+ Ensures that the mutation respects the maximum nodes, connections, and gates.</p>
396
+ <p>Parameters:</p>
397
+ <ul>
398
+ <li><code>genome</code> - - The genome to mutate.</li>
399
+ </ul>
400
+ <p>Returns: The selected mutation method or null if no valid method is available.</p>
401
+ <h4 id="snapshotrngstate">snapshotRNGState</h4><p><code>() =&gt; number | undefined</code></p>
402
+ <p>Return the current opaque RNG numeric state used by the instance.
403
+ Useful for deterministic test replay and debugging.</p>
404
+ <h4 id="sort">sort</h4><p><code>() =&gt; void</code></p>
405
+ <p>Sorts the population in descending order of fitness scores.
406
+ Ensures that the fittest genomes are at the start of the population array.</p>
407
+ <h4 id="spawnfromparent">spawnFromParent</h4><p><code>(parent: import(&quot;D:/code-practice/NeatapticTS/src/architecture/network&quot;).default, mutateCount: number) =&gt; import(&quot;D:/code-practice/NeatapticTS/src/architecture/network&quot;).default</code></p>
408
+ <p>Spawn a new genome derived from a single parent while preserving Neat bookkeeping.</p>
409
+ <p>This helper performs a canonical &quot;clone + slight mutation&quot; workflow while
410
+ keeping <code>Neat</code>&#39;s internal invariants intact. It is intended for callers that
411
+ want a child genome derived from a single parent but do not want to perform the
412
+ bookkeeping and registration steps manually. The function deliberately does NOT
413
+ add the returned child to <code>this.population</code> so callers are free to inspect or
414
+ further modify the child and then register it via <code>addGenome()</code> (or push it
415
+ directly if they understand the consequences).</p>
416
+ <p>Behavior summary:</p>
417
+ <ul>
418
+ <li>Clone the provided <code>parent</code> (<code>parent.clone()</code> when available, else JSON round-trip).</li>
419
+ <li>Clear fitness/score on the child and assign a fresh unique <code>_id</code>.</li>
420
+ <li>If lineage tracking is enabled, set <code>(child as any)._parents = [parent._id]</code>
421
+ and <code>(child as any)._depth = (parent._depth ?? 0) + 1</code>.</li>
422
+ <li>Enforce structural invariants by calling <code>ensureMinHiddenNodes(child)</code> and
423
+ <code>ensureNoDeadEnds(child)</code> so the child is valid for subsequent mutation/evaluation.</li>
424
+ <li>Apply <code>mutateCount</code> mutations selected via <code>selectMutationMethod</code> and driven by
425
+ the instance RNG (<code>_getRNG()</code>); mutation exceptions are caught and ignored to
426
+ preserve best-effort behavior during population seeding/expansion.</li>
427
+ <li>Invalidate per-genome caches with <code>_invalidateGenomeCaches(child)</code> before return.</li>
428
+ </ul>
429
+ <p>Important: the returned child is not registered in <code>Neat.population</code> — call
430
+ <code>addGenome(child, [parentId])</code> to insert it and keep telemetry/lineage consistent.</p>
431
+ <p>Parameters:</p>
432
+ <ul>
433
+ <li><code>parent</code> - - Source genome to derive from. Must be a <code>Network</code> instance.</li>
434
+ <li><code>mutateCount</code> - - Number of mutation operations to apply to the spawned child (default: 1).</li>
435
+ </ul>
436
+ <p>Returns: A new <code>Network</code> instance derived from <code>parent</code>. The child is unregistered.</p>
437
+ <h4 id="tojson">toJSON</h4><p><code>() =&gt; any</code></p>
438
+ <p>Import a previously exported state bundle and rehydrate a Neat instance.</p>
439
+ <h2 id="neataptic-ts">neataptic.ts</h2><h3 id="neataptic">neataptic</h3><p>Represents a node (neuron) in a neural network graph.</p>
440
+ <p>Nodes are the fundamental processing units. They receive inputs, apply an activation function,
441
+ and produce an output. Nodes can be of type &#39;input&#39;, &#39;hidden&#39;, or &#39;output&#39;. Hidden and output
442
+ nodes have biases and activation functions, which can be mutated during neuro-evolution.
443
+ This class also implements mechanisms for backpropagation, including support for momentum (NAG),
444
+ L2 regularization, dropout, and eligibility traces for recurrent connections.</p>
445
+ <h3 id="default">default</h3><h4 id="activatecore">_activateCore</h4><p><code>(withTrace: boolean, input: number | undefined) =&gt; number</code></p>
446
+ <p>Internal shared implementation for activate/noTraceActivate.</p>
447
+ <p>Parameters:</p>
448
+ <ul>
449
+ <li><code>withTrace</code> - Whether to update eligibility traces.</li>
450
+ <li><code>input</code> - Optional externally supplied activation (bypasses weighted sum if provided).</li>
451
+ </ul>
452
+ <h4 id="adaptiveprunelevel">_adaptivePruneLevel</h4><p>Adaptive prune level for complexity control (optional).</p>
453
+ <h4 id="applyfitnesssharing">_applyFitnessSharing</h4><p><code>() =&gt; void</code></p>
454
+ <p>Apply fitness sharing within species. When <code>sharingSigma</code> &gt; 0 this uses a kernel-based
455
+ sharing; otherwise it falls back to classic per-species averaging. Sharing reduces
456
+ effective fitness for similar genomes to promote diversity.</p>
457
+ <h4 id="applygradientclipping">_applyGradientClipping</h4><p><code>(cfg: { mode: &quot;norm&quot; | &quot;percentile&quot; | &quot;layerwiseNorm&quot; | &quot;layerwisePercentile&quot;; maxNorm?: number | undefined; percentile?: number | undefined; }) =&gt; void</code></p>
458
+ <p>Trains the network on a given dataset subset for one pass (epoch or batch).
459
+ Performs activation and backpropagation for each item in the set.
460
+ Updates weights based on batch size configuration.</p>
461
+ <p>Parameters:</p>
462
+ <ul>
463
+ <li>`` - - The training dataset subset (e.g., a batch or the full set for one epoch).</li>
464
+ <li>`` - - The number of samples to process before updating weights.</li>
465
+ <li>`` - - The learning rate to use for this training pass.</li>
466
+ <li>`` - - The momentum factor to use.</li>
467
+ <li>`` - - The regularization configuration (L1, L2, or custom function).</li>
468
+ <li>`` - - The function used to calculate the error between target and output.</li>
469
+ </ul>
470
+ <p>Returns: The average error calculated over the provided dataset subset.</p>
471
+ <h4 id="bestscorelastgen">_bestScoreLastGen</h4><p>Best score observed in the last generation (used for improvement detection).</p>
472
+ <h4 id="compatintegral">_compatIntegral</h4><p>Integral accumulator used by adaptive compatibility controllers.</p>
473
+ <h4 id="compatspeciesema">_compatSpeciesEMA</h4><p>Exponential moving average for compatibility threshold (adaptive speciation).</p>
474
+ <h4 id="computediversitystats">_computeDiversityStats</h4><p><code>() =&gt; void</code></p>
475
+ <p>Compute and cache diversity statistics used by telemetry &amp; tests.</p>
476
+ <h4 id="conninnovations">_connInnovations</h4><p>Map of connection innovations keyed by a string identifier.</p>
477
+ <h4 id="diversitystats">_diversityStats</h4><p>Cached diversity metrics (computed lazily).</p>
478
+ <h4 id="getobjectives">_getObjectives</h4><p><code>() =&gt; import(&quot;D:/code-practice/NeatapticTS/src/neat/neat.types&quot;).ObjectiveDescriptor[]</code></p>
479
+ <p>Internal: return cached objective descriptors, building if stale.</p>
480
+ <h4 id="globalnodeindex">_globalNodeIndex</h4><p>Global index counter for assigning unique indices to nodes.</p>
481
+ <h4 id="invalidategenomecaches">_invalidateGenomeCaches</h4><p><code>(genome: any) =&gt; void</code></p>
482
+ <p>Invalidate per-genome caches (compatibility distance, forward pass, etc.).</p>
483
+ <h4 id="lastancestoruniqadjustgen">_lastAncestorUniqAdjustGen</h4><p>Generation when ancestor uniqueness adjustment was last applied.</p>
484
+ <h4 id="lastepsilonadjustgen">_lastEpsilonAdjustGen</h4><p>Generation when epsilon compatibility was last adjusted.</p>
485
+ <h4 id="lastevalduration">_lastEvalDuration</h4><p>Duration of the last evaluation run (ms).</p>
486
+ <h4 id="lastevolveduration">_lastEvolveDuration</h4><p>Duration of the last evolve run (ms).</p>
487
+ <h4 id="lastglobalimprovegeneration">_lastGlobalImproveGeneration</h4><p>Generation index where the last global improvement occurred.</p>
488
+ <h4 id="lastinbreedingcount">_lastInbreedingCount</h4><p>Last observed count of inbreeding (used for detecting excessive cloning).</p>
489
+ <h4 id="lastoffspringalloc">_lastOffspringAlloc</h4><p>Last allocated offspring set (used by adaptive allocators).</p>
490
+ <h4 id="lineageenabled">_lineageEnabled</h4><p>Whether lineage metadata should be recorded on genomes.</p>
491
+ <h4 id="mcthreshold">_mcThreshold</h4><p>Adaptive minimal criterion threshold (optional).</p>
492
+ <h4 id="nextgenomeid">_nextGenomeId</h4><p>Counter for assigning unique genome ids.</p>
493
+ <h4 id="nextglobalinnovation">_nextGlobalInnovation</h4><p>Counter for issuing global innovation numbers when explicit numbers are used.</p>
494
+ <h4 id="nodesplitinnovations">_nodeSplitInnovations</h4><p>Map of node-split innovations used to reuse innovation ids for node splits.</p>
495
+ <h4 id="noveltyarchive">_noveltyArchive</h4><p>Novelty archive used by novelty search (behavior representatives).</p>
496
+ <h4 id="objectiveages">_objectiveAges</h4><p>Map tracking ages for objectives by key.</p>
497
+ <h4 id="objectiveevents">_objectiveEvents</h4><p>Queue of recent objective activation/deactivation events for telemetry.</p>
498
+ <h4 id="objectiveslist">_objectivesList</h4><p>Cached list of registered objectives.</p>
499
+ <h4 id="objectivestale">_objectiveStale</h4><p>Map tracking stale counts for objectives by key.</p>
500
+ <h4 id="operatorstats">_operatorStats</h4><p>Operator statistics used by adaptive operator selection.</p>
501
+ <h4 id="paretoarchive">_paretoArchive</h4><p>Archive of Pareto front metadata for multi-objective tracking.</p>
502
+ <h4 id="paretoobjectivesarchive">_paretoObjectivesArchive</h4><p>Archive storing Pareto objectives snapshots.</p>
503
+ <h4 id="pendingobjectiveadds">_pendingObjectiveAdds</h4><p>Pending objective keys to add during safe phases.</p>
504
+ <h4 id="pendingobjectiveremoves">_pendingObjectiveRemoves</h4><p>Pending objective keys to remove during safe phases.</p>
505
+ <h4 id="phase">_phase</h4><p>Optional phase marker for multi-stage experiments.</p>
506
+ <h4 id="previnbreedingcount">_prevInbreedingCount</h4><p>Previous inbreeding count snapshot.</p>
507
+ <h4 id="prevspeciesmembers">_prevSpeciesMembers</h4><p>Map of species id -&gt; set of member genome ids from previous generation.</p>
508
+ <h4 id="rng">_rng</h4><p>Cached RNG function; created lazily and seeded from <code>_rngState</code> when used.</p>
509
+ <h4 id="rngstate">_rngState</h4><p>Internal numeric state for the deterministic xorshift RNG when no user RNG
510
+ is provided. Stored as a 32-bit unsigned integer.</p>
511
+ <h4 id="safeupdateweight">_safeUpdateWeight</h4><p><code>(connection: import(&quot;D:/code-practice/NeatapticTS/src/architecture/connection&quot;).default, delta: number) =&gt; void</code></p>
512
+ <p>Internal helper to safely update a connection weight with clipping and NaN checks.</p>
513
+ <h4 id="sortspeciesmembers">_sortSpeciesMembers</h4><p><code>(sp: { members: import(&quot;D:/code-practice/NeatapticTS/src/architecture/network&quot;).default[]; }) =&gt; void</code></p>
514
+ <p>Sort members of a species in-place by descending score.</p>
515
+ <p>Parameters:</p>
516
+ <ul>
517
+ <li><code>sp</code> - - Species object with <code>members</code> array.</li>
518
+ </ul>
519
+ <h4 id="speciate">_speciate</h4><p><code>() =&gt; void</code></p>
520
+ <p>Assign genomes into species based on compatibility distance and maintain species structures.
521
+ This function creates new species for unassigned genomes and prunes empty species.
522
+ It also records species-level history used for telemetry and adaptive controllers.</p>
523
+ <h4 id="species">_species</h4><p>Array of current species (internal representation).</p>
524
+ <h4 id="speciescreated">_speciesCreated</h4><p>Map of speciesId -&gt; creation generation for bookkeeping.</p>
525
+ <h4 id="specieshistory">_speciesHistory</h4><p>Time-series history of species stats (for exports/telemetry).</p>
526
+ <h4 id="specieslaststats">_speciesLastStats</h4><p>Last recorded stats per species id.</p>
527
+ <h4 id="structuralentropy">_structuralEntropy</h4><p><code>(genome: import(&quot;D:/code-practice/NeatapticTS/src/architecture/network&quot;).default) =&gt; number</code></p>
528
+ <p>Compatibility wrapper retained for tests that reference (neat as any)._structuralEntropy</p>
529
+ <h4 id="telemetry">_telemetry</h4><p>Telemetry buffer storing diagnostic snapshots per generation.</p>
530
+ <h4 id="updatespeciesstagnation">_updateSpeciesStagnation</h4><p><code>() =&gt; void</code></p>
531
+ <p>Update species stagnation tracking and remove species that exceeded the allowed stagnation.</p>
532
+ <h4 id="warnifnobestgenome">_warnIfNoBestGenome</h4><p><code>() =&gt; void</code></p>
533
+ <p>Emit a standardized warning when evolution loop finds no valid best genome (test hook).</p>
534
+ <h4 id="acquire">acquire</h4><p><code>(from: import(&quot;D:/code-practice/NeatapticTS/src/architecture/node&quot;).default, to: import(&quot;D:/code-practice/NeatapticTS/src/architecture/node&quot;).default, weight: number | undefined) =&gt; import(&quot;D:/code-practice/NeatapticTS/src/architecture/connection&quot;).default</code></p>
535
+ <p>Acquire a Connection from the pool or construct a new one. Ensures fresh innovation id.</p>
536
+ <h4 id="activate">activate</h4><p><code>(input: number[], training: boolean, maxActivationDepth: number) =&gt; number[]</code></p>
537
+ <p>Activates the network using the given input array.
538
+ Performs a forward pass through the network, calculating the activation of each node.</p>
539
+ <p>Parameters:</p>
540
+ <ul>
541
+ <li>`` - - An array of numerical values corresponding to the network&#39;s input nodes.</li>
542
+ <li>`` - - Flag indicating if the activation is part of a training process.</li>
543
+ <li>`` - - Maximum allowed activation depth to prevent infinite loops/cycles.</li>
544
+ </ul>
545
+ <p>Returns: An array of numerical values representing the activations of the network&#39;s output nodes.</p>
546
+ <h4 id="activate">activate</h4><p><code>(input: number | undefined) =&gt; number</code></p>
547
+ <p>Activates the node, calculating its output value based on inputs and state.
548
+ This method also calculates eligibility traces (<code>xtrace</code>) used for training recurrent connections.</p>
549
+ <p>The activation process involves:</p>
550
+ <ol>
551
+ <li>Calculating the node&#39;s internal state (<code>this.state</code>) based on:<ul>
552
+ <li>Incoming connections&#39; weighted activations.</li>
553
+ <li>The recurrent self-connection&#39;s weighted state from the previous timestep (<code>this.old</code>).</li>
554
+ <li>The node&#39;s bias.</li>
555
+ </ul>
556
+ </li>
557
+ <li>Applying the activation function (<code>this.squash</code>) to the state to get the activation (<code>this.activation</code>).</li>
558
+ <li>Applying the dropout mask (<code>this.mask</code>).</li>
559
+ <li>Calculating the derivative of the activation function.</li>
560
+ <li>Updating the gain of connections gated by this node.</li>
561
+ <li>Calculating and updating eligibility traces for incoming connections.</li>
562
+ </ol>
563
+ <p>Parameters:</p>
564
+ <ul>
565
+ <li><code>input</code> - Optional input value. If provided, sets the node&#39;s activation directly (used for input nodes).</li>
566
+ </ul>
567
+ <p>Returns: The calculated activation value of the node.</p>
568
+ <h4 id="activate">activate</h4><p><code>(value: number[] | undefined, training: boolean) =&gt; number[]</code></p>
569
+ <p>Activates all nodes within the layer, computing their output values.</p>
570
+ <p>If an input <code>value</code> array is provided, it&#39;s used as the initial activation
571
+ for the corresponding nodes in the layer. Otherwise, nodes compute their
572
+ activation based on their incoming connections.</p>
573
+ <p>During training, layer-level dropout is applied, masking all nodes in the layer together.
574
+ During inference, all masks are set to 1.</p>
575
+ <p>Parameters:</p>
576
+ <ul>
577
+ <li><code>value</code> - - An optional array of activation values to set for the layer&#39;s nodes. The length must match the number of nodes.</li>
578
+ <li><code>training</code> - - A boolean indicating whether the layer is in training mode. Defaults to false.</li>
579
+ </ul>
580
+ <p>Returns: An array containing the activation value of each node in the layer after activation.</p>
581
+ <h4 id="activate">activate</h4><p><code>(value: number[] | undefined) =&gt; number[]</code></p>
582
+ <p>Activates all nodes in the group. If input values are provided, they are assigned
583
+ sequentially to the nodes before activation. Otherwise, nodes activate based on their
584
+ existing states and incoming connections.</p>
585
+ <p>Parameters:</p>
586
+ <ul>
587
+ <li>`` - - An optional array of input values. If provided, its length must match the number of nodes in the group.</li>
588
+ </ul>
589
+ <p>Returns: An array containing the activation value of each node in the group, in order.</p>
590
+ <h4 id="activatebatch">activateBatch</h4><p><code>(inputs: number[][], training: boolean) =&gt; number[][]</code></p>
591
+ <p>Activate the network over a batch of input vectors (micro-batching).</p>
592
+ <p>Currently iterates sample-by-sample while reusing the network&#39;s internal
593
+ fast-path allocations. Outputs are cloned number[] arrays for API
594
+ compatibility. Future optimizations can vectorize this path.</p>
595
+ <p>Parameters:</p>
596
+ <ul>
597
+ <li><code>inputs</code> - Array of input vectors, each length must equal this.input</li>
598
+ <li><code>training</code> - Whether to run with training-time stochastic features</li>
599
+ </ul>
600
+ <p>Returns: Array of output vectors, each length equals this.output</p>
601
+ <h4 id="activateraw">activateRaw</h4><p><code>(input: number[], training: boolean, maxActivationDepth: number) =&gt; any</code></p>
602
+ <p>Raw activation that can return a typed array when pooling is enabled (zero-copy).
603
+ If reuseActivationArrays=false falls back to standard activate().</p>
604
+ <h4 id="activation">activation</h4><p>The output value of the node after applying the activation function. This is the value transmitted to connected nodes.</p>
605
+ <h4 id="addgenome">addGenome</h4><p><code>(genome: import(&quot;D:/code-practice/NeatapticTS/src/architecture/network&quot;).default, parents: number[] | undefined) =&gt; void</code></p>
606
+ <p>Register an externally-created genome into the <code>Neat</code> population.</p>
607
+ <p>Use this method when code constructs or mutates a <code>Network</code> outside of the
608
+ usual reproduction pipeline and needs to insert it into <code>neat.population</code>
609
+ while preserving lineage, id assignment, and structural invariants. The
610
+ method performs best-effort safety actions and falls back to pushing the
611
+ genome even if invariant enforcement throws, which mirrors the forgiving
612
+ behavior used in dynamic population expansion.</p>
613
+ <p>Behavior summary:</p>
614
+ <ul>
615
+ <li>Clears the genome&#39;s <code>score</code> and assigns <code>_id</code> using Neat&#39;s counter.</li>
616
+ <li>When lineage is enabled, attaches the provided <code>parents</code> array (copied)
617
+ and estimates <code>_depth</code> as <code>max(parent._depth) + 1</code> when parent ids are
618
+ resolvable from the current population.</li>
619
+ <li>Enforces structural invariants (<code>ensureMinHiddenNodes</code> and
620
+ <code>ensureNoDeadEnds</code>) and invalidates caches via
621
+ <code>_invalidateGenomeCaches(genome)</code>.</li>
622
+ <li>Pushes the genome into <code>this.population</code>.</li>
623
+ </ul>
624
+ <p>Note: Because depth estimation requires parent objects to be discoverable
625
+ in <code>this.population</code>, callers that generate intermediate parent genomes
626
+ should register them via <code>addGenome</code> before relying on automatic depth
627
+ estimation for their children.</p>
628
+ <p>Parameters:</p>
629
+ <ul>
630
+ <li><code>genome</code> - - The external <code>Network</code> to add.</li>
631
+ <li><code>parents</code> - - Optional array of parent ids to record on the genome.</li>
632
+ </ul>
633
+ <h4 id="adjustrateforaccumulation">adjustRateForAccumulation</h4><p><code>(rate: number, accumulationSteps: number, reduction: &quot;average&quot; | &quot;sum&quot;) =&gt; number</code></p>
634
+ <p>Utility: adjust rate for accumulation mode (use result when switching to &#39;sum&#39; to mimic &#39;average&#39;).</p>
635
+ <h4 id="applybatchupdates">applyBatchUpdates</h4><p><code>(momentum: number) =&gt; void</code></p>
636
+ <p>Applies accumulated batch updates to incoming and self connections and this node&#39;s bias.
637
+ Uses momentum in a Nesterov-compatible way: currentDelta = accumulated + momentum * previousDelta.
638
+ Resets accumulators after applying. Safe to call on any node type.</p>
639
+ <p>Parameters:</p>
640
+ <ul>
641
+ <li><code>momentum</code> - Momentum factor (0 to disable)</li>
642
+ </ul>
643
+ <h4 id="applybatchupdateswithoptimizer">applyBatchUpdatesWithOptimizer</h4><p><code>(opts: { type: &quot;sgd&quot; | &quot;rmsprop&quot; | &quot;adagrad&quot; | &quot;adam&quot; | &quot;adamw&quot; | &quot;amsgrad&quot; | &quot;adamax&quot; | &quot;nadam&quot; | &quot;radam&quot; | &quot;lion&quot; | &quot;adabelief&quot; | &quot;lookahead&quot;; momentum?: number | undefined; beta1?: number | undefined; beta2?: number | undefined; eps?: number | undefined; weightDecay?: number | undefined; lrScale?: number | undefined; t?: number | undefined; baseType?: any; la_k?: number | undefined; la_alpha?: number | undefined; }) =&gt; void</code></p>
644
+ <p>Extended batch update supporting multiple optimizers.</p>
645
+ <p>Applies accumulated (batch) gradients stored in <code>totalDeltaWeight</code> / <code>totalDeltaBias</code> to the
646
+ underlying weights and bias using the selected optimization algorithm. Supports both classic
647
+ SGD (with Nesterov-style momentum via preceding propagate logic) and a collection of adaptive
648
+ optimizers. After applying an update, gradient accumulators are reset to 0.</p>
649
+ <p>Supported optimizers (type):</p>
650
+ <ul>
651
+ <li>&#39;sgd&#39; : Standard gradient descent with optional momentum.</li>
652
+ <li>&#39;rmsprop&#39; : Exponential moving average of squared gradients (cache) to normalize step.</li>
653
+ <li>&#39;adagrad&#39; : Accumulate squared gradients; learning rate effectively decays per weight.</li>
654
+ <li>&#39;adam&#39; : Bias‑corrected first (m) &amp; second (v) moment estimates.</li>
655
+ <li>&#39;adamw&#39; : Adam with decoupled weight decay (applied after adaptive step).</li>
656
+ <li>&#39;amsgrad&#39; : Adam variant maintaining a maximum of past v (vhat) to enforce non‑increasing step size.</li>
657
+ <li>&#39;adamax&#39; : Adam variant using the infinity norm (u) instead of second moment.</li>
658
+ <li>&#39;nadam&#39; : Adam + Nesterov momentum style update (lookahead on first moment).</li>
659
+ <li>&#39;radam&#39; : Rectified Adam – warms up variance by adaptively rectifying denominator when sample size small.</li>
660
+ <li>&#39;lion&#39; : Uses sign of combination of two momentum buffers (beta1 &amp; beta2) for update direction only.</li>
661
+ <li>&#39;adabelief&#39;: Adam-like but second moment on (g - m) (gradient surprise) for variance reduction.</li>
662
+ <li>&#39;lookahead&#39;: Wrapper; performs k fast optimizer steps then interpolates (alpha) towards a slow (shadow) weight.</li>
663
+ </ul>
664
+ <p>Options:</p>
665
+ <ul>
666
+ <li>momentum : (SGD) momentum factor (Nesterov handled in propagate when update=true).</li>
667
+ <li>beta1/beta2 : Exponential decay rates for first/second moments (Adam family, Lion, AdaBelief, etc.).</li>
668
+ <li>eps : Numerical stability epsilon added to denominator terms.</li>
669
+ <li>weightDecay : Decoupled weight decay (AdamW) or additionally applied after main step when adamw selected.</li>
670
+ <li>lrScale : Learning rate scalar already scheduled externally (passed as currentRate).</li>
671
+ <li>t : Global step (1-indexed) for bias correction / rectification.</li>
672
+ <li>baseType : Underlying optimizer for lookahead (not itself lookahead).</li>
673
+ <li>la_k : Lookahead synchronization interval (number of fast steps).</li>
674
+ <li>la_alpha : Interpolation factor towards slow (shadow) weights/bias at sync points.</li>
675
+ </ul>
676
+ <p>Internal per-connection temp fields (created lazily):</p>
677
+ <ul>
678
+ <li>opt_m / opt_v / opt_vhat / opt_u : Moment / variance / max variance / infinity norm caches.</li>
679
+ <li>opt_cache : Single accumulator (RMSProp / AdaGrad).</li>
680
+ <li>previousDeltaWeight : For classic SGD momentum.</li>
681
+ <li>_la_shadowWeight / _la_shadowBias : Lookahead shadow copies.</li>
682
+ </ul>
683
+ <p>Safety: We clip extreme weight / bias magnitudes and guard against NaN/Infinity.</p>
684
+ <p>Parameters:</p>
685
+ <ul>
686
+ <li><code>opts</code> - Optimizer configuration (see above).</li>
687
+ </ul>
688
+ <h4 id="attention">attention</h4><p><code>(size: number, heads: number) =&gt; import(&quot;D:/code-practice/NeatapticTS/src/architecture/layer&quot;).default</code></p>
689
+ <p>Creates a multi-head self-attention layer (stub implementation).</p>
690
+ <p>Parameters:</p>
691
+ <ul>
692
+ <li><code>size</code> - - Number of output nodes.</li>
693
+ <li><code>heads</code> - - Number of attention heads (default 1).</li>
694
+ </ul>
695
+ <p>Returns: A new Layer instance representing an attention layer.</p>
696
+ <h4 id="batchnorm">batchNorm</h4><p><code>(size: number) =&gt; import(&quot;D:/code-practice/NeatapticTS/src/architecture/layer&quot;).default</code></p>
697
+ <p>Creates a batch normalization layer.
698
+ Applies batch normalization to the activations of the nodes in this layer during activation.</p>
699
+ <p>Parameters:</p>
700
+ <ul>
701
+ <li><code>size</code> - - The number of nodes in this layer.</li>
702
+ </ul>
703
+ <p>Returns: A new Layer instance configured as a batch normalization layer.</p>
704
+ <h4 id="bias">bias</h4><p>The bias value of the node. Added to the weighted sum of inputs before activation.
705
+ Input nodes typically have a bias of 0.</p>
706
+ <h4 id="clear">clear</h4><p><code>() =&gt; void</code></p>
707
+ <p>Clears the internal state of all nodes in the network.
708
+ Resets node activation, state, eligibility traces, and extended traces to their initial values (usually 0).
709
+ This is typically done before processing a new input sequence in recurrent networks or between training epochs if desired.</p>
710
+ <h4 id="clearobjectives">clearObjectives</h4><p><code>() =&gt; void</code></p>
711
+ <p>Register a custom objective for multi-objective optimization.</p>
712
+ <p>Educational context: multi-objective optimization lets you optimize for
713
+ multiple, potentially conflicting goals (e.g., maximize fitness while
714
+ minimizing complexity). Each objective is identified by a unique key and
715
+ an accessor function mapping a genome to a numeric score. Registering an
716
+ objective makes it visible to the internal MO pipeline and clears any
717
+ cached objective list so changes take effect immediately.</p>
718
+ <p>Parameters:</p>
719
+ <ul>
720
+ <li><code>key</code> - Unique objective key.</li>
721
+ <li><code>direction</code> - &#39;min&#39; or &#39;max&#39; indicating optimization direction.</li>
722
+ <li><code>accessor</code> - Function mapping a genome to a numeric objective value.</li>
723
+ </ul>
724
+ <h4 id="clearparetoarchive">clearParetoArchive</h4><p><code>() =&gt; void</code></p>
725
+ <p>Clear the Pareto archive.</p>
726
+ <p>Removes any stored Pareto-front snapshots retained by the algorithm.</p>
727
+ <h4 id="cleartelemetry">clearTelemetry</h4><p><code>() =&gt; void</code></p>
728
+ <p>Export telemetry as CSV with flattened columns for common nested fields.</p>
729
+ <h4 id="clone">clone</h4><p><code>() =&gt; import(&quot;D:/code-practice/NeatapticTS/src/architecture/network&quot;).default</code></p>
730
+ <p>Creates a deep copy of the network.</p>
731
+ <p>Returns: A new Network instance that is a clone of the current network.</p>
732
+ <h4 id="connect">connect</h4><p><code>(from: import(&quot;D:/code-practice/NeatapticTS/src/architecture/node&quot;).default, to: import(&quot;D:/code-practice/NeatapticTS/src/architecture/node&quot;).default, weight: number | undefined) =&gt; import(&quot;D:/code-practice/NeatapticTS/src/architecture/connection&quot;).default[]</code></p>
733
+ <p>Creates a connection between two nodes in the network.
734
+ Handles both regular connections and self-connections.
735
+ Adds the new connection object(s) to the appropriate network list (<code>connections</code> or <code>selfconns</code>).</p>
736
+ <p>Parameters:</p>
737
+ <ul>
738
+ <li>`` - - The source node of the connection.</li>
739
+ <li>`` - - The target node of the connection.</li>
740
+ <li>`` - - Optional weight for the connection. If not provided, a random weight is usually assigned by the underlying <code>Node.connect</code> method.</li>
741
+ </ul>
742
+ <p>Returns: An array containing the newly created connection object(s). Typically contains one connection, but might be empty or contain more in specialized node types.</p>
743
+ <h4 id="connect">connect</h4><p><code>(target: import(&quot;D:/code-practice/NeatapticTS/src/architecture/node&quot;).default | { nodes: import(&quot;D:/code-practice/NeatapticTS/src/architecture/node&quot;).default[]; }, weight: number | undefined) =&gt; import(&quot;D:/code-practice/NeatapticTS/src/architecture/connection&quot;).default[]</code></p>
744
+ <p>Creates a connection from this node to a target node or all nodes in a group.</p>
745
+ <p>Parameters:</p>
746
+ <ul>
747
+ <li><code>target</code> - The target Node or a group object containing a <code>nodes</code> array.</li>
748
+ <li><code>weight</code> - The weight for the new connection(s). If undefined, a default or random weight might be assigned by the Connection constructor (currently defaults to 0, consider changing).</li>
749
+ </ul>
750
+ <p>Returns: An array containing the newly created Connection object(s).</p>
751
+ <h4 id="connect">connect</h4><p><code>(target: import(&quot;D:/code-practice/NeatapticTS/src/architecture/node&quot;).default | import(&quot;D:/code-practice/NeatapticTS/src/architecture/layer&quot;).default | import(&quot;D:/code-practice/NeatapticTS/src/architecture/group&quot;).default, method: any, weight: number | undefined) =&gt; any[]</code></p>
752
+ <p>Connects this layer&#39;s output to a target component (Layer, Group, or Node).</p>
753
+ <p>This method delegates the connection logic primarily to the layer&#39;s <code>output</code> group
754
+ or the target layer&#39;s <code>input</code> method. It establishes the forward connections
755
+ necessary for signal propagation.</p>
756
+ <p>Parameters:</p>
757
+ <ul>
758
+ <li><code>target</code> - - The destination Layer, Group, or Node to connect to.</li>
759
+ <li><code>method</code> - - The connection method (e.g., <code>ALL_TO_ALL</code>, <code>ONE_TO_ONE</code>) defining the connection pattern. See <code>methods.groupConnection</code>.</li>
760
+ <li><code>weight</code> - - An optional fixed weight to assign to all created connections.</li>
761
+ <li>`` - - The destination entity (Group, Layer, or Node) to connect to.</li>
762
+ </ul>
763
+ <p>Returns: An array containing the newly created connection objects.</p>
764
+ <h4 id="connections">connections</h4><p>Stores incoming, outgoing, gated, and self-connections for this node.</p>
765
+ <h4 id="construct">construct</h4><p><code>(list: (import(&quot;D:/code-practice/NeatapticTS/src/architecture/node&quot;).default | import(&quot;D:/code-practice/NeatapticTS/src/architecture/layer&quot;).default | import(&quot;D:/code-practice/NeatapticTS/src/architecture/group&quot;).default)[]) =&gt; import(&quot;D:/code-practice/NeatapticTS/src/architecture/network&quot;).default</code></p>
766
+ <p>Constructs a Network instance from an array of interconnected Layers, Groups, or Nodes.</p>
767
+ <p>This method processes the input list, extracts all unique nodes, identifies connections,
768
+ gates, and self-connections, and determines the network&#39;s input and output sizes based
769
+ on the <code>type</code> property (&#39;input&#39; or &#39;output&#39;) set on the nodes. It uses Sets internally
770
+ for efficient handling of unique elements during construction.</p>
771
+ <p>Parameters:</p>
772
+ <ul>
773
+ <li>`` - - An array containing the building blocks (Nodes, Layers, Groups) of the network, assumed to be already interconnected.</li>
774
+ </ul>
775
+ <p>Returns: A Network object representing the constructed architecture.</p>
776
+ <h4 id="conv1d">conv1d</h4><p><code>(size: number, kernelSize: number, stride: number, padding: number) =&gt; import(&quot;D:/code-practice/NeatapticTS/src/architecture/layer&quot;).default</code></p>
777
+ <p>Creates a 1D convolutional layer (stub implementation).</p>
778
+ <p>Parameters:</p>
779
+ <ul>
780
+ <li><code>size</code> - - Number of output nodes (filters).</li>
781
+ <li><code>kernelSize</code> - - Size of the convolution kernel.</li>
782
+ <li><code>stride</code> - - Stride of the convolution (default 1).</li>
783
+ <li><code>padding</code> - - Padding (default 0).</li>
784
+ </ul>
785
+ <p>Returns: A new Layer instance representing a 1D convolutional layer.</p>
786
+ <h4 id="createmlp">createMLP</h4><p><code>(inputCount: number, hiddenCounts: number[], outputCount: number) =&gt; import(&quot;D:/code-practice/NeatapticTS/src/architecture/network&quot;).default</code></p>
787
+ <p>Creates a fully connected, strictly layered MLP network.</p>
788
+ <p>Parameters:</p>
789
+ <ul>
790
+ <li>`` - - Number of input nodes</li>
791
+ <li>`` - - Array of hidden layer sizes (e.g. [2,3] for two hidden layers)</li>
792
+ <li>`` - - Number of output nodes</li>
793
+ </ul>
794
+ <p>Returns: A new, fully connected, layered MLP</p>
795
+ <h4 id="createpool">createPool</h4><p><code>(network: import(&quot;D:/code-practice/NeatapticTS/src/architecture/network&quot;).default | null) =&gt; void</code></p>
796
+ <p>Create initial population pool. Delegates to helpers if present.</p>
797
+ <h4 id="crossover">crossOver</h4><p><code>(network1: import(&quot;D:/code-practice/NeatapticTS/src/architecture/network&quot;).default, network2: import(&quot;D:/code-practice/NeatapticTS/src/architecture/network&quot;).default, equal: boolean) =&gt; import(&quot;D:/code-practice/NeatapticTS/src/architecture/network&quot;).default</code></p>
798
+ <p>Creates a new offspring network by performing crossover between two parent networks.
799
+ This method implements the crossover mechanism inspired by the NEAT algorithm and described
800
+ in the Instinct paper, combining genes (nodes and connections) from both parents.
801
+ Fitness scores can influence the inheritance process. Matching genes are inherited randomly,
802
+ while disjoint/excess genes are typically inherited from the fitter parent (or randomly if fitness is equal or <code>equal</code> flag is set).</p>
803
+ <p>Parameters:</p>
804
+ <ul>
805
+ <li>`` - - The first parent network.</li>
806
+ <li>`` - - The second parent network.</li>
807
+ <li>`` - - If true, disjoint and excess genes are inherited randomly regardless of fitness.
808
+ If false (default), they are inherited from the fitter parent.</li>
809
+ </ul>
810
+ <p>Returns: A new Network instance representing the offspring.</p>
811
+ <h4 id="dense">dense</h4><p><code>(size: number) =&gt; import(&quot;D:/code-practice/NeatapticTS/src/architecture/layer&quot;).default</code></p>
812
+ <p>Creates a standard fully connected (dense) layer.</p>
813
+ <p>All nodes in the source layer/group will connect to all nodes in this layer
814
+ when using the default <code>ALL_TO_ALL</code> connection method via <code>layer.input()</code>.</p>
815
+ <p>Parameters:</p>
816
+ <ul>
817
+ <li><code>size</code> - - The number of nodes (neurons) in this layer.</li>
818
+ </ul>
819
+ <p>Returns: A new Layer instance configured as a dense layer.</p>
820
+ <h4 id="derivative">derivative</h4><p>The derivative of the activation function evaluated at the node&#39;s current state. Used in backpropagation.</p>
821
+ <h4 id="deserialize">deserialize</h4><p><code>(data: any[], inputSize: number | undefined, outputSize: number | undefined) =&gt; import(&quot;D:/code-practice/NeatapticTS/src/architecture/network&quot;).default</code></p>
822
+ <p>Creates a Network instance from serialized data produced by <code>serialize()</code>.
823
+ Reconstructs the network structure and state based on the provided arrays.</p>
824
+ <p>Parameters:</p>
825
+ <ul>
826
+ <li>`` - - The serialized network data array, typically obtained from <code>network.serialize()</code>.
827
+ Expected format: <code>[activations, states, squashNames, connectionData, inputSize, outputSize]</code>.</li>
828
+ <li>`` - - Optional input size override.</li>
829
+ <li>`` - - Optional output size override.</li>
830
+ </ul>
831
+ <p>Returns: A new Network instance reconstructed from the serialized data.</p>
832
+ <h4 id="disconnect">disconnect</h4><p><code>(from: import(&quot;D:/code-practice/NeatapticTS/src/architecture/node&quot;).default, to: import(&quot;D:/code-practice/NeatapticTS/src/architecture/node&quot;).default) =&gt; void</code></p>
833
+ <p>Disconnects two nodes, removing the connection between them.
834
+ Handles both regular connections and self-connections.
835
+ If the connection being removed was gated, it is also ungated.</p>
836
+ <p>Parameters:</p>
837
+ <ul>
838
+ <li>`` - - The source node of the connection to remove.</li>
839
+ <li>`` - - The target node of the connection to remove.</li>
840
+ </ul>
841
+ <h4 id="disconnect">disconnect</h4><p><code>(target: import(&quot;D:/code-practice/NeatapticTS/src/architecture/node&quot;).default, twosided: boolean) =&gt; void</code></p>
842
+ <p>Removes the connection from this node to the target node.</p>
843
+ <p>Parameters:</p>
844
+ <ul>
845
+ <li><code>target</code> - The target node to disconnect from.</li>
846
+ <li><code>twosided</code> - If true, also removes the connection from the target node back to this node (if it exists). Defaults to false.</li>
847
+ </ul>
848
+ <h4 id="disconnect">disconnect</h4><p><code>(target: import(&quot;D:/code-practice/NeatapticTS/src/architecture/node&quot;).default | import(&quot;D:/code-practice/NeatapticTS/src/architecture/group&quot;).default, twosided: boolean | undefined) =&gt; void</code></p>
849
+ <p>Removes connections between this layer&#39;s nodes and a target Group or Node.</p>
850
+ <p>Parameters:</p>
851
+ <ul>
852
+ <li><code>target</code> - - The Group or Node to disconnect from.</li>
853
+ <li><code>twosided</code> - - If true, removes connections in both directions (from this layer to target, and from target to this layer). Defaults to false.</li>
854
+ </ul>
855
+ <h4 id="disconnect">disconnect</h4><p><code>(target: import(&quot;D:/code-practice/NeatapticTS/src/architecture/node&quot;).default | import(&quot;D:/code-practice/NeatapticTS/src/architecture/group&quot;).default, twosided: boolean) =&gt; void</code></p>
856
+ <p>Removes connections between nodes in this group and a target Group or Node.</p>
857
+ <p>Parameters:</p>
858
+ <ul>
859
+ <li>`` - - The Group or Node to disconnect from.</li>
860
+ <li>`` - - If true, also removes connections originating from the <code>target</code> and ending in this group. Defaults to false (only removes connections from this group to the target).</li>
861
+ </ul>
862
+ <h4 id="dropout">dropout</h4><p>Dropout rate for this layer (0 to 1). If &gt; 0, all nodes in the layer are masked together during training.
863
+ Layer-level dropout takes precedence over node-level dropout for nodes in this layer.</p>
864
+ <h4 id="enableweightnoise">enableWeightNoise</h4><p><code>(stdDev: number | { perHiddenLayer: number[]; }) =&gt; void</code></p>
865
+ <p>Enable weight noise. Provide a single std dev number or { perHiddenLayer: number[] }.</p>
866
+ <h4 id="enforceminimumhiddenlayersizes">enforceMinimumHiddenLayerSizes</h4><p><code>(network: import(&quot;D:/code-practice/NeatapticTS/src/architecture/network&quot;).default) =&gt; import(&quot;D:/code-practice/NeatapticTS/src/architecture/network&quot;).default</code></p>
867
+ <p>Enforces the minimum hidden layer size rule on a network.</p>
868
+ <p>This ensures that all hidden layers have at least min(input, output) + 1 nodes,
869
+ which is a common heuristic to ensure networks have adequate representation capacity.</p>
870
+ <p>Parameters:</p>
871
+ <ul>
872
+ <li>`` - - The network to enforce minimum hidden layer sizes on</li>
873
+ </ul>
874
+ <p>Returns: The same network with properly sized hidden layers</p>
875
+ <h4 id="ensureminhiddennodes">ensureMinHiddenNodes</h4><p><code>(network: import(&quot;D:/code-practice/NeatapticTS/src/architecture/network&quot;).default, multiplierOverride: number | undefined) =&gt; void</code></p>
876
+ <p>Ensure a network has the minimum number of hidden nodes according to
877
+ configured policy. Delegates to migrated helper implementation.</p>
878
+ <p>Parameters:</p>
879
+ <ul>
880
+ <li><code>network</code> - Network instance to adjust.</li>
881
+ <li><code>multiplierOverride</code> - Optional multiplier to override configured policy.</li>
882
+ </ul>
883
+ <h4 id="ensurenodeadends">ensureNoDeadEnds</h4><p><code>(network: import(&quot;D:/code-practice/NeatapticTS/src/architecture/network&quot;).default) =&gt; void</code></p>
884
+ <p>Delegate ensureNoDeadEnds to mutation module (added for backward compat).</p>
885
+ <h4 id="error">error</h4><p>Stores error values calculated during backpropagation.</p>
886
+ <h4 id="evolve">evolve</h4><p><code>() =&gt; Promise&lt;import(&quot;D:/code-practice/NeatapticTS/src/architecture/network&quot;).default&gt;</code></p>
887
+ <p>Evolves the population by selecting, mutating, and breeding genomes.
888
+ This method is delegated to <code>src/neat/neat.evolve.ts</code> during the migration.</p>
889
+ <h4 id="export">export</h4><p><code>() =&gt; any[]</code></p>
890
+ <p>Exports the current population as an array of JSON objects.
891
+ Useful for saving the state of the population for later use.</p>
892
+ <p>Returns: An array of JSON representations of the population.</p>
893
+ <h4 id="exportparetofrontjsonl">exportParetoFrontJSONL</h4><p><code>(maxEntries: number) =&gt; string</code></p>
894
+ <p>Export Pareto front archive as JSON Lines for external analysis.</p>
895
+ <p>Each line is a JSON object representing one archived Pareto snapshot.</p>
896
+ <p>Parameters:</p>
897
+ <ul>
898
+ <li><code>maxEntries</code> - Maximum number of entries to include (default: 100).</li>
899
+ </ul>
900
+ <p>Returns: Newline-separated JSON objects.</p>
901
+ <h4 id="exportrngstate">exportRNGState</h4><p><code>() =&gt; number | undefined</code></p>
902
+ <p>Export the current RNG state for external persistence or tests.</p>
903
+ <h4 id="exportspecieshistorycsv">exportSpeciesHistoryCSV</h4><p><code>(maxEntries: number) =&gt; string</code></p>
904
+ <p>Return an array of {id, parents} for the first <code>limit</code> genomes in population.</p>
905
+ <h4 id="exportspecieshistoryjsonl">exportSpeciesHistoryJSONL</h4><p><code>(maxEntries: number) =&gt; string</code></p>
906
+ <p>Export species history as JSON Lines for storage and analysis.</p>
907
+ <p>Each line is a JSON object containing a generation index and per-species
908
+ stats recorded at that generation. Useful for long-term tracking.</p>
909
+ <p>Parameters:</p>
910
+ <ul>
911
+ <li><code>maxEntries</code> - Maximum history entries to include (default: 200).</li>
912
+ </ul>
913
+ <p>Returns: Newline-separated JSON objects.</p>
914
+ <h4 id="exportstate">exportState</h4><p><code>() =&gt; any</code></p>
915
+ <p>Convenience: export full evolutionary state (meta + population genomes).
916
+ Combines innovation registries and serialized genomes for easy persistence.</p>
917
+ <h4 id="exporttelemetrycsv">exportTelemetryCSV</h4><p><code>(maxEntries: number) =&gt; string</code></p>
918
+ <p>Export recent telemetry entries as CSV.</p>
919
+ <p>The exporter attempts to flatten commonly-used nested fields (complexity,
920
+ perf, lineage) into columns. This is a best-effort exporter intended for
921
+ human inspection and simple ingestion.</p>
922
+ <p>Parameters:</p>
923
+ <ul>
924
+ <li><code>maxEntries</code> - Maximum number of recent telemetry entries to include.</li>
925
+ </ul>
926
+ <p>Returns: CSV string (may be empty when no telemetry present).</p>
927
+ <h4 id="exporttelemetryjsonl">exportTelemetryJSONL</h4><p><code>() =&gt; string</code></p>
928
+ <p>Export telemetry as JSON Lines (one JSON object per line).</p>
929
+ <p>Useful for piping telemetry to external loggers or analysis tools.</p>
930
+ <p>Returns: A newline-separated string of JSON objects.</p>
931
+ <h4 id="fromjson">fromJSON</h4><p><code>(json: any) =&gt; import(&quot;D:/code-practice/NeatapticTS/src/architecture/network&quot;).default</code></p>
932
+ <p>Reconstructs a network from a JSON object (latest standard).
933
+ Handles formatVersion, robust error handling, and index-based references.</p>
934
+ <p>Parameters:</p>
935
+ <ul>
936
+ <li>`` - - The JSON object representing the network.</li>
937
+ </ul>
938
+ <p>Returns: The reconstructed network.</p>
939
+ <h4 id="fromjson">fromJSON</h4><p><code>(json: { bias: number; type: string; squash: string; mask: number; }) =&gt; import(&quot;D:/code-practice/NeatapticTS/src/architecture/node&quot;).default</code></p>
940
+ <p>Creates a Node instance from a JSON object.</p>
941
+ <p>Parameters:</p>
942
+ <ul>
943
+ <li><code>json</code> - The JSON object containing node configuration.</li>
944
+ </ul>
945
+ <p>Returns: A new Node instance configured according to the JSON object.</p>
946
+ <h4 id="gate">gate</h4><p><code>(node: import(&quot;D:/code-practice/NeatapticTS/src/architecture/node&quot;).default, connection: import(&quot;D:/code-practice/NeatapticTS/src/architecture/connection&quot;).default) =&gt; void</code></p>
947
+ <p>Gates a connection with a specified node.
948
+ The activation of the <code>node</code> (gater) will modulate the weight of the <code>connection</code>.
949
+ Adds the connection to the network&#39;s <code>gates</code> list.</p>
950
+ <p>Parameters:</p>
951
+ <ul>
952
+ <li>`` - - The node that will act as the gater. Must be part of this network.</li>
953
+ <li>`` - - The connection to be gated.</li>
954
+ </ul>
955
+ <h4 id="gate">gate</h4><p><code>(connections: import(&quot;D:/code-practice/NeatapticTS/src/architecture/connection&quot;).default | import(&quot;D:/code-practice/NeatapticTS/src/architecture/connection&quot;).default[]) =&gt; void</code></p>
956
+ <p>Makes this node gate the provided connection(s).
957
+ The connection&#39;s gain will be controlled by this node&#39;s activation value.</p>
958
+ <p>Parameters:</p>
959
+ <ul>
960
+ <li><code>connections</code> - A single Connection object or an array of Connection objects to be gated.</li>
961
+ </ul>
962
+ <h4 id="gate">gate</h4><p><code>(connections: any[], method: any) =&gt; void</code></p>
963
+ <p>Applies gating to a set of connections originating from this layer&#39;s output group.</p>
964
+ <p>Gating allows the activity of nodes in this layer (specifically, the output group)
965
+ to modulate the flow of information through the specified <code>connections</code>.</p>
966
+ <p>Parameters:</p>
967
+ <ul>
968
+ <li><code>connections</code> - - An array of connection objects to be gated.</li>
969
+ <li><code>method</code> - - The gating method (e.g., <code>INPUT</code>, <code>OUTPUT</code>, <code>SELF</code>) specifying how the gate influences the connection. See <code>methods.gating</code>.</li>
970
+ </ul>
971
+ <h4 id="gate">gate</h4><p><code>(connections: any, method: any) =&gt; void</code></p>
972
+ <p>Configures nodes within this group to act as gates for the specified connection(s).
973
+ Gating allows the output of a node in this group to modulate the flow of signal through the gated connection.</p>
974
+ <p>Parameters:</p>
975
+ <ul>
976
+ <li>`` - - A single connection object or an array of connection objects to be gated. Consider using a more specific type like <code>Connection | Connection[]</code>.</li>
977
+ <li>`` - - The gating mechanism to use (e.g., <code>methods.gating.INPUT</code>, <code>methods.gating.OUTPUT</code>, <code>methods.gating.SELF</code>). Specifies which part of the connection is influenced by the gater node.</li>
978
+ </ul>
979
+ <h4 id="gates">gates</h4><p><strong>Deprecated:</strong> Use connections.gated; retained for legacy tests</p>
980
+ <h4 id="geneid">geneId</h4><p>Stable per-node gene identifier for NEAT innovation reuse</p>
981
+ <h4 id="getaverage">getAverage</h4><p><code>() =&gt; number</code></p>
982
+ <p>Calculates the average fitness score of the population.
983
+ Ensures that the population is evaluated before calculating the average.</p>
984
+ <p>Returns: The average fitness score of the population.</p>
985
+ <h4 id="getdiversitystats">getDiversityStats</h4><p><code>() =&gt; any</code></p>
986
+ <p>Return the latest cached diversity statistics.</p>
987
+ <p>Educational context: diversity metrics summarize how genetically and
988
+ behaviorally spread the population is. They can include lineage depth,
989
+ pairwise genetic distances, and other aggregated measures used by
990
+ adaptive controllers, novelty search, and telemetry. This accessor returns
991
+ whatever precomputed diversity object the Neat instance holds (may be
992
+ undefined if not computed for the current generation).</p>
993
+ <p>Returns: Arbitrary diversity summary object or undefined.</p>
994
+ <h4 id="getfittest">getFittest</h4><p><code>() =&gt; import(&quot;D:/code-practice/NeatapticTS/src/architecture/network&quot;).default</code></p>
995
+ <p>Retrieves the fittest genome from the population.
996
+ Ensures that the population is evaluated and sorted before returning the result.</p>
997
+ <p>Returns: The fittest genome in the population.</p>
998
+ <h4 id="getlastgradclipgroupcount">getLastGradClipGroupCount</h4><p><code>() =&gt; number</code></p>
999
+ <p>Returns last gradient clipping group count (0 if no clipping yet).</p>
1000
+ <h4 id="getlineagesnapshot">getLineageSnapshot</h4><p><code>(limit: number) =&gt; { id: number; parents: number[]; }[]</code></p>
1001
+ <p>Get recent objective add/remove events.</p>
1002
+ <h4 id="getlossscale">getLossScale</h4><p><code>() =&gt; number</code></p>
1003
+ <p>Returns current mixed precision loss scale (1 if disabled).</p>
1004
+ <h4 id="getminimumhiddensize">getMinimumHiddenSize</h4><p><code>(multiplierOverride: number | undefined) =&gt; number</code></p>
1005
+ <p>Minimum hidden size considering explicit minHidden or multiplier policy.</p>
1006
+ <h4 id="getmultiobjectivemetrics">getMultiObjectiveMetrics</h4><p><code>() =&gt; { rank: number; crowding: number; score: number; nodes: number; connections: number; }[]</code></p>
1007
+ <p>Returns compact multi-objective metrics for each genome in the current
1008
+ population. The metrics include Pareto rank and crowding distance (if
1009
+ computed), along with simple size and score measures useful in
1010
+ instructional contexts.</p>
1011
+ <p>Returns: Array of per-genome MO metric objects.</p>
1012
+ <h4 id="getnoveltyarchivesize">getNoveltyArchiveSize</h4><p><code>() =&gt; number</code></p>
1013
+ <p>Returns the number of entries currently stored in the novelty archive.</p>
1014
+ <p>Educational context: The novelty archive stores representative behaviors
1015
+ used by behavior-based novelty search. Monitoring its size helps teach
1016
+ how behavioral diversity accumulates over time and can be used to
1017
+ throttle archive growth.</p>
1018
+ <p>Returns: Number of archived behaviors.</p>
1019
+ <h4 id="getobjectivekeys">getObjectiveKeys</h4><p><code>() =&gt; string[]</code></p>
1020
+ <p>Public helper returning just the objective keys (tests rely on).</p>
1021
+ <h4 id="getobjectives">getObjectives</h4><p><code>() =&gt; { key: string; direction: &quot;max&quot; | &quot;min&quot;; }[]</code></p>
1022
+ <p>Clear all collected telemetry entries.</p>
1023
+ <h4 id="getoffspring">getOffspring</h4><p><code>() =&gt; import(&quot;D:/code-practice/NeatapticTS/src/architecture/network&quot;).default</code></p>
1024
+ <p>Generates an offspring by crossing over two parent networks.
1025
+ Uses the crossover method described in the Instinct algorithm.</p>
1026
+ <p>Returns: A new network created from two parents.</p>
1027
+ <h4 id="getoperatorstats">getOperatorStats</h4><p><code>() =&gt; { name: string; success: number; attempts: number; }[]</code></p>
1028
+ <p>Returns a summary of mutation/operator statistics used by operator
1029
+ adaptation and bandit selection.</p>
1030
+ <p>Educational context: Operator statistics track how often mutation
1031
+ operators are attempted and how often they succeed. These counters are
1032
+ used by adaptation mechanisms to bias operator selection towards
1033
+ successful operators.</p>
1034
+ <p>Returns: Array of { name, success, attempts } objects.</p>
1035
+ <h4 id="getparent">getParent</h4><p><code>() =&gt; import(&quot;D:/code-practice/NeatapticTS/src/architecture/network&quot;).default</code></p>
1036
+ <p>Selects a parent genome for breeding based on the selection method.
1037
+ Supports multiple selection strategies, including POWER, FITNESS_PROPORTIONATE, and TOURNAMENT.</p>
1038
+ <p>Returns: The selected parent genome.</p>
1039
+ <h4 id="getparetoarchive">getParetoArchive</h4><p><code>(maxEntries: number) =&gt; any[]</code></p>
1040
+ <p>Get recent Pareto archive entries (meta information about archived fronts).</p>
1041
+ <p>Educational context: when performing multi-objective search we may store
1042
+ representative Pareto-front snapshots over time. This accessor returns the
1043
+ most recent archive entries up to the provided limit.</p>
1044
+ <p>Parameters:</p>
1045
+ <ul>
1046
+ <li><code>maxEntries</code> - Maximum number of entries to return (default: 50).</li>
1047
+ </ul>
1048
+ <p>Returns: Array of archived Pareto metadata entries.</p>
1049
+ <h4 id="getparetofronts">getParetoFronts</h4><p><code>(maxFronts: number) =&gt; import(&quot;D:/code-practice/NeatapticTS/src/architecture/network&quot;).default[][]</code></p>
1050
+ <p>Export species history as CSV.</p>
1051
+ <p>Produces rows for each recorded per-species stat entry within the
1052
+ specified window. Useful for quick inspection or spreadsheet analysis.</p>
1053
+ <p>Parameters:</p>
1054
+ <ul>
1055
+ <li><code>maxEntries</code> - Maximum history entries to include (default: 200).</li>
1056
+ </ul>
1057
+ <p>Returns: CSV string (may be empty).</p>
1058
+ <h4 id="getperformancestats">getPerformanceStats</h4><p><code>() =&gt; { lastEvalMs: number | undefined; lastEvolveMs: number | undefined; }</code></p>
1059
+ <p>Return recent performance statistics (durations in milliseconds) for the
1060
+ most recent evaluation and evolve operations.</p>
1061
+ <p>Provides wall-clock timing useful for profiling and teaching how runtime
1062
+ varies with network complexity or population settings.</p>
1063
+ <p>Returns: Object with { lastEvalMs, lastEvolveMs }.</p>
1064
+ <h4 id="getrawgradientnorm">getRawGradientNorm</h4><p><code>() =&gt; number</code></p>
1065
+ <p>Returns last recorded raw (pre-update) gradient L2 norm.</p>
1066
+ <h4 id="getspecieshistory">getSpeciesHistory</h4><p><code>() =&gt; import(&quot;D:/code-practice/NeatapticTS/src/neat/neat.types&quot;).SpeciesHistoryEntry[]</code></p>
1067
+ <p>Returns the historical species statistics recorded each generation.</p>
1068
+ <p>Educational context: Species history captures per-generation snapshots
1069
+ of species-level metrics (size, best score, last improvement) and is
1070
+ useful for plotting trends, teaching about speciation dynamics, and
1071
+ driving adaptive controllers.</p>
1072
+ <p>The returned array contains entries with a <code>generation</code> index and a
1073
+ <code>stats</code> array containing per-species summaries recorded at that
1074
+ generation.</p>
1075
+ <p>Returns: An array of generation-stamped species stat snapshots.</p>
1076
+ <h4 id="getspeciesstats">getSpeciesStats</h4><p><code>() =&gt; { id: number; size: number; bestScore: number; lastImproved: number; }[]</code></p>
1077
+ <p>Return a concise summary for each current species.</p>
1078
+ <p>Educational context: In NEAT, populations are partitioned into species based
1079
+ on genetic compatibility. Each species groups genomes that are similar so
1080
+ selection and reproduction can preserve diversity between groups. This
1081
+ accessor provides a lightweight view suitable for telemetry, visualization
1082
+ and teaching examples without exposing full genome objects.</p>
1083
+ <p>The returned array contains objects with these fields:</p>
1084
+ <ul>
1085
+ <li>id: numeric species identifier</li>
1086
+ <li>size: number of members currently assigned to the species</li>
1087
+ <li>bestScore: the best observed fitness score for the species</li>
1088
+ <li>lastImproved: generation index when the species last improved its best score</li>
1089
+ </ul>
1090
+ <p>Notes for learners:</p>
1091
+ <ul>
1092
+ <li>Species sizes and lastImproved are typical signals used to detect
1093
+ stagnation and apply protective or penalizing measures.</li>
1094
+ <li>This function intentionally avoids returning full member lists to
1095
+ prevent accidental mutation of internal state; use <code>getSpeciesHistory</code>
1096
+ for richer historical data.</li>
1097
+ </ul>
1098
+ <p>Returns: An array of species summary objects.</p>
1099
+ <h4 id="gettelemetry">getTelemetry</h4><p><code>() =&gt; any[]</code></p>
1100
+ <p>Return the internal telemetry buffer.</p>
1101
+ <p>Telemetry entries are produced per-generation when telemetry is enabled
1102
+ and include diagnostic metrics (diversity, performance, lineage, etc.).
1103
+ This accessor returns the raw buffer for external inspection or export.</p>
1104
+ <p>Returns: Array of telemetry snapshot objects.</p>
1105
+ <h4 id="gettrainingstats">getTrainingStats</h4><p><code>() =&gt; { gradNorm: number; gradNormRaw: number; lossScale: number; optimizerStep: number; mp: { good: number; bad: number; overflowCount: number; scaleUps: number; scaleDowns: number; lastOverflowStep: number; }; }</code></p>
1106
+ <p>Consolidated training stats snapshot.</p>
1107
+ <h4 id="gru">gru</h4><p><code>(size: number) =&gt; import(&quot;D:/code-practice/NeatapticTS/src/architecture/layer&quot;).default</code></p>
1108
+ <p>Creates a Gated Recurrent Unit (GRU) layer.</p>
1109
+ <p>GRUs are another type of recurrent neural network cell, often considered
1110
+ simpler than LSTMs but achieving similar performance on many tasks.
1111
+ They use an update gate and a reset gate to manage information flow.</p>
1112
+ <p>Parameters:</p>
1113
+ <ul>
1114
+ <li><code>size</code> - - The number of GRU units (and nodes in each gate/cell group).</li>
1115
+ </ul>
1116
+ <p>Returns: A new Layer instance configured as a GRU layer.</p>
1117
+ <h4 id="gru">gru</h4><p><code>(layers: number[]) =&gt; import(&quot;D:/code-practice/NeatapticTS/src/architecture/network&quot;).default</code></p>
1118
+ <p>Creates a Gated Recurrent Unit (GRU) network.
1119
+ GRUs are another type of recurrent neural network, similar to LSTMs but often simpler.
1120
+ This constructor uses <code>Layer.gru</code> to create the core GRU blocks.</p>
1121
+ <p>Parameters:</p>
1122
+ <ul>
1123
+ <li>`` - - A sequence of numbers representing the size (number of units) of each layer: input layer size, hidden GRU layer sizes..., output layer size. Must include at least input, one hidden, and output layer sizes.</li>
1124
+ </ul>
1125
+ <p>Returns: The constructed GRU network.</p>
1126
+ <h4 id="hopfield">hopfield</h4><p><code>(size: number) =&gt; import(&quot;D:/code-practice/NeatapticTS/src/architecture/network&quot;).default</code></p>
1127
+ <p>Creates a Hopfield network.
1128
+ Hopfield networks are a form of recurrent neural network often used for associative memory tasks.
1129
+ This implementation creates a simple, fully connected structure.</p>
1130
+ <p>Parameters:</p>
1131
+ <ul>
1132
+ <li>`` - - The number of nodes in the network (input and output layers will have this size).</li>
1133
+ </ul>
1134
+ <p>Returns: The constructed Hopfield network.</p>
1135
+ <h4 id="import">import</h4><p><code>(json: any[]) =&gt; void</code></p>
1136
+ <p>Imports a population from an array of JSON objects.
1137
+ Replaces the current population with the imported one.</p>
1138
+ <p>Parameters:</p>
1139
+ <ul>
1140
+ <li><code>json</code> - - An array of JSON objects representing the population.</li>
1141
+ </ul>
1142
+ <h4 id="importrngstate">importRNGState</h4><p><code>(state: any) =&gt; void</code></p>
1143
+ <p>Import an RNG state (alias for restore; kept for compatibility).</p>
1144
+ <p>Parameters:</p>
1145
+ <ul>
1146
+ <li><code>state</code> - Numeric RNG state.</li>
1147
+ </ul>
1148
+ <h4 id="importstate">importState</h4><p><code>(bundle: any, fitness: (n: import(&quot;D:/code-practice/NeatapticTS/src/architecture/network&quot;).default) =&gt; number) =&gt; import(&quot;D:/code-practice/NeatapticTS/src/neat&quot;).default</code></p>
1149
+ <p>Convenience: restore full evolutionary state previously produced by exportState().</p>
1150
+ <p>Parameters:</p>
1151
+ <ul>
1152
+ <li><code>bundle</code> - Object with shape { neat, population }</li>
1153
+ <li><code>fitness</code> - Fitness function to attach</li>
1154
+ </ul>
1155
+ <h4 id="index">index</h4><p>Optional index, potentially used to identify the node&#39;s position within a layer or network structure. Not used internally by the Node class itself.</p>
1156
+ <h4 id="innovationid">innovationID</h4><p><code>(a: number, b: number) =&gt; number</code></p>
1157
+ <p>Generates a unique innovation ID for the connection.</p>
1158
+ <p>The innovation ID is calculated using the Cantor pairing function, which maps two integers
1159
+ (representing the source and target nodes) to a unique integer.</p>
1160
+ <p>Parameters:</p>
1161
+ <ul>
1162
+ <li>`` - - The ID of the source node.</li>
1163
+ <li>`` - - The ID of the target node.</li>
1164
+ </ul>
1165
+ <p>Returns: The innovation ID based on the Cantor pairing function.</p>
1166
+ <h4 id="input">input</h4><p><code>(from: import(&quot;D:/code-practice/NeatapticTS/src/architecture/layer&quot;).default | import(&quot;D:/code-practice/NeatapticTS/src/architecture/group&quot;).default, method: any, weight: number | undefined) =&gt; any[]</code></p>
1167
+ <p>Handles the connection logic when this layer is the <em>target</em> of a connection.</p>
1168
+ <p>It connects the output of the <code>from</code> layer or group to this layer&#39;s primary
1169
+ input mechanism (which is often the <code>output</code> group itself, but depends on the layer type).
1170
+ This method is usually called by the <code>connect</code> method of the source layer/group.</p>
1171
+ <p>Parameters:</p>
1172
+ <ul>
1173
+ <li><code>from</code> - - The source Layer or Group connecting <em>to</em> this layer.</li>
1174
+ <li><code>method</code> - - The connection method (e.g., <code>ALL_TO_ALL</code>). Defaults to <code>ALL_TO_ALL</code>.</li>
1175
+ <li><code>weight</code> - - An optional fixed weight for the connections.</li>
1176
+ </ul>
1177
+ <p>Returns: An array containing the newly created connection objects.</p>
1178
+ <h4 id="isactivating">isActivating</h4><p>Internal flag to detect cycles during activation</p>
1179
+ <h4 id="isconnectedto">isConnectedTo</h4><p><code>(target: import(&quot;D:/code-practice/NeatapticTS/src/architecture/node&quot;).default) =&gt; boolean</code></p>
1180
+ <p>Checks if this node is connected to another node.</p>
1181
+ <p>Parameters:</p>
1182
+ <ul>
1183
+ <li><code>target</code> - The target node to check the connection with.</li>
1184
+ </ul>
1185
+ <p>Returns: True if connected, otherwise false.</p>
1186
+ <h4 id="isgroup">isGroup</h4><p><code>(obj: any) =&gt; boolean</code></p>
1187
+ <p>Type guard to check if an object is likely a <code>Group</code>.</p>
1188
+ <p>This is a duck-typing check based on the presence of expected properties
1189
+ (<code>set</code> method and <code>nodes</code> array). Used internally where <code>layer.nodes</code>
1190
+ might contain <code>Group</code> instances (e.g., in <code>Memory</code> layers).</p>
1191
+ <p>Parameters:</p>
1192
+ <ul>
1193
+ <li><code>obj</code> - - The object to inspect.</li>
1194
+ </ul>
1195
+ <p>Returns: <code>true</code> if the object has <code>set</code> and <code>nodes</code> properties matching a Group, <code>false</code> otherwise.</p>
1196
+ <h4 id="isprojectedby">isProjectedBy</h4><p><code>(node: import(&quot;D:/code-practice/NeatapticTS/src/architecture/node&quot;).default) =&gt; boolean</code></p>
1197
+ <p>Checks if the given node has a direct outgoing connection to this node.
1198
+ Considers both regular incoming connections and the self-connection.</p>
1199
+ <p>Parameters:</p>
1200
+ <ul>
1201
+ <li><code>node</code> - The potential source node.</li>
1202
+ </ul>
1203
+ <p>Returns: True if the given node projects to this node, false otherwise.</p>
1204
+ <h4 id="isprojectingto">isProjectingTo</h4><p><code>(node: import(&quot;D:/code-practice/NeatapticTS/src/architecture/node&quot;).default) =&gt; boolean</code></p>
1205
+ <p>Checks if this node has a direct outgoing connection to the given node.
1206
+ Considers both regular outgoing connections and the self-connection.</p>
1207
+ <p>Parameters:</p>
1208
+ <ul>
1209
+ <li><code>node</code> - The potential target node.</li>
1210
+ </ul>
1211
+ <p>Returns: True if this node projects to the target node, false otherwise.</p>
1212
+ <h4 id="layernorm">layerNorm</h4><p><code>(size: number) =&gt; import(&quot;D:/code-practice/NeatapticTS/src/architecture/layer&quot;).default</code></p>
1213
+ <p>Creates a layer normalization layer.
1214
+ Applies layer normalization to the activations of the nodes in this layer during activation.</p>
1215
+ <p>Parameters:</p>
1216
+ <ul>
1217
+ <li><code>size</code> - - The number of nodes in this layer.</li>
1218
+ </ul>
1219
+ <p>Returns: A new Layer instance configured as a layer normalization layer.</p>
1220
+ <h4 id="lstm">lstm</h4><p><code>(size: number) =&gt; import(&quot;D:/code-practice/NeatapticTS/src/architecture/layer&quot;).default</code></p>
1221
+ <p>Creates a Long Short-Term Memory (LSTM) layer.</p>
1222
+ <p>LSTMs are a type of recurrent neural network (RNN) cell capable of learning
1223
+ long-range dependencies. This implementation uses standard LSTM architecture
1224
+ with input, forget, and output gates, and a memory cell.</p>
1225
+ <p>Parameters:</p>
1226
+ <ul>
1227
+ <li><code>size</code> - - The number of LSTM units (and nodes in each gate/cell group).</li>
1228
+ </ul>
1229
+ <p>Returns: A new Layer instance configured as an LSTM layer.</p>
1230
+ <h4 id="lstm">lstm</h4><p><code>(layerArgs: (number | { inputToOutput?: boolean | undefined; })[]) =&gt; import(&quot;D:/code-practice/NeatapticTS/src/architecture/network&quot;).default</code></p>
1231
+ <p>Creates a Long Short-Term Memory (LSTM) network.
1232
+ LSTMs are a type of recurrent neural network (RNN) capable of learning long-range dependencies.
1233
+ This constructor uses <code>Layer.lstm</code> to create the core LSTM blocks.</p>
1234
+ <p>Parameters:</p>
1235
+ <ul>
1236
+ <li>`` - - A sequence of arguments defining the network structure:</li>
1237
+ <li>Numbers represent the size (number of units) of each layer: input layer size, hidden LSTM layer sizes..., output layer size.</li>
1238
+ <li>An optional configuration object can be provided as the last argument.</li>
1239
+ <li>`` - - Configuration options (if passed as the last argument).</li>
1240
+ </ul>
1241
+ <p>Returns: The constructed LSTM network.</p>
1242
+ <h4 id="mask">mask</h4><p>A mask factor (typically 0 or 1) used for implementing dropout. If 0, the node&#39;s output is effectively silenced.</p>
1243
+ <h4 id="memory">memory</h4><p><code>(size: number, memory: number) =&gt; import(&quot;D:/code-practice/NeatapticTS/src/architecture/layer&quot;).default</code></p>
1244
+ <p>Creates a Memory layer, designed to hold state over a fixed number of time steps.</p>
1245
+ <p>This layer consists of multiple groups (memory blocks), each holding the state
1246
+ from a previous time step. The input connects to the most recent block, and
1247
+ information propagates backward through the blocks. The layer&#39;s output
1248
+ concatenates the states of all memory blocks.</p>
1249
+ <p>Parameters:</p>
1250
+ <ul>
1251
+ <li><code>size</code> - - The number of nodes in each memory block (must match the input size).</li>
1252
+ <li><code>memory</code> - - The number of time steps to remember (number of memory blocks).</li>
1253
+ </ul>
1254
+ <p>Returns: A new Layer instance configured as a Memory layer.</p>
1255
+ <h4 id="mutate">mutate</h4><p><code>() =&gt; void</code></p>
1256
+ <p>Applies mutations to the population based on the mutation rate and amount.
1257
+ Each genome is mutated using the selected mutation methods.
1258
+ Slightly increases the chance of ADD_CONN mutation for more connectivity.</p>
1259
+ <h4 id="mutate">mutate</h4><p><code>(method: any) =&gt; void</code></p>
1260
+ <p>Mutates the network&#39;s structure or parameters according to the specified method.
1261
+ This is a core operation for neuro-evolutionary algorithms (like NEAT).
1262
+ The method argument should be one of the mutation types defined in <code>methods.mutation</code>.</p>
1263
+ <p>Parameters:</p>
1264
+ <ul>
1265
+ <li>`` - - The mutation method to apply (e.g., <code>mutation.ADD_NODE</code>, <code>mutation.MOD_WEIGHT</code>).
1266
+ Some methods might have associated parameters (e.g., <code>MOD_WEIGHT</code> uses <code>min</code>, <code>max</code>).</li>
1267
+ <li><code>method</code> - A mutation method object, typically from <code>methods.mutation</code>. It should define the type of mutation and its parameters (e.g., allowed functions, modification range).</li>
1268
+ </ul>
1269
+ <h4 id="narx">narx</h4><p><code>(inputSize: number, hiddenLayers: number | number[], outputSize: number, previousInput: number, previousOutput: number) =&gt; import(&quot;D:/code-practice/NeatapticTS/src/architecture/network&quot;).default</code></p>
1270
+ <p>Creates a Nonlinear AutoRegressive network with eXogenous inputs (NARX).
1271
+ NARX networks are recurrent networks often used for time series prediction.
1272
+ They predict the next value of a time series based on previous values of the series
1273
+ and previous values of external (exogenous) input series.</p>
1274
+ <p>Parameters:</p>
1275
+ <ul>
1276
+ <li>`` - - The number of input nodes for the exogenous inputs at each time step.</li>
1277
+ <li>`` - - The size of the hidden layer(s). Can be a single number for one hidden layer, or an array of numbers for multiple hidden layers. Use 0 or [] for no hidden layers.</li>
1278
+ <li>`` - - The number of output nodes (predicting the time series).</li>
1279
+ <li>`` - - The number of past time steps of the exogenous input to feed back into the network.</li>
1280
+ <li>`` - - The number of past time steps of the network&#39;s own output to feed back into the network (autoregressive part).</li>
1281
+ </ul>
1282
+ <p>Returns: The constructed NARX network.</p>
1283
+ <h4 id="nodes">nodes</h4><p>An array containing all the nodes (neurons or groups) that constitute this layer.
1284
+ The order of nodes might be relevant depending on the layer type and its connections.</p>
1285
+ <p><strong>Deprecated:</strong> Placeholder kept for legacy structural algorithms. No longer populated.</p>
1286
+ <h4 id="notraceactivate">noTraceActivate</h4><p><code>(input: number[]) =&gt; number[]</code></p>
1287
+ <p>Activates the network without calculating eligibility traces.
1288
+ This is a performance optimization for scenarios where backpropagation is not needed,
1289
+ such as during testing, evaluation, or deployment (inference).</p>
1290
+ <p>Parameters:</p>
1291
+ <ul>
1292
+ <li>`` - - An array of numerical values corresponding to the network&#39;s input nodes.
1293
+ The length must match the network&#39;s <code>input</code> size.</li>
1294
+ </ul>
1295
+ <p>Returns: An array of numerical values representing the activations of the network&#39;s output nodes.</p>
1296
+ <h4 id="notraceactivate">noTraceActivate</h4><p><code>(input: number | undefined) =&gt; number</code></p>
1297
+ <p>Activates the node without calculating eligibility traces (<code>xtrace</code>).
1298
+ This is a performance optimization used during inference (when the network
1299
+ is just making predictions, not learning) as trace calculations are only needed for training.</p>
1300
+ <p>Parameters:</p>
1301
+ <ul>
1302
+ <li><code>input</code> - Optional input value. If provided, sets the node&#39;s activation directly (used for input nodes).</li>
1303
+ </ul>
1304
+ <p>Returns: The calculated activation value of the node.</p>
1305
+ <h4 id="old">old</h4><p>The node&#39;s state from the previous activation cycle. Used for recurrent self-connections.</p>
1306
+ <h4 id="output">output</h4><p>Represents the primary output group of nodes for this layer.
1307
+ This group is typically used when connecting this layer <em>to</em> another layer or group.
1308
+ It might be null if the layer is not yet fully constructed or is an input layer.</p>
1309
+ <h4 id="perceptron">perceptron</h4><p><code>(layers: number[]) =&gt; import(&quot;D:/code-practice/NeatapticTS/src/architecture/network&quot;).default</code></p>
1310
+ <p>Creates a standard Multi-Layer Perceptron (MLP) network.
1311
+ An MLP consists of an input layer, one or more hidden layers, and an output layer,
1312
+ fully connected layer by layer.</p>
1313
+ <p>Parameters:</p>
1314
+ <ul>
1315
+ <li>`` - - A sequence of numbers representing the size (number of nodes) of each layer, starting with the input layer, followed by hidden layers, and ending with the output layer. Must include at least input, one hidden, and output layer sizes.</li>
1316
+ </ul>
1317
+ <p>Returns: The constructed MLP network.</p>
1318
+ <h4 id="previousdeltabias">previousDeltaBias</h4><p>The change in bias applied in the previous training iteration. Used for calculating momentum.</p>
1319
+ <h4 id="propagate">propagate</h4><p><code>(rate: number, momentum: number, update: boolean, target: number[], regularization: number, costDerivative: ((target: number, output: number) =&gt; number) | undefined) =&gt; void</code></p>
1320
+ <p>Propagates the error backward through the network (backpropagation).
1321
+ Calculates the error gradient for each node and connection.
1322
+ If <code>update</code> is true, it adjusts the weights and biases based on the calculated gradients,
1323
+ learning rate, momentum, and optional L2 regularization.</p>
1324
+ <p>The process starts from the output nodes and moves backward layer by layer (or topologically for recurrent nets).</p>
1325
+ <p>Parameters:</p>
1326
+ <ul>
1327
+ <li>`` - - The learning rate (controls the step size of weight adjustments).</li>
1328
+ <li>`` - - The momentum factor (helps overcome local minima and speeds up convergence). Typically between 0 and 1.</li>
1329
+ <li>`` - - If true, apply the calculated weight and bias updates. If false, only calculate gradients (e.g., for batch accumulation).</li>
1330
+ <li>`` - - An array of target values corresponding to the network&#39;s output nodes.
1331
+ The length must match the network&#39;s <code>output</code> size.</li>
1332
+ <li>`` - - The L2 regularization factor (lambda). Helps prevent overfitting by penalizing large weights.</li>
1333
+ <li>`` - - Optional derivative of the cost function for output nodes.</li>
1334
+ </ul>
1335
+ <h4 id="propagate">propagate</h4><p><code>(rate: number, momentum: number, update: boolean, regularization: number | { type: &quot;L1&quot; | &quot;L2&quot;; lambda: number; } | ((weight: number) =&gt; number), target: number | undefined) =&gt; void</code></p>
1336
+ <p>Back-propagates the error signal through the node and calculates weight/bias updates.</p>
1337
+ <p>This method implements the backpropagation algorithm, including:</p>
1338
+ <ol>
1339
+ <li>Calculating the node&#39;s error responsibility based on errors from subsequent nodes (<code>projected</code> error)
1340
+ and errors from connections it gates (<code>gated</code> error).</li>
1341
+ <li>Calculating the gradient for each incoming connection&#39;s weight using eligibility traces (<code>xtrace</code>).</li>
1342
+ <li>Calculating the change (delta) for weights and bias, incorporating:<ul>
1343
+ <li>Learning rate.</li>
1344
+ <li>L1/L2/custom regularization.</li>
1345
+ <li>Momentum (using Nesterov Accelerated Gradient - NAG).</li>
1346
+ </ul>
1347
+ </li>
1348
+ <li>Optionally applying the calculated updates immediately or accumulating them for batch training.</li>
1349
+ </ol>
1350
+ <p>Parameters:</p>
1351
+ <ul>
1352
+ <li><code>rate</code> - The learning rate (controls the step size of updates).</li>
1353
+ <li><code>momentum</code> - The momentum factor (helps accelerate learning and overcome local minima). Uses NAG.</li>
1354
+ <li><code>update</code> - If true, apply the calculated weight/bias updates immediately. If false, accumulate them in <code>totalDelta*</code> properties for batch updates.</li>
1355
+ <li><code>regularization</code> - The regularization setting. Can be:</li>
1356
+ <li>number (L2 lambda)</li>
1357
+ <li>{ type: &#39;L1&#39;|&#39;L2&#39;, lambda: number }</li>
1358
+ <li>(weight: number) =&gt; number (custom function)</li>
1359
+ <li><code>target</code> - The target output value for this node. Only used if the node is of type &#39;output&#39;.</li>
1360
+ </ul>
1361
+ <h4 id="propagate">propagate</h4><p><code>(rate: number, momentum: number, target: number[] | undefined) =&gt; void</code></p>
1362
+ <p>Propagates the error backward through all nodes in the layer.</p>
1363
+ <p>This is a core step in the backpropagation algorithm used for training.
1364
+ If a <code>target</code> array is provided (typically for the output layer), it&#39;s used
1365
+ to calculate the initial error for each node. Otherwise, nodes calculate
1366
+ their error based on the error propagated from subsequent layers.</p>
1367
+ <p>Parameters:</p>
1368
+ <ul>
1369
+ <li><code>rate</code> - - The learning rate, controlling the step size of weight adjustments.</li>
1370
+ <li><code>momentum</code> - - The momentum factor, used to smooth weight updates and escape local minima.</li>
1371
+ <li><code>target</code> - - An optional array of target values (expected outputs) for the layer&#39;s nodes. The length must match the number of nodes.</li>
1372
+ <li>`` - - The learning rate to apply during weight updates.</li>
1373
+ </ul>
1374
+ <h4 id="prunetosparsity">pruneToSparsity</h4><p><code>(targetSparsity: number, method: &quot;magnitude&quot; | &quot;snip&quot;) =&gt; void</code></p>
1375
+ <p>Immediately prune connections to reach (or approach) a target sparsity fraction.
1376
+ Used by evolutionary pruning (generation-based) independent of training iteration schedule.</p>
1377
+ <p>Parameters:</p>
1378
+ <ul>
1379
+ <li><code>targetSparsity</code> - fraction in (0,1). 0.8 means keep 20% of original (if first call sets baseline)</li>
1380
+ <li><code>method</code> - &#39;magnitude&#39; | &#39;snip&#39;</li>
1381
+ </ul>
1382
+ <h4 id="random">random</h4><p><code>(input: number, hidden: number, output: number, options: { connections?: number | undefined; backconnections?: number | undefined; selfconnections?: number | undefined; gates?: number | undefined; }) =&gt; import(&quot;D:/code-practice/NeatapticTS/src/architecture/network&quot;).default</code></p>
1383
+ <p>Creates a randomly structured network based on specified node counts and connection options.</p>
1384
+ <p>This method allows for the generation of networks with a less rigid structure than MLPs.
1385
+ It initializes a network with input and output nodes and then iteratively adds hidden nodes
1386
+ and various types of connections (forward, backward, self) and gates using mutation methods.
1387
+ This approach is inspired by neuro-evolution techniques where network topology evolves.</p>
1388
+ <p>Parameters:</p>
1389
+ <ul>
1390
+ <li>`` - - The number of input nodes.</li>
1391
+ <li>`` - - The number of hidden nodes to add.</li>
1392
+ <li>`` - - The number of output nodes.</li>
1393
+ <li>`` - - Optional configuration for the network structure.</li>
1394
+ </ul>
1395
+ <p>Returns: The constructed network with a randomized topology.</p>
1396
+ <h4 id="rebuildconnections">rebuildConnections</h4><p><code>(net: import(&quot;D:/code-practice/NeatapticTS/src/architecture/network&quot;).default) =&gt; void</code></p>
1397
+ <p>Rebuilds the network&#39;s connections array from all per-node connections.
1398
+ This ensures that the network.connections array is consistent with the actual
1399
+ outgoing connections of all nodes. Useful after manual wiring or node manipulation.</p>
1400
+ <p>Parameters:</p>
1401
+ <ul>
1402
+ <li>`` - - The network instance to rebuild connections for.</li>
1403
+ </ul>
1404
+ <p>Returns: Example usage:
1405
+ Network.rebuildConnections(net);</p>
1406
+ <h4 id="release">release</h4><p><code>(conn: import(&quot;D:/code-practice/NeatapticTS/src/architecture/connection&quot;).default) =&gt; void</code></p>
1407
+ <p>Return a Connection to the pool for reuse.</p>
1408
+ <h4 id="remove">remove</h4><p><code>(node: import(&quot;D:/code-practice/NeatapticTS/src/architecture/node&quot;).default) =&gt; void</code></p>
1409
+ <p>Removes a node from the network.
1410
+ This involves:</p>
1411
+ <ol>
1412
+ <li>Disconnecting all incoming and outgoing connections associated with the node.</li>
1413
+ <li>Removing any self-connections.</li>
1414
+ <li>Removing the node from the <code>nodes</code> array.</li>
1415
+ <li>Attempting to reconnect the node&#39;s direct predecessors to its direct successors
1416
+ to maintain network flow, if possible and configured.</li>
1417
+ <li>Handling gates involving the removed node (ungating connections gated <em>by</em> this node,
1418
+ and potentially re-gating connections that were gated <em>by other nodes</em> onto the removed node&#39;s connections).</li>
1419
+ </ol>
1420
+ <p>Parameters:</p>
1421
+ <ul>
1422
+ <li>`` - - The node instance to remove. Must exist within the network&#39;s <code>nodes</code> list.</li>
1423
+ </ul>
1424
+ <h4 id="resetdropoutmasks">resetDropoutMasks</h4><p><code>() =&gt; void</code></p>
1425
+ <p>Resets all masks in the network to 1 (no dropout). Applies to both node-level and layer-level dropout.
1426
+ Should be called after training to ensure inference is unaffected by previous dropout.</p>
1427
+ <h4 id="resetnoveltyarchive">resetNoveltyArchive</h4><p><code>() =&gt; void</code></p>
1428
+ <p>Reset the novelty archive (clear entries).</p>
1429
+ <p>The novelty archive is used to keep representative behaviors for novelty
1430
+ search. Clearing it removes stored behaviors.</p>
1431
+ <h4 id="restorerngstate">restoreRNGState</h4><p><code>(state: any) =&gt; void</code></p>
1432
+ <p>Restore a previously-snapshotted RNG state. This restores the internal
1433
+ seed but does not re-create the RNG function until next use.</p>
1434
+ <p>Parameters:</p>
1435
+ <ul>
1436
+ <li><code>state</code> - Opaque numeric RNG state produced by <code>snapshotRNGState()</code>.</li>
1437
+ </ul>
1438
+ <h4 id="samplerandom">sampleRandom</h4><p><code>(count: number) =&gt; number[]</code></p>
1439
+ <p>Produce <code>count</code> deterministic random samples using instance RNG.</p>
1440
+ <h4 id="selectmutationmethod">selectMutationMethod</h4><p><code>(genome: import(&quot;D:/code-practice/NeatapticTS/src/architecture/network&quot;).default, rawReturnForTest: boolean) =&gt; any</code></p>
1441
+ <p>Selects a mutation method for a given genome based on constraints.
1442
+ Ensures that the mutation respects the maximum nodes, connections, and gates.</p>
1443
+ <p>Parameters:</p>
1444
+ <ul>
1445
+ <li><code>genome</code> - - The genome to mutate.</li>
1446
+ </ul>
1447
+ <p>Returns: The selected mutation method or null if no valid method is available.</p>
1448
+ <h4 id="serialize">serialize</h4><p><code>() =&gt; any[]</code></p>
1449
+ <p>Lightweight tuple serializer delegating to network.serialize.ts</p>
1450
+ <h4 id="set">set</h4><p><code>(values: { bias?: number | undefined; squash?: any; }) =&gt; void</code></p>
1451
+ <p>Sets specified properties (e.g., bias, squash function) for all nodes in the network.
1452
+ Useful for initializing or resetting node properties uniformly.</p>
1453
+ <p>Parameters:</p>
1454
+ <ul>
1455
+ <li>`` - - An object containing the properties and values to set.</li>
1456
+ </ul>
1457
+ <h4 id="set">set</h4><p><code>(values: { bias?: number | undefined; squash?: any; type?: string | undefined; }) =&gt; void</code></p>
1458
+ <p>Configures properties for all nodes within the layer.</p>
1459
+ <p>Allows batch setting of common node properties like bias, activation function (<code>squash</code>),
1460
+ or node type. If a node within the <code>nodes</code> array is actually a <code>Group</code> (e.g., in memory layers),
1461
+ the configuration is applied recursively to the nodes within that group.</p>
1462
+ <p>Parameters:</p>
1463
+ <ul>
1464
+ <li><code>values</code> - - An object containing the properties and their values to set.
1465
+ Example: <code>{ bias: 0.5, squash: methods.Activation.ReLU }</code></li>
1466
+ <li>`` - - An object containing the properties and their new values. Only provided properties are updated.
1467
+ <code>bias</code>: Sets the bias term for all nodes.
1468
+ <code>squash</code>: Sets the activation function (squashing function) for all nodes.
1469
+ <code>type</code>: Sets the node type (e.g., &#39;input&#39;, &#39;hidden&#39;, &#39;output&#39;) for all nodes.</li>
1470
+ </ul>
1471
+ <h4 id="setactivation">setActivation</h4><p><code>(fn: (x: number, derivate?: boolean | undefined) =&gt; number) =&gt; void</code></p>
1472
+ <p>Sets a custom activation function for this node at runtime.</p>
1473
+ <p>Parameters:</p>
1474
+ <ul>
1475
+ <li><code>fn</code> - The activation function (should handle derivative if needed).</li>
1476
+ </ul>
1477
+ <h4 id="setstochasticdepth">setStochasticDepth</h4><p><code>(survival: number[]) =&gt; void</code></p>
1478
+ <p>Configure stochastic depth with survival probabilities per hidden layer (length must match hidden layer count when using layered network).</p>
1479
+ <h4 id="snapshotrngstate">snapshotRNGState</h4><p><code>() =&gt; number | undefined</code></p>
1480
+ <p>Return the current opaque RNG numeric state used by the instance.
1481
+ Useful for deterministic test replay and debugging.</p>
1482
+ <h4 id="sort">sort</h4><p><code>() =&gt; void</code></p>
1483
+ <p>Sorts the population in descending order of fitness scores.
1484
+ Ensures that the fittest genomes are at the start of the population array.</p>
1485
+ <h4 id="spawnfromparent">spawnFromParent</h4><p><code>(parent: import(&quot;D:/code-practice/NeatapticTS/src/architecture/network&quot;).default, mutateCount: number) =&gt; import(&quot;D:/code-practice/NeatapticTS/src/architecture/network&quot;).default</code></p>
1486
+ <p>Spawn a new genome derived from a single parent while preserving Neat bookkeeping.</p>
1487
+ <p>This helper performs a canonical &quot;clone + slight mutation&quot; workflow while
1488
+ keeping <code>Neat</code>&#39;s internal invariants intact. It is intended for callers that
1489
+ want a child genome derived from a single parent but do not want to perform the
1490
+ bookkeeping and registration steps manually. The function deliberately does NOT
1491
+ add the returned child to <code>this.population</code> so callers are free to inspect or
1492
+ further modify the child and then register it via <code>addGenome()</code> (or push it
1493
+ directly if they understand the consequences).</p>
1494
+ <p>Behavior summary:</p>
1495
+ <ul>
1496
+ <li>Clone the provided <code>parent</code> (<code>parent.clone()</code> when available, else JSON round-trip).</li>
1497
+ <li>Clear fitness/score on the child and assign a fresh unique <code>_id</code>.</li>
1498
+ <li>If lineage tracking is enabled, set <code>(child as any)._parents = [parent._id]</code>
1499
+ and <code>(child as any)._depth = (parent._depth ?? 0) + 1</code>.</li>
1500
+ <li>Enforce structural invariants by calling <code>ensureMinHiddenNodes(child)</code> and
1501
+ <code>ensureNoDeadEnds(child)</code> so the child is valid for subsequent mutation/evaluation.</li>
1502
+ <li>Apply <code>mutateCount</code> mutations selected via <code>selectMutationMethod</code> and driven by
1503
+ the instance RNG (<code>_getRNG()</code>); mutation exceptions are caught and ignored to
1504
+ preserve best-effort behavior during population seeding/expansion.</li>
1505
+ <li>Invalidate per-genome caches with <code>_invalidateGenomeCaches(child)</code> before return.</li>
1506
+ </ul>
1507
+ <p>Important: the returned child is not registered in <code>Neat.population</code> — call
1508
+ <code>addGenome(child, [parentId])</code> to insert it and keep telemetry/lineage consistent.</p>
1509
+ <p>Parameters:</p>
1510
+ <ul>
1511
+ <li><code>parent</code> - - Source genome to derive from. Must be a <code>Network</code> instance.</li>
1512
+ <li><code>mutateCount</code> - - Number of mutation operations to apply to the spawned child (default: 1).</li>
1513
+ </ul>
1514
+ <p>Returns: A new <code>Network</code> instance derived from <code>parent</code>. The child is unregistered.</p>
1515
+ <h4 id="squash">squash</h4><p><code>(x: number, derivate: boolean | undefined) =&gt; number</code></p>
1516
+ <p>The activation function (squashing function) applied to the node&#39;s state.
1517
+ Maps the internal state to the node&#39;s output (activation).</p>
1518
+ <p>Parameters:</p>
1519
+ <ul>
1520
+ <li><code>x</code> - The node&#39;s internal state (sum of weighted inputs + bias).</li>
1521
+ <li><code>derivate</code> - If true, returns the derivative of the function instead of the function value.</li>
1522
+ </ul>
1523
+ <p>Returns: The activation value or its derivative.</p>
1524
+ <h4 id="state">state</h4><p>The internal state of the node (sum of weighted inputs + bias) before the activation function is applied.</p>
1525
+ <h4 id="test">test</h4><p><code>(set: { input: number[]; output: number[]; }[], cost: any) =&gt; { error: number; time: number; }</code></p>
1526
+ <p>Tests the network&#39;s performance on a given dataset.
1527
+ Calculates the average error over the dataset using a specified cost function.
1528
+ Uses <code>noTraceActivate</code> for efficiency as gradients are not needed.
1529
+ Handles dropout scaling if dropout was used during training.</p>
1530
+ <p>Parameters:</p>
1531
+ <ul>
1532
+ <li>`` - - The test dataset, an array of objects with <code>input</code> and <code>output</code> arrays.</li>
1533
+ <li>`` - - The cost function to evaluate the error. Defaults to Mean Squared Error.</li>
1534
+ </ul>
1535
+ <p>Returns: An object containing the calculated average error over the dataset and the time taken for the test in milliseconds.</p>
1536
+ <h4 id="tojson">toJSON</h4><p><code>() =&gt; any</code></p>
1537
+ <p>Import a previously exported state bundle and rehydrate a Neat instance.</p>
1538
+ <h4 id="tojson">toJSON</h4><p><code>() =&gt; object</code></p>
1539
+ <p>Converts the network into a JSON object representation (latest standard).
1540
+ Includes formatVersion, and only serializes properties needed for full reconstruction.
1541
+ All references are by index. Excludes runtime-only properties (activation, state, traces).</p>
1542
+ <p>Returns: A JSON-compatible object representing the network.</p>
1543
+ <h4 id="tojson">toJSON</h4><p><code>() =&gt; { index: number | undefined; bias: number; type: string; squash: string | null; mask: number; }</code></p>
1544
+ <p>Converts the node&#39;s essential properties to a JSON object for serialization.
1545
+ Does not include state, activation, error, or connection information, as these
1546
+ are typically transient or reconstructed separately.</p>
1547
+ <p>Returns: A JSON representation of the node&#39;s configuration.</p>
1548
+ <h4 id="tojson">toJSON</h4><p><code>() =&gt; { size: number; nodeIndices: (number | undefined)[]; connections: { in: number; out: number; self: number; }; }</code></p>
1549
+ <p>Serializes the group into a JSON-compatible format, avoiding circular references.
1550
+ Only includes node indices and connection counts.</p>
1551
+ <p>Returns: A JSON-compatible representation of the group.</p>
1552
+ <h4 id="toonnx">toONNX</h4><p><code>() =&gt; import(&quot;D:/code-practice/NeatapticTS/src/architecture/network/network.onnx&quot;).OnnxModel</code></p>
1553
+ <p>Exports the network to ONNX format (JSON object, minimal MLP support).
1554
+ Only standard feedforward architectures and standard activations are supported.
1555
+ Gating, custom activations, and evolutionary features are ignored or replaced with Identity.</p>
1556
+ <p>Returns: ONNX model as a JSON object.</p>
1557
+ <h4 id="totaldeltabias">totalDeltaBias</h4><p>Accumulates changes in bias over a mini-batch during batch training. Reset after each weight update.</p>
1558
+ <h4 id="type">type</h4><p>The type of the node: &#39;input&#39;, &#39;hidden&#39;, or &#39;output&#39;.
1559
+ Determines behavior (e.g., input nodes don&#39;t have biases modified typically, output nodes calculate error differently).</p>
1560
+ <h4 id="ungate">ungate</h4><p><code>(connection: import(&quot;D:/code-practice/NeatapticTS/src/architecture/connection&quot;).default) =&gt; void</code></p>
1561
+ <p>Removes the gate from a specified connection.
1562
+ The connection will no longer be modulated by its gater node.
1563
+ Removes the connection from the network&#39;s <code>gates</code> list.</p>
1564
+ <p>Parameters:</p>
1565
+ <ul>
1566
+ <li>`` - - The connection object to ungate.</li>
1567
+ </ul>
1568
+ <h4 id="ungate">ungate</h4><p><code>(connections: import(&quot;D:/code-practice/NeatapticTS/src/architecture/connection&quot;).default | import(&quot;D:/code-practice/NeatapticTS/src/architecture/connection&quot;).default[]) =&gt; void</code></p>
1569
+ <p>Removes this node&#39;s gating control over the specified connection(s).
1570
+ Resets the connection&#39;s gain to 1 and removes it from the <code>connections.gated</code> list.</p>
1571
+ <p>Parameters:</p>
1572
+ <ul>
1573
+ <li><code>connections</code> - A single Connection object or an array of Connection objects to ungate.</li>
1574
+ </ul>
1575
+
1576
+ <footer>Generated from JSDoc. <a href="https://github.com/reicek/NeatapticTS">GitHub</a></footer>
1577
+ </main>
1578
+ <aside class="page-index"><div class="page-toc"><h2>Files</h2><div class="toc-file"><a href="#config-ts">config.ts</a><ul><li><a href=#config>config</a></li><li><a href=#neatapticconfig>NeatapticConfig</a></li></ul></div><div class="toc-file"><a href="#neat-ts">neat.ts</a><ul><li><a href=#neat>neat</a></li><li><a href=#neatoptions>NeatOptions</a></li><li><a href=#options>Options</a></li><li><a href=#default>default</a></li></ul></div><div class="toc-file"><a href="#neataptic-ts">neataptic.ts</a><ul><li><a href=#neataptic>neataptic</a></li><li><a href=#default>default</a></li></ul></div></div></aside>
1579
+ </body></html>