@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
@@ -156,304 +156,314 @@ forward-value question and the local-slope question, which is why the file is
156
156
  organized around reusable transfer-curve families instead of separate forward
157
157
  and derivative tables.
158
158
 
159
- ### logisticActivation
159
+ ### absoluteActivation
160
160
 
161
161
  ```ts
162
- logisticActivation(
162
+ absoluteActivation(
163
163
  inputValue: number,
164
164
  shouldComputeDerivative: boolean,
165
165
  ): number
166
166
  ```
167
167
 
168
- Logistic (sigmoid) activation implementation.
168
+ Absolute activation implementation.
169
169
 
170
- This is the bounded baseline most readers already know: useful when a node
171
- should behave like a probability-like squashing unit, but also the easiest
172
- activation to saturate if pre-activation values become too large in
173
- magnitude.
170
+ Absolute value discards sign and keeps only magnitude. It is unusual as a
171
+ default hidden-layer choice, but it can be useful in experiments where the
172
+ intensity of a signal matters more than whether it was positive or negative.
174
173
 
175
174
  Parameters:
176
175
  - `inputValue` - - Input to evaluate.
177
176
  - `shouldComputeDerivative` - - Whether to compute the derivative.
178
177
 
179
- Returns: Logistic output or derivative.
178
+ Returns: Absolute output or derivative.
180
179
 
181
- ### tanhActivation
180
+ ### ActivationFunction
182
181
 
183
182
  ```ts
184
- tanhActivation(
183
+ ActivationFunction(
185
184
  inputValue: number,
186
- shouldComputeDerivative: boolean,
185
+ shouldComputeDerivative: boolean | undefined,
187
186
  ): number
188
187
  ```
189
188
 
190
- Hyperbolic tangent activation implementation.
191
-
192
- Compared with {@link logisticActivation}, tanh stays bounded while remaining
193
- zero-centered, which often makes hidden activations easier to interpret when
194
- positive and negative evidence should balance around zero.
189
+ Shared contract for activation implementations used by the runtime registry.
195
190
 
196
- Parameters:
197
- - `inputValue` - - Input to evaluate.
198
- - `shouldComputeDerivative` - - Whether to compute the derivative.
191
+ This utility layer is where the math-facing side of the activation chapter
192
+ lives. Each exported function keeps the same two-mode signature so the
193
+ higher-level {@link Activation} registry can switch between forward
194
+ evaluation and derivative lookup without wrapping every implementation in a
195
+ different adapter.
199
196
 
200
- Returns: Tanh output or derivative.
197
+ Read the implementations in four practical groups:
201
198
 
202
- ### identityActivation
199
+ - bounded classics such as {@link logisticActivation},
200
+ {@link sigmoidActivation}, and {@link tanhActivation},
201
+ - sparse or piecewise-linear gates such as {@link reluActivation},
202
+ {@link stepActivation}, and {@link hardTanhActivation},
203
+ - shape-specialized functions such as {@link gaussianActivation},
204
+ {@link sinusoidActivation}, and {@link bentIdentityActivation},
205
+ - smoother modern hidden-layer candidates such as {@link softplusActivation},
206
+ {@link swishActivation}, {@link geluActivation}, and
207
+ {@link mishActivation}.
203
208
 
204
- ```ts
205
- identityActivation(
206
- inputValue: number,
207
- shouldComputeDerivative: boolean,
208
- ): number
209
- ```
209
+ A useful reading order is:
210
210
 
211
- Identity activation implementation.
211
+ 1. compare {@link logisticActivation}, {@link tanhActivation}, and
212
+ {@link reluActivation} to anchor the classic bounded-versus-sparse trade,
213
+ 2. scan {@link softplusActivation}, {@link swishActivation},
214
+ {@link geluActivation}, and {@link mishActivation} when you want smoother
215
+ hidden-layer behavior,
216
+ 3. finish with the shape-specialized helpers when your experiment needs a
217
+ periodic, radial, or sign-like response rather than a general default.
212
218
 
