@reicek/neataptic-ts 0.1.25 → 0.1.26

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 (210) hide show
  1. package/.github/copilot-instructions.md +11 -0
  2. package/.github/skills/trace-analyzer-extension/SKILL.md +3 -3
  3. package/.github/skills/trace-analyzer-extension/assets/extension-checklist.md +1 -1
  4. package/.github/skills/trace-analyzer-extension/references/analyzer-extension-workflow.md +1 -1
  5. package/.github/skills/trace-audit-reporting/SKILL.md +3 -3
  6. package/.github/skills/trace-audit-reporting/references/trace-analysis-workflow.md +1 -1
  7. package/package.json +19 -13
  8. package/plans/Flappy_Bird_Folder_Documentation_Pass.md +4 -4
  9. package/plans/README.md +24 -0
  10. package/plans/Roadmap.md +62 -40
  11. package/plans/analyze-trace-solid-split.plans.md +66 -0
  12. package/plans/architecture-solid-split.plans.md +9 -15
  13. package/plans/asciiMaze-typescript-repair.plans.md +1 -1
  14. package/plans/generate-docs-solid-split.plans.md +87 -0
  15. package/plans/methods-docs.plans.md +25 -1
  16. package/plans/methods-solid-split.plans.md +14 -14
  17. package/plans/neat-docs.plans.md +9 -1
  18. package/plans/neat-test-surface-repair.plans.md +1 -1
  19. package/plans/render-docs-html-solid-split.plans.md +68 -0
  20. package/plans/src-no-explicit-any-cleanup.plans.md +1 -1
  21. package/plans/utils-docs.plans.md +6 -1
  22. package/scripts/analyze-trace/analyze-trace.analysis.ts +479 -0
  23. package/scripts/analyze-trace/analyze-trace.constants.ts +35 -0
  24. package/scripts/analyze-trace/analyze-trace.io.ts +69 -0
  25. package/scripts/analyze-trace/analyze-trace.report.ts +100 -0
  26. package/scripts/analyze-trace/analyze-trace.shared.ts +116 -0
  27. package/scripts/analyze-trace/analyze-trace.ts +45 -0
  28. package/scripts/analyze-trace/analyze-trace.types.ts +72 -0
  29. package/scripts/assets/theme.css +80 -23
  30. package/scripts/copy-examples.ts +239 -0
  31. package/scripts/export-onnx.ts +223 -0
  32. package/scripts/generate-bench-tables.ts +378 -37
  33. package/scripts/generate-docs/generate-docs.constants.ts +107 -0
  34. package/scripts/generate-docs/generate-docs.order.ts +355 -0
  35. package/scripts/generate-docs/generate-docs.state.ts +31 -0
  36. package/scripts/generate-docs/generate-docs.targets.ts +165 -0
  37. package/scripts/generate-docs/generate-docs.ts +63 -0
  38. package/scripts/generate-docs/generate-docs.types.ts +112 -0
  39. package/scripts/generate-docs/output/generate-docs.output.folder-index.utils.ts +167 -0
  40. package/scripts/generate-docs/output/generate-docs.output.ordering.utils.ts +353 -0
  41. package/scripts/generate-docs/output/generate-docs.output.readme.utils.ts +420 -0
  42. package/scripts/generate-docs/output/generate-docs.output.ts +123 -0
  43. package/scripts/generate-docs/output/generate-docs.output.warnings.utils.ts +219 -0
  44. package/scripts/generate-docs/symbols/generate-docs.symbols.collection.utils.ts +365 -0
  45. package/scripts/generate-docs/symbols/generate-docs.symbols.jsdoc.utils.ts +373 -0
  46. package/scripts/generate-docs/symbols/generate-docs.symbols.normalize.utils.ts +155 -0
  47. package/scripts/generate-docs/symbols/generate-docs.symbols.render.utils.ts +149 -0
  48. package/scripts/generate-docs/symbols/generate-docs.symbols.signature.utils.ts +289 -0
  49. package/scripts/generate-docs/symbols/generate-docs.symbols.ts +11 -0
  50. package/scripts/mermaid-cli.mjs +102 -22
  51. package/scripts/mermaid-cli.ts +736 -0
  52. package/scripts/render-docs-html/render-docs-html.assets.ts +54 -0
  53. package/scripts/render-docs-html/render-docs-html.mermaid.ts +245 -0
  54. package/scripts/{render-docs-html.sidebar.ts → render-docs-html/render-docs-html.navigation.ts} +141 -144
  55. package/scripts/render-docs-html/render-docs-html.pages.ts +333 -0
  56. package/scripts/render-docs-html/render-docs-html.shared.ts +333 -0
  57. package/scripts/render-docs-html/render-docs-html.types.ts +42 -0
  58. package/scripts/render-docs-html.ts +23 -587
  59. package/scripts/run-docs.ts +238 -0
  60. package/scripts/write-dist-docs-pkg.ts +40 -0
  61. package/src/README.md +75 -75
  62. package/src/architecture/connection/README.md +5 -5
  63. package/src/architecture/layer/README.md +508 -508
  64. package/src/architecture/network/README.md +1458 -1458
  65. package/src/architecture/network/activate/README.md +694 -694
  66. package/src/architecture/network/bootstrap/README.md +77 -77
  67. package/src/architecture/network/connect/README.md +74 -74
  68. package/src/architecture/network/deterministic/README.md +135 -135
  69. package/src/architecture/network/evolve/README.md +364 -364
  70. package/src/architecture/network/gating/README.md +130 -130
  71. package/src/architecture/network/genetic/README.md +399 -399
  72. package/src/architecture/network/mutate/README.md +897 -897
  73. package/src/architecture/network/onnx/README.md +720 -720
  74. package/src/architecture/network/onnx/export/README.md +728 -728
  75. package/src/architecture/network/onnx/export/layers/README.md +450 -450
  76. package/src/architecture/network/onnx/import/README.md +618 -618
  77. package/src/architecture/network/onnx/schema/README.md +32 -32
  78. package/src/architecture/network/prune/README.md +245 -245
  79. package/src/architecture/network/remove/README.md +135 -135
  80. package/src/architecture/network/runtime/README.md +106 -106
  81. package/src/architecture/network/serialize/README.md +542 -542
  82. package/src/architecture/network/slab/README.md +608 -608
  83. package/src/architecture/network/standalone/README.md +212 -212
  84. package/src/architecture/network/stats/README.md +84 -84
  85. package/src/architecture/network/topology/README.md +465 -465
  86. package/src/architecture/network/training/README.md +200 -200
  87. package/src/architecture/node/README.md +5 -5
  88. package/src/architecture/nodePool/README.md +14 -14
  89. package/src/methods/README.md +99 -99
  90. package/src/methods/activation/README.md +189 -189
  91. package/src/methods/cost/README.md +131 -131
  92. package/src/methods/rate/README.md +86 -86
  93. package/src/multithreading/README.md +77 -77
  94. package/src/multithreading/workers/browser/README.md +8 -8
  95. package/src/multithreading/workers/node/README.md +8 -8
  96. package/src/neat/README.md +148 -148
  97. package/src/neat/adaptive/README.md +120 -120
  98. package/src/neat/adaptive/acceptance/README.md +40 -40
  99. package/src/neat/adaptive/complexity/README.md +137 -137
  100. package/src/neat/adaptive/core/README.md +197 -197
  101. package/src/neat/adaptive/lineage/README.md +90 -90
  102. package/src/neat/adaptive/mutation/README.md +284 -284
  103. package/src/neat/compat/README.md +43 -43
  104. package/src/neat/compat/core/README.md +90 -90
  105. package/src/neat/diversity/README.md +35 -35
  106. package/src/neat/diversity/core/README.md +88 -88
  107. package/src/neat/evaluate/README.md +85 -85
  108. package/src/neat/evaluate/auto-distance/README.md +75 -75
  109. package/src/neat/evaluate/entropy-compat/README.md +37 -37
  110. package/src/neat/evaluate/entropy-sharing/README.md +43 -43
  111. package/src/neat/evaluate/fitness/README.md +23 -23
  112. package/src/neat/evaluate/novelty/README.md +120 -120
  113. package/src/neat/evaluate/objectives/README.md +17 -17
  114. package/src/neat/evaluate/shared/README.md +94 -94
  115. package/src/neat/evolve/README.md +96 -96
  116. package/src/neat/evolve/adaptive/README.md +60 -60
  117. package/src/neat/evolve/objectives/README.md +63 -63
  118. package/src/neat/evolve/offspring/README.md +56 -56
  119. package/src/neat/evolve/population/README.md +171 -171
  120. package/src/neat/evolve/runtime/README.md +79 -79
  121. package/src/neat/evolve/speciation/README.md +74 -74
  122. package/src/neat/evolve/warnings/README.md +10 -10
  123. package/src/neat/export/README.md +114 -114
  124. package/src/neat/helpers/README.md +50 -50
  125. package/src/neat/init/README.md +9 -9
  126. package/src/neat/lineage/core/README.md +101 -101
  127. package/src/neat/multiobjective/category/README.md +74 -74
  128. package/src/neat/multiobjective/crowding/README.md +272 -272
  129. package/src/neat/multiobjective/dominance/README.md +171 -171
  130. package/src/neat/multiobjective/fronts/README.md +68 -68
  131. package/src/neat/multiobjective/metrics/README.md +43 -43
  132. package/src/neat/multiobjective/objectives/README.md +31 -31
  133. package/src/neat/multiobjective/shared/README.md +27 -27
  134. package/src/neat/mutation/README.md +97 -97
  135. package/src/neat/mutation/add-conn/README.md +115 -115
  136. package/src/neat/mutation/add-node/README.md +126 -126
  137. package/src/neat/mutation/flow/README.md +149 -149
  138. package/src/neat/mutation/repair/README.md +185 -185
  139. package/src/neat/mutation/select/README.md +117 -117
  140. package/src/neat/mutation/shared/README.md +32 -32
  141. package/src/neat/objectives/README.md +25 -25
  142. package/src/neat/objectives/core/README.md +67 -67
  143. package/src/neat/pruning/README.md +40 -40
  144. package/src/neat/pruning/core/README.md +171 -171
  145. package/src/neat/pruning/facade/README.md +32 -32
  146. package/src/neat/rng/README.md +104 -104
  147. package/src/neat/rng/core/README.md +137 -137
  148. package/src/neat/rng/facade/README.md +50 -50
  149. package/src/neat/selection/README.md +111 -111
  150. package/src/neat/selection/core/README.md +227 -227
  151. package/src/neat/selection/facade/README.md +61 -61
  152. package/src/neat/shared/README.md +163 -163
  153. package/src/neat/speciation/README.md +31 -31
  154. package/src/neat/speciation/threshold/README.md +35 -35
  155. package/src/neat/species/README.md +25 -25
  156. package/src/neat/species/core/README.md +20 -20
  157. package/src/neat/species/core/shared/README.md +18 -18
  158. package/src/neat/species/history/context/README.md +22 -22
  159. package/src/neat/telemetry/accessors/README.md +58 -58
  160. package/src/neat/telemetry/exports/README.md +233 -233
  161. package/src/neat/telemetry/facade/README.md +252 -252
  162. package/src/neat/telemetry/facade/archive/README.md +57 -57
  163. package/src/neat/telemetry/facade/buffer/README.md +43 -43
  164. package/src/neat/telemetry/facade/lineage/README.md +12 -12
  165. package/src/neat/telemetry/facade/objectives/README.md +44 -44
  166. package/src/neat/telemetry/facade/runtime/README.md +26 -26
  167. package/src/neat/telemetry/facade/species/README.md +27 -27
  168. package/src/neat/telemetry/metrics/README.md +696 -696
  169. package/src/neat/telemetry/recorder/README.md +57 -57
  170. package/src/neat/telemetry/types/README.md +32 -32
  171. package/src/neat/topology-intent/README.md +75 -75
  172. package/src/utils/README.md +193 -193
  173. package/test/examples/asciiMaze/browser-entry/README.md +92 -92
  174. package/test/examples/asciiMaze/dashboardManager/README.md +109 -109
  175. package/test/examples/asciiMaze/dashboardManager/telemetry/README.md +28 -28
  176. package/test/examples/asciiMaze/evolutionEngine/README.md +1527 -1527
  177. package/test/examples/asciiMaze/mazeMovement/README.md +105 -105
  178. package/test/examples/asciiMaze/mazeMovement/finalization/README.md +16 -16
  179. package/test/examples/asciiMaze/mazeMovement/policy/README.md +57 -57
  180. package/test/examples/asciiMaze/mazeMovement/runtime/README.md +52 -52
  181. package/test/examples/asciiMaze/mazeMovement/shaping/README.md +46 -46
  182. package/test/examples/flappy_bird/browser-entry/README.md +508 -508
  183. package/test/examples/flappy_bird/browser-entry/host/README.md +101 -101
  184. package/test/examples/flappy_bird/browser-entry/host/resize/README.md +144 -144
  185. package/test/examples/flappy_bird/browser-entry/network-view/README.md +194 -194
  186. package/test/examples/flappy_bird/browser-entry/playback/README.md +278 -278
  187. package/test/examples/flappy_bird/browser-entry/playback/background/README.md +129 -129
  188. package/test/examples/flappy_bird/browser-entry/playback/background/ground-grid/README.md +502 -502
  189. package/test/examples/flappy_bird/browser-entry/playback/frame-render/README.md +139 -139
  190. package/test/examples/flappy_bird/browser-entry/playback/snapshot/README.md +10 -10
  191. package/test/examples/flappy_bird/browser-entry/playback/trail/README.md +43 -43
  192. package/test/examples/flappy_bird/browser-entry/playback/worker-channel/README.md +30 -30
  193. package/test/examples/flappy_bird/browser-entry/runtime/README.md +59 -59
  194. package/test/examples/flappy_bird/browser-entry/visualization/README.md +276 -276
  195. package/test/examples/flappy_bird/browser-entry/worker-channel/README.md +16 -16
  196. package/test/examples/flappy_bird/constants/README.md +1070 -1070
  197. package/test/examples/flappy_bird/environment/README.md +22 -22
  198. package/test/examples/flappy_bird/evaluation/README.md +32 -32
  199. package/test/examples/flappy_bird/evaluation/rollout/README.md +141 -141
  200. package/test/examples/flappy_bird/flappy-evolution-worker/README.md +425 -425
  201. package/test/examples/flappy_bird/simulation-shared/README.md +170 -170
  202. package/test/examples/flappy_bird/simulation-shared/observation/README.md +109 -109
  203. package/test/examples/flappy_bird/trainer/README.md +325 -325
  204. package/test/examples/flappy_bird/trainer/evaluation/README.md +74 -74
  205. package/scripts/analyze-trace.ts +0 -590
  206. package/scripts/copy-examples.mjs +0 -114
  207. package/scripts/export-onnx.mjs +0 -86
  208. package/scripts/generate-bench-tables.mjs +0 -182
  209. package/scripts/generate-docs.ts +0 -2900
  210. package/scripts/write-dist-docs-pkg.mjs +0 -16
@@ -17,22 +17,9 @@ Notes:
17
17
 
18
18
  ## architecture/network/training/network.training.utils.types.ts
19
19
 
20
- ### resolveEmaAlpha
21
-
22
- ```ts
23
- resolveEmaAlpha(
24
- smoothingWindow: number,
25
- explicitAlpha: number | undefined,
26
- ): number
27
- ```
28
-
29
- Resolve default EMA alpha using a window length.
30
-
31
- Parameters:
32
- - `smoothingWindow` - - Window length for moving average operations.
33
- - `explicitAlpha` - - Optional user-provided alpha override.
20
+ ### ALLOWED_OPTIMIZERS
34
21
 
35
- Returns: A valid EMA alpha in the range (0, 1].
22
+ Set of supported optimizer identifiers accepted by training options.
36
23
 
37
24
  ### buildMonitoredSmoothingConfig
38
25
 
@@ -55,14 +42,6 @@ Parameters:
55
42
 
56
43
  Returns: Normalized monitored smoothing configuration.
57
44
 
58
- ### NetworkNode
59
-
60
- Local node shape alias used by training utility modules.
61
-
62
- ### RegularizationArgument
63
-
64
- Regularization argument accepted by node-level propagation.
65
-
66
45
  ### CostDerivative
67
46
 