213
- Use this when you explicitly want a linear pass-through unit. It is most
214
- common in regression-style output layers or in experiments where the upstream
215
- topology already provides the non-linearity and you only need a value relay.
219
+ Keep the derivative flag in mind while reading: every helper answers both the
220
+ forward-value question and the local-slope question, which is why the file is
221
+ organized around reusable transfer-curve families instead of separate forward
222
+ and derivative tables.
216
223
 
217
224
  Parameters:
218
- - `inputValue` - - Input to evaluate.
219
- - `shouldComputeDerivative` - - Whether to compute the derivative.
225
+ - `inputValue` - - Input to the activation function.
226
+ - `shouldComputeDerivative` - - Whether to compute the derivative instead of the value.
220
227
 
221
- Returns: Identity output or derivative.
228
+ Returns: Activation output or derivative at the input.
222
229
 
223
- ### stepActivation
230
+ ### bentIdentityActivation
224
231
 
225
232
  ```ts
226
- stepActivation(
233
+ bentIdentityActivation(
227
234
  inputValue: number,
228
235
  shouldComputeDerivative: boolean,
229
236
  ): number
230
237
  ```
231
238
 
232
- Step activation implementation.
239
+ Bent identity activation implementation.
233
240
 
234
- This is the hard-threshold ancestor of smoother gates: it cleanly separates
235
- negative from positive evidence, but its zero derivative almost everywhere
236
- makes it a poor default for gradient-based training.
241
+ Bent identity stays close to a linear pass-through while adding a gentle
242
+ non-linearity near the origin. It is useful when pure identity feels too weak
243
+ but a strongly saturating activation would distort the signal too early.
237
244
 
238
245
  Parameters:
239
246
  - `inputValue` - - Input to evaluate.
240
247
  - `shouldComputeDerivative` - - Whether to compute the derivative.
241
248
 
242
- Returns: Step output or derivative.
249
+ Returns: Bent identity output or derivative.
243
250
 
244
- ### reluActivation
251
+ ### bipolarActivation
245
252
 
246
253
  ```ts
247
- reluActivation(
254
+ bipolarActivation(
248
255
  inputValue: number,
249
256
  shouldComputeDerivative: boolean,
250
257
  ): number
251
258
  ```
252
259
 
253
- Rectified Linear Unit (ReLU) activation implementation.
260
+ Bipolar activation implementation.
254
261
 
255
- ReLU is the practical default for many hidden layers because it is cheap,
256
- sparse, and easy to optimize. This implementation follows the common library
257
- convention of returning `0` for the derivative at exactly `0`, even though
258
- the mathematical derivative is not uniquely defined there.
262
+ This is the sign-function version of a hard classifier: values collapse to
263
+ `-1` or `1` with no middle ground. It is mostly useful as a historical or
264
+ diagnostic contrast against smoother bounded activations.
259
265
 
260
266
  Parameters:
261
267
  - `inputValue` - - Input to evaluate.
262
268
  - `shouldComputeDerivative` - - Whether to compute the derivative.
263
269
 
264
- Returns: ReLU output or derivative.
270
+ Returns: Bipolar output or derivative.
265
271
 
266
- ### softsignActivation
272
+ ### bipolarSigmoidActivation
267
273
 
268
274
  ```ts
269
- softsignActivation(
275
+ bipolarSigmoidActivation(
270
276
  inputValue: number,
271
277
  shouldComputeDerivative: boolean,
272
278
  ): number
273
279
  ```
274
280
 
275
- Softsign activation implementation.
281
+ Bipolar sigmoid activation implementation.
276
282
 
277
- Softsign behaves like a gentler, cheaper-to-reason-about cousin of tanh. It
278
- still compresses values into a bounded range, but the tails decay more
279
- gradually, which can make it a useful comparison point when tanh feels too
280
- eager to saturate.
283
+ This is the `[-1, 1]` counterpart to {@link logisticActivation}. In practice
284
+ it is another route to a tanh-like curve, but the explicit bipolar naming is
285
+ helpful when comparing older NEAT-era literature or porting legacy settings.
281
286
 