68
47
  ```ts
@@ -74,6 +53,14 @@ CostDerivative(
74
53
 
75
54
  Cost-derivative callback shape for output-node backpropagation.
76
55
 
56
+ ### GradientClipRuntimeConfig
57
+
58
+ Runtime gradient clipping configuration normalized from training options.
59
+
60
+ ### NetworkNode
61
+
62
+ Local node shape alias used by training utility modules.
63
+
77
64
  ### OutputNodeWithCostDerivative
78
65
 
79
66
  Extended output-node contract that supports custom cost derivatives.
@@ -82,19 +69,41 @@ Extended output-node contract that supports custom cost derivatives.
82
69
 
83
70
  Shared immutable context for network propagation helpers.
84
71
 
72
+ ### RegularizationArgument
73
+
74
+ Regularization argument accepted by node-level propagation.
75
+
76
+ ### resolveEmaAlpha
77
+
78
+ ```ts
79
+ resolveEmaAlpha(
80
+ smoothingWindow: number,
81
+ explicitAlpha: number | undefined,
82
+ ): number
83
+ ```
84
+
85
+ Resolve default EMA alpha using a window length.
86
+
87
+ Parameters:
88
+ - `smoothingWindow` - - Window length for moving average operations.
89
+ - `explicitAlpha` - - Optional user-provided alpha override.
90
+
91
+ Returns: A valid EMA alpha in the range (0, 1].
92
+
85
93
  ### TrainingSample
86
94
 
87
95
  Training sample consumed by training set loops.
88
96
 
89
- ### GradientClipRuntimeConfig
97
+ ## architecture/network/training/network.training.utils.ts
90
98
 
91
- Runtime gradient clipping configuration normalized from training options.
99
+ ### __trainingInternals
92
100
 
93
- ### ALLOWED_OPTIMIZERS
101
+ Test-only internal helper bundle.
94
102
 
95
- Set of supported optimizer identifiers accepted by training options.
103
+ This is exported so unit tests can cover edge-cases in the smoothing logic without
104
+ running full end-to-end training loops.
96
105
 
97
- ## architecture/network/training/network.training.utils.ts
106
+ Important: this is **not** considered stable public API. It may change between releases.
98
107
 
99
108
  ### applyGradientClippingImpl
100
109
 
@@ -113,91 +122,12 @@ Parameters:
113
122
  - `net` - - Network instance to update.
114
123
  - `cfg` - - Normalized clipping settings.
115
124
 
116
- ### trainSetImpl
117
-
118
- ```ts
119
- trainSetImpl(
120
- net: default,
121
- set: TrainingSample[],
122
- batchSize: number,
123
- accumulationSteps: number,
124
- currentRate: number,
125
- momentum: number,
126
- regularization: RegularizationConfig,
127
- costFunction: CostFunction | CostFunctionOrObject,
128
- optimizer: OptimizerConfigBase | undefined,
129
- ): number
130
- ```
131
-
132
- Execute one full pass over dataset (epoch) with optional accumulation & adaptive optimizer.
133
- Returns mean cost across processed samples.
134
-
135
- This is the core "one epoch" primitive used by higher-level training orchestration.
136
-
137
- Parameters:
138
- - `net` - - Network instance receiving training updates.
139
- - `set` - - Training samples.
140
- - `batchSize` - - Mini-batch size (use 1 for pure SGD).
141
- - `accumulationSteps` - - Micro-batch accumulation steps.
142
- - `currentRate` - - Current learning rate (may be scheduled by caller).
143
- - `momentum` - - Momentum used by some optimizers (when applicable).
144
- - `regularization` - - Regularization configuration passed down to nodes.
145
- - `costFunction` - - Cost function selector (function or compatible object).
146
- - `optimizer` - - Optional optimizer configuration.
147
-
148
- Returns: Mean cost across the processed samples.
149
-
150
- ### trainImpl
151
-
152
- ```ts
153
- trainImpl(
154
- net: default,
155
- set: TrainingSample[],
156
- options: TrainingOptions,
157
- ): { error: number; iterations: number; time: number; }
158
- ```
159
-
160
- High-level training orchestration with early stopping, smoothing & callbacks.
161
-
162
- This is the main entrypoint used by `Network.train(...)`-style APIs.
163
-
164
- Parameters:
165
- - `net` - - Network instance to train.
166
- - `set` - - Training dataset.
167
- - `options` - - Training options (stopping conditions, optimizer, hooks, etc.).
168
-
169
- Returns: Summary payload containing final error, iteration count, and elapsed time.
170
-
171
- Example:
172
-
173
- ```ts
174
- const result = net.train(set, { iterations: 500, rate: 0.3 });
175
- console.log(result.error);
176
- ```
177
-
178
- ### propagate
179
-
180
- ```ts
181
- propagate(
182
- rate: number,
183
- momentum: number,
184
- update: boolean,
185
- target: number[],
186
- regularization: number,
187
- costDerivative: CostDerivative | undefined,
188
- ): void
189
- ```
125
+ ### CheckpointConfig
190
126
 
191
- Propagate output and hidden errors backward through the network.
127
+ Checkpoint callback configuration.
192
128
 
193
- Parameters:
194
- - `this` - Bound network instance.
195
- - `rate` - Learning rate.
196
- - `momentum` - Momentum factor.
197
- - `update` - Whether to apply updates immediately.
198
- - `target` - Output target values.
199
- - `regularization` - L2 regularization factor.
200
- - `costDerivative` - Optional output-node derivative override.
129
+ Training can periodically call `save(...)` with a serialized network snapshot.
130
+ You can persist these snapshots to disk, upload them, or keep them in-memory.
201
131
 
202
132
  ### clearState
203
133
 
@@ -210,13 +140,6 @@ Clear all node runtime traces and states.
210
140
  Parameters:
211
141
  - `this` - Bound network instance.
212
142
 
213
- ### CheckpointConfig
214
-
215
- Checkpoint callback configuration.
216
-
217
- Training can periodically call `save(...)` with a serialized network snapshot.
218
- You can persist these snapshots to disk, upload them, or keep them in-memory.
219
-
220
143
  ### CostFunction
221
144
 
222
145
  ```ts
@@ -316,6 +239,30 @@ Notes:
316
239
  - Exact supported `type` values are validated by training utilities.
317
240
  - Unspecified fields fall back to sensible defaults per optimizer.
318
241
 
242
+ ### propagate
243
+
244
+ ```ts
245
+ propagate(
246
+ rate: number,
247
+ momentum: number,
248
+ update: boolean,
249
+ target: number[],
250
+ regularization: number,
251
+ costDerivative: CostDerivative | undefined,
252
+ ): void
253
+ ```
254
+
255
+ Propagate output and hidden errors backward through the network.
256
+
257
+ Parameters:
258
+ - `this` - Bound network instance.
259
+ - `rate` - Learning rate.
260
+ - `momentum` - Momentum factor.
261
+ - `update` - Whether to apply updates immediately.
262
+ - `target` - Output target values.
263
+ - `regularization` - L2 regularization factor.
264
+ - `costDerivative` - Optional output-node derivative override.
265
+
319
266
  ### ScheduleConfig
320
267
 
321
268
  Schedule callback configuration.
@@ -330,6 +277,34 @@ Serialized network payload used in checkpoint callbacks.
330
277
  This is intentionally loose: serialization formats evolve and may include nested
331
278
  structures. Treat this as an opaque snapshot blob.
332
279
 