282
287
  Parameters:
283
288
  - `inputValue` - - Input to evaluate.
284
289
  - `shouldComputeDerivative` - - Whether to compute the derivative.
285
290
 
286
- Returns: Softsign output or derivative.
291
+ Returns: Bipolar sigmoid output or derivative.
287
292
 
288
- ### sinusoidActivation
293
+ ### gaussianActivation
289
294
 
290
295
  ```ts
291
- sinusoidActivation(
296
+ gaussianActivation(
292
297
  inputValue: number,
293
298
  shouldComputeDerivative: boolean,
294
299
  ): number
295
300
  ```
296
301
 
297
- Sinusoid activation implementation.
302
+ Gaussian activation implementation.
298
303
 
299
- Reach for this when periodic structure matters more than monotonicity. A
300
- sinusoidal response can encode cycles and phase relationships that ordinary
301
- squashing activations tend to smooth away.
304
+ Gaussian responses peak at the origin and shrink toward zero on both sides,
305
+ which makes them useful when you want a node to behave more like a localized
306
+ detector than a broad monotonic amplifier.
302
307
 
303
308
  Parameters:
304
309
  - `inputValue` - - Input to evaluate.
305
310
  - `shouldComputeDerivative` - - Whether to compute the derivative.
306
311
 
307
- Returns: Sinusoid output or derivative.
312
+ Returns: Gaussian output or derivative.
308
313
 
309
- ### gaussianActivation
314
+ ### geluActivation
310
315
 
311
316
  ```ts
312
- gaussianActivation(
317
+ geluActivation(
313
318
  inputValue: number,
314
319
  shouldComputeDerivative: boolean,
315
320
  ): number
316
321
  ```
317
322
 
318
- Gaussian activation implementation.
323
+ Gaussian Error Linear Unit (GELU) activation implementation.
319
324
 
320
- Gaussian responses peak at the origin and shrink toward zero on both sides,
321
- which makes them useful when you want a node to behave more like a localized
322
- detector than a broad monotonic amplifier.
325
+ GELU keeps the soft gating idea of Swish but uses a Gaussian-CDF-shaped
326
+ weighting curve. This implementation uses the common tanh-based
327
+ approximation, which is fast enough for ordinary training code while staying
328
+ close to the exact GELU shape used in many transformer-era models.
323
329
 
324
330
  Parameters:
325
331
  - `inputValue` - - Input to evaluate.
326
332
  - `shouldComputeDerivative` - - Whether to compute the derivative.
327
333
 
328
- Returns: Gaussian output or derivative.
334
+ Returns: GELU output or derivative.
329
335
 
330
- ### bentIdentityActivation
336
+ ### hardTanhActivation
331
337
 
332
338
  ```ts
333
- bentIdentityActivation(
339
+ hardTanhActivation(
334
340
  inputValue: number,
335
341
  shouldComputeDerivative: boolean,
336
342
  ): number
337
343
  ```
338
344
 
339
- Bent identity activation implementation.
345
+ Hard tanh activation implementation.
340
346
 
341
- Bent identity stays close to a linear pass-through while adding a gentle
342
- non-linearity near the origin. It is useful when pure identity feels too weak
343
- but a strongly saturating activation would distort the signal too early.
347
+ Hard tanh keeps tanh's familiar `[-1, 1]` output range while replacing the
348
+ curved middle section with a cheap piecewise-linear clamp. That makes it a
349
+ practical compromise when you want bounded outputs without paying for a full
350
+ smooth tanh evaluation.
344
351
 
345
352
  Parameters:
346
353
  - `inputValue` - - Input to evaluate.
347
354
  - `shouldComputeDerivative` - - Whether to compute the derivative.
348
355
 
349
- Returns: Bent identity output or derivative.
356
+ Returns: Hard tanh output or derivative.
350
357
 