280
+ ### trainImpl
281
+
282
+ ```ts
283
+ trainImpl(
284
+ net: default,
285
+ set: TrainingSample[],
286
+ options: TrainingOptions,
287
+ ): { error: number; iterations: number; time: number; }
288
+ ```
289
+
290
+ High-level training orchestration with early stopping, smoothing & callbacks.
291
+
292
+ This is the main entrypoint used by `Network.train(...)`-style APIs.
293
+
294
+ Parameters:
295
+ - `net` - - Network instance to train.
296
+ - `set` - - Training dataset.
297
+ - `options` - - Training options (stopping conditions, optimizer, hooks, etc.).
298
+
299
+ Returns: Summary payload containing final error, iteration count, and elapsed time.
300
+
301
+ Example:
302
+
303
+ ```ts
304
+ const result = net.train(set, { iterations: 500, rate: 0.3 });
305
+ console.log(result.error);
306
+ ```
307
+
333
308
  ### TrainingOptions
334
309
 
335
310
  Public training options accepted by the high-level training orchestration.
@@ -355,14 +330,39 @@ Stopping conditions:
355
330
  - Provide at least one of `iterations` or `error`.
356
331
  - `earlyStopPatience` adds an additional "stop when no improvement" guard.
357
332
 
358
- ### __trainingInternals
333
+ ### trainSetImpl
359
334
 