351
- ### bipolarActivation
358
+ ### identityActivation
352
359
 
353
360
  ```ts
354
- bipolarActivation(
361
+ identityActivation(
355
362
  inputValue: number,
356
363
  shouldComputeDerivative: boolean,
357
364
  ): number
358
365
  ```
359
366
 
360
- Bipolar activation implementation.
367
+ Identity activation implementation.
361
368
 
362
- This is the sign-function version of a hard classifier: values collapse to
363
- `-1` or `1` with no middle ground. It is mostly useful as a historical or
364
- diagnostic contrast against smoother bounded activations.
369
+ Use this when you explicitly want a linear pass-through unit. It is most
370
+ common in regression-style output layers or in experiments where the upstream
371
+ topology already provides the non-linearity and you only need a value relay.
365
372
 
366
373
  Parameters:
367
374
  - `inputValue` - - Input to evaluate.
368
375
  - `shouldComputeDerivative` - - Whether to compute the derivative.
369
376
 
370
- Returns: Bipolar output or derivative.
377
+ Returns: Identity output or derivative.
371
378
 
372
- ### bipolarSigmoidActivation
379
+ ### inverseActivation
373
380
 
374
381
  ```ts
375
- bipolarSigmoidActivation(
382
+ inverseActivation(
376
383
  inputValue: number,
377
384
  shouldComputeDerivative: boolean,
378
385
  ): number
379
386
  ```
380
387
 
381
- Bipolar sigmoid activation implementation.
388
+ Inverse activation implementation.
382
389
 
383
- This is the `[-1, 1]` counterpart to {@link logisticActivation}. In practice
384
- it is another route to a tanh-like curve, but the explicit bipolar naming is
385
- helpful when comparing older NEAT-era literature or porting legacy settings.
390
+ This helper mirrors a value around `1`, which makes it more of a niche
391
+ transformation than a general-purpose hidden activation. It is best read as
392
+ part of the method vocabulary's legacy and experimentation shelf rather than
393
+ as a recommended first-choice default.
386
394
 
387
395
  Parameters:
388
396
  - `inputValue` - - Input to evaluate.
389
397
  - `shouldComputeDerivative` - - Whether to compute the derivative.
390
398
 
391
- Returns: Bipolar sigmoid output or derivative.
399
+ Returns: Inverse output or derivative.
392
400
 
393
- ### hardTanhActivation
401
+ ### logisticActivation
394
402
 
395
403
  ```ts
396
- hardTanhActivation(
404
+ logisticActivation(
397
405
  inputValue: number,
398
406
  shouldComputeDerivative: boolean,
399
407
  ): number
400
408
  ```
401
409
 
402
- Hard tanh activation implementation.
410
+ Logistic (sigmoid) activation implementation.
403
411
 
404
- Hard tanh keeps tanh's familiar `[-1, 1]` output range while replacing the
405
- curved middle section with a cheap piecewise-linear clamp. That makes it a
406
- practical compromise when you want bounded outputs without paying for a full
407
- smooth tanh evaluation.
412
+ This is the bounded baseline most readers already know: useful when a node
413
+ should behave like a probability-like squashing unit, but also the easiest
414
+ activation to saturate if pre-activation values become too large in
415
+ magnitude.
408
416
 
409
417
  Parameters:
410
418
  - `inputValue` - - Input to evaluate.
411
419
  - `shouldComputeDerivative` - - Whether to compute the derivative.
412
420
 
413
- Returns: Hard tanh output or derivative.
421
+ Returns: Logistic output or derivative.
414
422
 
415
- ### absoluteActivation
423
+ ### mishActivation
416
424
 
417
425
  ```ts
418
- absoluteActivation(
426
+ mishActivation(
419
427
  inputValue: number,
420
428
  shouldComputeDerivative: boolean,
421
429
  ): number
422
430
  ```
423
431
 