360
- Test-only internal helper bundle.
335
+ ```ts
336
+ trainSetImpl(
337
+ net: default,
338
+ set: TrainingSample[],
339
+ batchSize: number,
340
+ accumulationSteps: number,
341
+ currentRate: number,
342
+ momentum: number,
343
+ regularization: RegularizationConfig,
344
+ costFunction: CostFunction | CostFunctionOrObject,
345
+ optimizer: OptimizerConfigBase | undefined,
346
+ ): number
347
+ ```
361
348
 
362
- This is exported so unit tests can cover edge-cases in the smoothing logic without
363
- running full end-to-end training loops.
349
+ Execute one full pass over dataset (epoch) with optional accumulation & adaptive optimizer.
350
+ Returns mean cost across processed samples.
364
351
 
365
- Important: this is **not** considered stable public API. It may change between releases.
352
+ This is the core "one epoch" primitive used by higher-level training orchestration.
353
+
354
+ Parameters:
355
+ - `net` - - Network instance receiving training updates.
356
+ - `set` - - Training samples.
357
+ - `batchSize` - - Mini-batch size (use 1 for pure SGD).
358
+ - `accumulationSteps` - - Micro-batch accumulation steps.
359
+ - `currentRate` - - Current learning rate (may be scheduled by caller).
360
+ - `momentum` - - Momentum used by some optimizers (when applicable).
361
+ - `regularization` - - Regularization configuration passed down to nodes.
362
+ - `costFunction` - - Cost function selector (function or compatible object).
363
+ - `optimizer` - - Optional optimizer configuration.
364
+
365
+ Returns: Mean cost across the processed samples.
366
366
 
367
367
  ## architecture/network/training/network.training.loop.utils.ts
368
368
 
@@ -399,29 +399,18 @@ Returns: Mean cost over processed samples.
399
399
 
400
400
  ## architecture/network/training/network.training.backprop.utils.ts
401
401
 
402
- ### propagate
402
+ ### clearNodeState
403
403
 
404
404
  ```ts
405
- propagate(
406
- rate: number,
407
- momentum: number,
408
- update: boolean,
409
- target: number[],
410
- regularization: number,
411
- costDerivative: CostDerivative | undefined,
405
+ clearNodeState(
406
+ node: default,
412
407
  ): void
413
408
  ```
414
409
 
415
- Propagate output and hidden errors backward through the network.
410
+ Clear runtime state for a single node.
416
411
 
417
412
  Parameters:
418
- - `this` - Bound network instance.
419
- - `rate` - Learning rate.
420
- - `momentum` - Momentum factor.
421
- - `update` - Whether to apply updates immediately.
422
- - `target` - Output target values.
423
- - `regularization` - L2 regularization factor.
424
- - `costDerivative` - Optional output-node derivative override.
413
+ - `node` - Node to clear.
425
414
 
426
415
  ### clearState
427
416
 
@@ -434,21 +423,6 @@ Clear all node runtime traces and states.
434
423
  Parameters:
435
424
  - `this` - Bound network instance.
436
425
 
437
- ### validateTargetLength
438
-
439
- ```ts
440
- validateTargetLength(
441
- network: default,
442
- target: number[],
443
- ): void
444
- ```
445
-
446
- Validate that target output count matches the network output width.
447
-
448
- Parameters:
449
- - `network` - Network instance receiving backpropagation.
450
- - `target` - Output target vector.
451
-
452
426
  ### createPropagationContext
453
427
 
454
428
  ```ts
@@ -474,65 +448,87 @@ Parameters:
474
448
 
475
449
  Returns: Immutable context consumed by propagation helpers.
476
450
 
477
- ### propagateOutputLayer
451
+ ### getLastNodeIndex
478
452
 
479
453
  ```ts
480
- propagateOutputLayer(
481
- context: PropagationContext,
482
- target: number[],
483
- ): void
454
+ getLastNodeIndex(
455
+ network: default,
456
+ ): number
484
457
  ```
485
458
 
486
- Propagate all output nodes with explicit targets.
459
+ Resolve the last node index in the network.
487
460
 
488
461
  Parameters:
489
- - `context` - Shared propagation context.
490
- - `target` - Output target vector.
462
+ - `network` - Network instance.
491
463
 
492
- ### propagateHiddenLayer
464
+ Returns: Last valid node index.
465
+
466
+ ### getOutputLayerStartIndex
493
467
 
494
468
  ```ts
495
- propagateHiddenLayer(
496
- context: PropagationContext,
469
+ getOutputLayerStartIndex(
470
+ network: default,
471
+ ): number
472
+ ```
473
+
474
+ Resolve the first index of the output layer.
475
+
476
+ Parameters:
477
+ - `network` - Network instance.
478
+
479
+ Returns: Index at which output nodes begin.
480
+
481
+ ### propagate
482
+
483
+ ```ts
484
+ propagate(
485
+ rate: number,
486
+ momentum: number,
487
+ update: boolean,
488
+ target: number[],
489
+ regularization: number,
490
+ costDerivative: CostDerivative | undefined,
497
491
  ): void
498
492
  ```
499
493
 
500
- Propagate all hidden nodes in reverse topological order.
494
+ Propagate output and hidden errors backward through the network.
501
495
 
502
496
  Parameters:
503
- - `context` - Shared propagation context.
497
+ - `this` - Bound network instance.
498
+ - `rate` - Learning rate.
499
+ - `momentum` - Momentum factor.
500
+ - `update` - Whether to apply updates immediately.
501
+ - `target` - Output target values.
502
+ - `regularization` - L2 regularization factor.
503
+ - `costDerivative` - Optional output-node derivative override.
504
504
 
505
- ### propagateSingleOutputNode
505
+ ### propagateHiddenLayer
506
506
 
507
507
  ```ts
508
- propagateSingleOutputNode(
508
+ propagateHiddenLayer(
509
509
  context: PropagationContext,
510
- node: default,
511
- targetValue: number,
512
510
  ): void
513
511
  ```
514
512
 
515
- Propagate a single output node with a target value.
513
+ Propagate all hidden nodes in reverse topological order.
516
514
 
517
515
  Parameters:
518
516
  - `context` - Shared propagation context.
519
- - `node` - Output node to propagate.
520
- - `targetValue` - Expected output value for this node.
521
517
 
522
- ### propagateSingleHiddenNode
518
+ ### propagateOutputLayer
523
519
 
524
520
  ```ts
525
- propagateSingleHiddenNode(
521
+ propagateOutputLayer(
526
522
  context: PropagationContext,
527
- node: default,
523
+ target: number[],
528
524
  ): void
529
525
  ```
530
526
 
531
- Propagate a single hidden node without a target value.
527
+ Propagate all output nodes with explicit targets.
532
528
 
533
529
  Parameters:
534
530
  - `context` - Shared propagation context.
535
- - `node` - Hidden node to propagate.
531
+ - `target` - Output target vector.
536
532
 
537
533
  ### propagateOutputNodeWithCostDerivative
538
534
 
@@ -553,48 +549,52 @@ Parameters:
553
549
  - `targetValue` - Expected output value for this node.
554
550
  - `costDerivative` - Cost derivative callback.
555
551
 
556
- ### getOutputLayerStartIndex
552
+ ### propagateSingleHiddenNode
557
553
 
558
554
  ```ts
559
- getOutputLayerStartIndex(
560
- network: default,
561
- ): number
555
+ propagateSingleHiddenNode(
556
+ context: PropagationContext,
557
+ node: default,
558
+ ): void
562
559
  ```
563
560
 
564
- Resolve the first index of the output layer.
561
+ Propagate a single hidden node without a target value.
565
562
 
566
563
  Parameters:
567
- - `network` - Network instance.
568
-
569
- Returns: Index at which output nodes begin.
564
+ - `context` - Shared propagation context.
565
+ - `node` - Hidden node to propagate.
570
566
 
571
- ### getLastNodeIndex
567
+ ### propagateSingleOutputNode
572
568
 
573
569
  ```ts
574
- getLastNodeIndex(
575
- network: default,
576
- ): number
570
+ propagateSingleOutputNode(
571
+ context: PropagationContext,
572
+ node: default,
573
+ targetValue: number,
574
+ ): void
577
575
  ```
578
576
 
579
- Resolve the last node index in the network.
577
+ Propagate a single output node with a target value.
580
578
 
581
579
  Parameters:
582
- - `network` - Network instance.
583
-
584
- Returns: Last valid node index.
580
+ - `context` - Shared propagation context.
581
+ - `node` - Output node to propagate.
582
+ - `targetValue` - Expected output value for this node.
585
583
 
586
- ### clearNodeState
584
+ ### validateTargetLength
587
585
 
588
586
  ```ts
589
- clearNodeState(
590
- node: default,
587
+ validateTargetLength(
588
+ network: default,
589
+ target: number[],
591
590
  ): void
592
591
  ```
593
592
 
594
- Clear runtime state for a single node.
593
+ Validate that target output count matches the network output width.
595
594
 
596
595
  Parameters:
597
- - `node` - Node to clear.
596
+ - `network` - Network instance receiving backpropagation.
597
+ - `target` - Output target vector.
598
598
 
599
599
  ## architecture/network/training/network.training.finalize.utils.ts
600
600
 
@@ -18,11 +18,6 @@ Read this chapter in three passes:
18
18
 
19
19
  ## architecture/node/node.ts
20
20
 
21
- ### NodeOptimizerProps
22
-
23
- Internal interface for accessing dynamic optimizer properties on Node instances.
24
- These properties are lazily allocated and not part of the main class definition.
25
-
26
21
  ### Node
27
22
 
28
23
  Node (Neuron)
@@ -38,6 +33,11 @@ Educational note: Traces (`eligibility` and `xtrace`) illustrate how recurrent c
38
33
  assignment works in algorithms like RTRL / policy gradients. They are updated only when
39
34
  using the traced activation path (`activate`) vs `noTraceActivate` (inference fast path).
40
35
 
36
+ ### NodeOptimizerProps
37
+
38
+ Internal interface for accessing dynamic optimizer properties on Node instances.
39
+ These properties are lazily allocated and not part of the main class definition.
40
+
41
41
  ### default
42
42
 
43
43
  #### _activateCore
@@ -16,10 +16,6 @@ Read this chapter in three passes:
16
16
 
17
17
  ## architecture/nodePool/nodePool.ts
18
18
 
19
- ### AcquireNodeOptions
20
-
21
- Options bag for acquiring a node.
22
-
23
19
  ### acquireNode
24
20
 
25
21
  ```ts
@@ -39,6 +35,20 @@ Parameters:
39
35
 
40
36
  Returns: A ready-to-use node instance.
41
37
 
38
+ ### AcquireNodeOptions
39
+
40
+ Options bag for acquiring a node.
41
+
42
+ ### nodePoolStats
43
+
44
+ ```ts
45
+ nodePoolStats(): { size: number; highWaterMark: number; reused: number; fresh: number; recycledRatio: number; }
46
+ ```
47
+
48
+ Get current pool statistics for diagnostics and memory reporting.
49
+
50
+ Returns: Pool size, reuse counters, and the long-run recycled ratio.
51
+
42
52
  ### releaseNode
43
53
 
44
54
  ```ts
@@ -57,16 +67,6 @@ Parameters:
57
67
 
58
68
  Returns: Nothing.
59
69
 
60
- ### nodePoolStats
61
-
62
- ```ts
63
- nodePoolStats(): { size: number; highWaterMark: number; reused: number; fresh: number; recycledRatio: number; }
64
- ```
65
-
66
- Get current pool statistics for diagnostics and memory reporting.
67
-
68
- Returns: Pool size, reuse counters, and the long-run recycled ratio.
69
-
70
70
  ### resetNodePool
71
71
 
72
72
  ```ts