424
- Absolute activation implementation.
432
+ Mish activation implementation.
425
433
 
426
- Absolute value discards sign and keeps only magnitude. It is unusual as a
427
- default hidden-layer choice, but it can be useful in experiments where the
428
- intensity of a signal matters more than whether it was positive or negative.
434
+ Mish is another smooth self-gated option, built from `x * tanh(softplus(x))`.
435
+ It keeps more negative-side nuance than ReLU while still rewarding large
436
+ positive evidence. The implementation reuses the same softplus stability
437
+ strategy so the helper behaves sensibly in the far positive and negative
438
+ tails.
429
439
 
430
440
  Parameters:
431
441
  - `inputValue` - - Input to evaluate.
432
442
  - `shouldComputeDerivative` - - Whether to compute the derivative.
433
443
 
434
- Returns: Absolute output or derivative.
444
+ Returns: Mish output or derivative.
435
445
 
436
- ### inverseActivation
446
+ ### reluActivation
437
447
 
438
448
  ```ts
439
- inverseActivation(
449
+ reluActivation(
440
450
  inputValue: number,
441
451
  shouldComputeDerivative: boolean,
442
452
  ): number
443
453
  ```
444
454
 
445
- Inverse activation implementation.
455
+ Rectified Linear Unit (ReLU) activation implementation.
446
456
 
447
- This helper mirrors a value around `1`, which makes it more of a niche
448
- transformation than a general-purpose hidden activation. It is best read as
449
- part of the method vocabulary's legacy and experimentation shelf rather than
450
- as a recommended first-choice default.
457
+ ReLU is the practical default for many hidden layers because it is cheap,
458
+ sparse, and easy to optimize. This implementation follows the common library
459
+ convention of returning `0` for the derivative at exactly `0`, even though
460
+ the mathematical derivative is not uniquely defined there.
451
461
 
452
462
  Parameters:
453
463
  - `inputValue` - - Input to evaluate.
454
464
  - `shouldComputeDerivative` - - Whether to compute the derivative.
455
465
 
456
- Returns: Inverse output or derivative.
466
+ Returns: ReLU output or derivative.
457
467
 
458
468
  ### seluActivation
459
469
 
@@ -478,162 +488,152 @@ Parameters:
478
488
 
479
489
  Returns: SELU output or derivative.
480
490
 
481
- ### softplusActivation
491
+ ### sigmoidActivation
482
492
 
483
493
  ```ts
484
- softplusActivation(
494
+ sigmoidActivation(
485
495
  inputValue: number,
486
496
  shouldComputeDerivative: boolean,
487
497
  ): number
488
498
  ```
489
499
 
490
- Softplus activation implementation with stability guards.
500
+ Sigmoid alias activation implementation.
491
501
 
492
- Softplus is the smooth sibling of {@link reluActivation}: for large positive
493
- values it behaves almost linearly, for large negative values it fades toward
494
- zero, and around the origin it avoids the hard corner that makes ReLU
495
- piecewise. The threshold checks keep the implementation numerically stable in
496
- the extreme tails.
502
+ This intentionally delegates to {@link logisticActivation} so callers can use
503
+ either the mathematically explicit `logistic` name or the more common
504
+ deep-learning alias `sigmoid` without creating two separate implementations.
497
505
 
498
506
  Parameters:
499
507
  - `inputValue` - - Input to evaluate.
500
508
  - `shouldComputeDerivative` - - Whether to compute the derivative.
501
509
 
502
- Returns: Softplus output or derivative.
510
+ Returns: Sigmoid output or derivative.
503
511
 
504
- ### swishActivation
512
+ ### sinusoidActivation
505
513
 
506
514
  ```ts
507
- swishActivation(
515
+ sinusoidActivation(
508
516
  inputValue: number,
509
517
  shouldComputeDerivative: boolean,
510
518
  ): number
511
519
  ```
512
520
 
513
- Swish activation implementation.
521
+ Sinusoid activation implementation.
514
522
 
515
- Swish multiplies the input by a sigmoid gate, so the unit can dampen itself
516
- smoothly instead of snapping to zero as ReLU does. That makes it a useful
517
- comparison point when experimenting with smoother hidden-layer behavior.
523
+ Reach for this when periodic structure matters more than monotonicity. A
524
+ sinusoidal response can encode cycles and phase relationships that ordinary
525
+ squashing activations tend to smooth away.
518
526
 
519
527
  Parameters:
520
528
  - `inputValue` - - Input to evaluate.
521
529
  - `shouldComputeDerivative` - - Whether to compute the derivative.
522
530
 
523
- Returns: Swish output or derivative.
531
+ Returns: Sinusoid output or derivative.
524
532
 
525
- ### geluActivation
533
+ ### softplusActivation
526
534
 
527
535
  ```ts
528
- geluActivation(
536
+ softplusActivation(
529
537
  inputValue: number,
530
538
  shouldComputeDerivative: boolean,
531
539
  ): number
532
540
  ```
533
541
 
534
- Gaussian Error Linear Unit (GELU) activation implementation.
542
+ Softplus activation implementation with stability guards.
535
543
 
536
- GELU keeps the soft gating idea of Swish but uses a Gaussian-CDF-shaped
537
- weighting curve. This implementation uses the common tanh-based
538
- approximation, which is fast enough for ordinary training code while staying
539
- close to the exact GELU shape used in many transformer-era models.
544
+ Softplus is the smooth sibling of {@link reluActivation}: for large positive
545
+ values it behaves almost linearly, for large negative values it fades toward
546
+ zero, and around the origin it avoids the hard corner that makes ReLU
547
+ piecewise. The threshold checks keep the implementation numerically stable in
548
+ the extreme tails.
540
549
 
541
550
  Parameters:
542
551
  - `inputValue` - - Input to evaluate.
543
552
  - `shouldComputeDerivative` - - Whether to compute the derivative.
544
553
 
545
- Returns: GELU output or derivative.
554
+ Returns: Softplus output or derivative.
546
555
 
547
- ### mishActivation
556
+ ### softsignActivation
548
557
 
549
558
  ```ts
550
- mishActivation(
559
+ softsignActivation(
551
560
  inputValue: number,
552
561
  shouldComputeDerivative: boolean,
553
562
  ): number
554
563
  ```
555
564
 
556
- Mish activation implementation.
565
+ Softsign activation implementation.
557
566
 
558
- Mish is another smooth self-gated option, built from `x * tanh(softplus(x))`.
559
- It keeps more negative-side nuance than ReLU while still rewarding large
560
- positive evidence. The implementation reuses the same softplus stability
561
- strategy so the helper behaves sensibly in the far positive and negative
562
- tails.
567
+ Softsign behaves like a gentler, cheaper-to-reason-about cousin of tanh. It
568
+ still compresses values into a bounded range, but the tails decay more
569
+ gradually, which can make it a useful comparison point when tanh feels too
570
+ eager to saturate.
563
571
 
564
572
  Parameters:
565
573
  - `inputValue` - - Input to evaluate.
566
574
  - `shouldComputeDerivative` - - Whether to compute the derivative.
567
575
 
568
- Returns: Mish output or derivative.
576
+ Returns: Softsign output or derivative.
569
577
 
570
- ### sigmoidActivation
578
+ ### stepActivation
571
579
 
572
580
  ```ts
573
- sigmoidActivation(
581
+ stepActivation(
574
582
  inputValue: number,
575
583
  shouldComputeDerivative: boolean,
576
584
  ): number
577
585
  ```
578
586
 
579
- Sigmoid alias activation implementation.
587
+ Step activation implementation.
580
588
 
581
- This intentionally delegates to {@link logisticActivation} so callers can use
582
- either the mathematically explicit `logistic` name or the more common
583
- deep-learning alias `sigmoid` without creating two separate implementations.
589
+ This is the hard-threshold ancestor of smoother gates: it cleanly separates
590
+ negative from positive evidence, but its zero derivative almost everywhere
591
+ makes it a poor default for gradient-based training.
584
592
 
585
593
  Parameters:
586
594
  - `inputValue` - - Input to evaluate.
587
595
  - `shouldComputeDerivative` - - Whether to compute the derivative.
588
596
 
589
- Returns: Sigmoid output or derivative.
597
+ Returns: Step output or derivative.
590
598
 
591
- ### ActivationFunction
599
+ ### swishActivation
592
600
 
593
601
  ```ts
594
- ActivationFunction(
602
+ swishActivation(
595
603
  inputValue: number,
596
- shouldComputeDerivative: boolean | undefined,
604
+ shouldComputeDerivative: boolean,
597
605
  ): number
598
606
  ```
599
607
 
600
- Shared contract for activation implementations used by the runtime registry.
608
+ Swish activation implementation.
601
609
 
602
- This utility layer is where the math-facing side of the activation chapter
603
- lives. Each exported function keeps the same two-mode signature so the
604
- higher-level {@link Activation} registry can switch between forward
605
- evaluation and derivative lookup without wrapping every implementation in a
606
- different adapter.
610
+ Swish multiplies the input by a sigmoid gate, so the unit can dampen itself
611
+ smoothly instead of snapping to zero as ReLU does. That makes it a useful
612
+ comparison point when experimenting with smoother hidden-layer behavior.
607
613
 
608
- Read the implementations in four practical groups:
614
+ Parameters:
615
+ - `inputValue` - - Input to evaluate.
616
+ - `shouldComputeDerivative` - - Whether to compute the derivative.
609
617
 
610
- - bounded classics such as {@link logisticActivation},
611
- {@link sigmoidActivation}, and {@link tanhActivation},
612
- - sparse or piecewise-linear gates such as {@link reluActivation},
613
- {@link stepActivation}, and {@link hardTanhActivation},
614
- - shape-specialized functions such as {@link gaussianActivation},
615
- {@link sinusoidActivation}, and {@link bentIdentityActivation},
616
- - smoother modern hidden-layer candidates such as {@link softplusActivation},
617
- {@link swishActivation}, {@link geluActivation}, and
618
- {@link mishActivation}.
618
+ Returns: Swish output or derivative.
619
619
 
620
- A useful reading order is:
620
+ ### tanhActivation
621
621
 
622
- 1. compare {@link logisticActivation}, {@link tanhActivation}, and
623
- {@link reluActivation} to anchor the classic bounded-versus-sparse trade,
624
- 2. scan {@link softplusActivation}, {@link swishActivation},
625
- {@link geluActivation}, and {@link mishActivation} when you want smoother
626
- hidden-layer behavior,
627
- 3. finish with the shape-specialized helpers when your experiment needs a
628
- periodic, radial, or sign-like response rather than a general default.
622
+ ```ts
623
+ tanhActivation(
624
+ inputValue: number,
625
+ shouldComputeDerivative: boolean,
626
+ ): number
627
+ ```
629
628
 
630
- Keep the derivative flag in mind while reading: every helper answers both the
631
- forward-value question and the local-slope question, which is why the file is
632
- organized around reusable transfer-curve families instead of separate forward
633
- and derivative tables.
629
+ Hyperbolic tangent activation implementation.
630
+
631
+ Compared with {@link logisticActivation}, tanh stays bounded while remaining
632
+ zero-centered, which often makes hidden activations easier to interpret when
633
+ positive and negative evidence should balance around zero.
634
634
 
635
635
  Parameters:
636
- - `inputValue` - - Input to the activation function.
637
- - `shouldComputeDerivative` - - Whether to compute the derivative instead of the value.
636
+ - `inputValue` - - Input to evaluate.
637
+ - `shouldComputeDerivative` - - Whether to compute the derivative.
638
638
 
639
- Returns: Activation output or derivative at the input.
639
+ Returns: Tanh output or derivative.