@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
@@ -198,6 +198,57 @@ Targets may be soft labels and are expected to sum to 1 (will be re-normalized i
198
198
 
199
199
  ## methods/cost/cost.utils.ts
200
200
 
201
+ ### BINARY_CLASSIFICATION_THRESHOLD
202
+
203
+ Threshold for binarizing probabilities into class predictions.
204
+
205
+ ### clampProbability
206
+
207
+ ```ts
208
+ clampProbability(
209
+ probability: number,
210
+ ): number
211
+ ```
212
+
213
+ Clamps a probability into the inclusive bounds defined by PROBABILITY_LOWER_BOUND and PROBABILITY_UPPER_BOUND.
214
+
215
+ Parameters:
216
+ - `probability` - - Raw probability value to bound.
217
+
218
+ Returns: Probability constrained to the numeric stability range.
219
+
220
+ ### classifyBinary
221
+
222
+ ```ts
223
+ classifyBinary(
224
+ probability: number,
225
+ ): number
226
+ ```
227
+
228
+ Converts a probability into a binary class label using the configured threshold.
229
+
230
+ Parameters:
231
+ - `probability` - - Probability to classify.
232
+
233
+ Returns: POSITIVE_CLASS_LABEL when above or equal to threshold; otherwise NEGATIVE_CLASS_LABEL.
234
+
235
+ ### computeBinaryError
236
+
237
+ ```ts
238
+ computeBinaryError(
239
+ targets: number[],
240
+ outputs: number[],
241
+ ): number
242
+ ```
243
+
244
+ Computes binary classification error rate.
245
+
246
+ Parameters:
247
+ - `targets` - - Target labels (0 or 1).
248
+ - `outputs` - - Predicted probabilities.
249
+
250
+ Returns: Proportion of misclassified samples.
251
+
201
252
  ### computeCrossEntropy
202
253
 
203
254
  ```ts
@@ -215,56 +266,62 @@ Parameters:
215
266
 
216
267
  Returns: Mean cross-entropy error across all samples.
217
268
 
218
- ### computeSoftmaxCrossEntropy
269
+ ### computeFocalLoss
219
270
 
220
271
  ```ts
221
- computeSoftmaxCrossEntropy(
272
+ computeFocalLoss(
222
273
  targets: number[],
223
274
  outputs: number[],
275
+ gamma: number,
276
+ alpha: number,
224
277
  ): number
225
278
  ```
226
279
 
227
- Computes the softmax cross entropy given targets and raw score outputs.
280
+ Computes focal loss for imbalanced classification tasks.
228
281
 
229
282
  Parameters:
230
- - `targets` - - Desired target probabilities that should sum to 1 (will be normalized if not).
231
- - `outputs` - - Raw logits or scores for each class.
283
+ - `targets` - - Target labels (0 or 1) or soft labels.
284
+ - `outputs` - - Predicted probabilities.
285
+ - `gamma` - - Focusing parameter controlling hard example emphasis.
286
+ - `alpha` - - Balancing parameter for class weighting.
232
287
 
233
- Returns: Total (non-averaged) softmax cross-entropy loss.
288
+ Returns: Mean focal loss.
234
289
 
235
- ### computeMeanSquaredError
290
+ ### computeHingeLoss
236
291
 
237
292
  ```ts
238
- computeMeanSquaredError(
293
+ computeHingeLoss(
239
294
  targets: number[],
240
295
  outputs: number[],
241
296
  ): number
242
297
  ```
243
298
 
244
- Computes mean squared error between targets and outputs.
299
+ Computes hinge loss for margin-based classification.
245
300
 
246
301
  Parameters:
247
- - `targets` - - Desired target values.
248
- - `outputs` - - Model outputs.
302
+ - `targets` - - Target labels encoded as -1 or 1.
303
+ - `outputs` - - Model outputs (raw scores).
249
304
 
250
- Returns: Mean squared error.
305
+ Returns: Mean hinge loss.
251
306
 
252
- ### computeBinaryError
307
+ ### computeLabelSmoothingLoss
253
308
 
254
309
  ```ts
255
- computeBinaryError(
310
+ computeLabelSmoothingLoss(
256
311
  targets: number[],
257
312
  outputs: number[],
313
+ smoothing: number,
258
314
  ): number
259
315
  ```
260
316
 
261
- Computes binary classification error rate.
317
+ Computes cross entropy with label smoothing applied to targets.
262
318
 
263
319
  Parameters:
264
- - `targets` - - Target labels (0 or 1).
320
+ - `targets` - - Target labels (0 or 1) or soft labels.
265
321
  - `outputs` - - Predicted probabilities.
322
+ - `smoothing` - - Smoothing factor between 0 and 1.
266
323
 
267
- Returns: Proportion of misclassified samples.
324
+ Returns: Mean cross-entropy loss with smoothed targets.
268
325
 
269
326
  ### computeMeanAbsoluteError
270
327
 
@@ -300,151 +357,101 @@ Parameters:
300
357
 
301
358
  Returns: Mean absolute percentage error (fractional form).
302
359
 
303
- ### computeMeanSquaredLogarithmicError
360
+ ### computeMeanSquaredError
304
361
 
305
362
  ```ts
306
- computeMeanSquaredLogarithmicError(
363
+ computeMeanSquaredError(
307
364
  targets: number[],
308
365
  outputs: number[],
309
366
  ): number
310
367
  ```
311
368
 
312
- Computes mean squared logarithmic error between targets and outputs.
369
+ Computes mean squared error between targets and outputs.
313
370
 
314
371
  Parameters:
315
- - `targets` - - Desired non-negative target values.
316
- - `outputs` - - Model outputs (expected non-negative).
372
+ - `targets` - - Desired target values.
373
+ - `outputs` - - Model outputs.
317
374
 
318
- Returns: Mean squared logarithmic error.
375
+ Returns: Mean squared error.
319
376
 
320
- ### computeHingeLoss
377
+ ### computeMeanSquaredLogarithmicError
321
378
 
322
379
  ```ts
323
- computeHingeLoss(
380
+ computeMeanSquaredLogarithmicError(
324
381
  targets: number[],
325
382
  outputs: number[],
326
383
  ): number
327
384
  ```
328
385
 
329
- Computes hinge loss for margin-based classification.
386
+ Computes mean squared logarithmic error between targets and outputs.
330
387
 
331
388
  Parameters:
332
- - `targets` - - Target labels encoded as -1 or 1.
333
- - `outputs` - - Model outputs (raw scores).
389
+ - `targets` - - Desired non-negative target values.
390
+ - `outputs` - - Model outputs (expected non-negative).
334
391
 
335
- Returns: Mean hinge loss.
392
+ Returns: Mean squared logarithmic error.
336
393
 
337
- ### computeFocalLoss
394
+ ### computeSoftmaxCrossEntropy
338
395
 
339
396
  ```ts
340
- computeFocalLoss(
397
+ computeSoftmaxCrossEntropy(
341
398
  targets: number[],
342
399
  outputs: number[],
343
- gamma: number,
344
- alpha: number,
345
400
  ): number
346
401
  ```
347
402
 
348
- Computes focal loss for imbalanced classification tasks.
403
+ Computes the softmax cross entropy given targets and raw score outputs.
349
404
 
350
405
  Parameters:
351
- - `targets` - - Target labels (0 or 1) or soft labels.
352
- - `outputs` - - Predicted probabilities.
353
- - `gamma` - - Focusing parameter controlling hard example emphasis.
354
- - `alpha` - - Balancing parameter for class weighting.
406
+ - `targets` - - Desired target probabilities that should sum to 1 (will be normalized if not).
407
+ - `outputs` - - Raw logits or scores for each class.
355
408
 
356
- Returns: Mean focal loss.
409
+ Returns: Total (non-averaged) softmax cross-entropy loss.
357
410
 
358
- ### computeLabelSmoothingLoss
411
+ ### crossEntropyTerm
359
412
 
360
413
  ```ts
361
- computeLabelSmoothingLoss(
362
- targets: number[],
363
- outputs: number[],
364
- smoothing: number,
414
+ crossEntropyTerm(
415
+ targetProbability: number,
416
+ clampedProbability: number,
365
417
  ): number
366
418
  ```
367
419
 
368
- Computes cross entropy with label smoothing applied to targets.
420
+ Computes the cross-entropy contribution for a single target/output pair.
369
421
 
370
422
  Parameters:
371
- - `targets` - - Target labels (0 or 1) or soft labels.
372
- - `outputs` - - Predicted probabilities.
373
- - `smoothing` - - Smoothing factor between 0 and 1.
374
-
375
- Returns: Mean cross-entropy loss with smoothed targets.
376
-
377
- ### LENGTH_MISMATCH_MESSAGE
378
-
379
- Error message thrown when target and output arrays differ in length.
380
-
381
- ### POSITIVE_CLASS_LABEL
382
-
383
- Canonical positive label used by binary-oriented helpers.
384
-
385
- ### NEGATIVE_CLASS_LABEL
386
-
387
- Canonical negative label used by binary-oriented helpers.
388
-
389
- ### BINARY_CLASSIFICATION_THRESHOLD
423
+ - `targetProbability` - - Target probability for the sample (may be soft).
424
+ - `clampedProbability` - - Output probability already clamped for stability.
390
425
 
391
- Threshold for binarizing probabilities into class predictions.
426
+ Returns: Cross-entropy term for the sample.
392
427
 
393
- ### HINGE_MARGIN
428
+ ### DEFAULT_FOCAL_ALPHA
394
429
 
395
- Margin enforced by hinge loss.
430
+ Default class balancing parameter for focal loss.
396
431
 
397
432
  ### DEFAULT_FOCAL_GAMMA
398
433
 
399
434
  Default focusing parameter for focal loss.
400
435
 
401
- ### DEFAULT_FOCAL_ALPHA
402
-
403
- Default class balancing parameter for focal loss.
404
-
405
436
  ### DEFAULT_LABEL_SMOOTHING
406
437
 
407
438
  Default smoothing factor for label smoothing.
408
439
 
409
- ### LABEL_SMOOTHING_BASELINE
410
-
411
- Baseline probability used when smoothing targets.
412
-
413
- ### SOFTMAX_SUM_GUARD
414
-
415
- Lower bound for softmax denominator to avoid division by zero.
416
-
417
- ### clampProbability
418
-
419
- ```ts
420
- clampProbability(
421
- probability: number,
422
- ): number
423
- ```
424
-
425
- Clamps a probability into the inclusive bounds defined by PROBABILITY_LOWER_BOUND and PROBABILITY_UPPER_BOUND.
440
+ ### HINGE_MARGIN
426
441
 
427
- Parameters:
428
- - `probability` - - Raw probability value to bound.
442
+ Margin enforced by hinge loss.
429
443
 
430
- Returns: Probability constrained to the numeric stability range.
444
+ ### LABEL_SMOOTHING_BASELINE
431
445
 
432
- ### crossEntropyTerm
446
+ Baseline probability used when smoothing targets.
433
447
 
434
- ```ts
435
- crossEntropyTerm(
436
- targetProbability: number,
437
- clampedProbability: number,
438
- ): number
439
- ```
448
+ ### LENGTH_MISMATCH_MESSAGE
440
449
 
441
- Computes the cross-entropy contribution for a single target/output pair.
450
+ Error message thrown when target and output arrays differ in length.
442
451
 
443
- Parameters:
444
- - `targetProbability` - - Target probability for the sample (may be soft).
445
- - `clampedProbability` - - Output probability already clamped for stability.
452
+ ### NEGATIVE_CLASS_LABEL
446
453
 
447
- Returns: Cross-entropy term for the sample.
454
+ Canonical negative label used by binary-oriented helpers.
448
455
 
449
456
  ### normalizeTargets
450
457
 
@@ -461,35 +468,9 @@ Parameters:
461
468
 
462
469
  Returns: Normalized target probabilities; returns a shallow copy when the sum is zero.
463
470
 
464
- ### stableSoftmax
465
-
466
- ```ts
467
- stableSoftmax(
468
- outputs: number[],
469
- ): number[]
470
- ```
471
-
472
- Computes a numerically stable softmax from raw output scores.
473
-
474
- Parameters:
475
- - `outputs` - - Raw logits or scores.
476
-
477
- Returns: Softmax probabilities corresponding to the inputs.
478
-
479
- ### classifyBinary
480
-
481
- ```ts
482
- classifyBinary(
483
- probability: number,
484
- ): number
485
- ```
486
-
487
- Converts a probability into a binary class label using the configured threshold.
488
-
489
- Parameters:
490
- - `probability` - - Probability to classify.
471
+ ### POSITIVE_CLASS_LABEL
491
472
 
492
- Returns: POSITIVE_CLASS_LABEL when above or equal to threshold; otherwise NEGATIVE_CLASS_LABEL.
473
+ Canonical positive label used by binary-oriented helpers.
493
474
 
494
475
  ### smoothTarget
495
476
 
@@ -507,3 +488,22 @@ Parameters:
507
488
  - `smoothing` - - Smoothing factor between 0 and 1.
508
489
 
509
490
  Returns: Smoothed target probability.
491
+
492
+ ### SOFTMAX_SUM_GUARD
493
+
494
+ Lower bound for softmax denominator to avoid division by zero.
495
+
496
+ ### stableSoftmax
497
+
498
+ ```ts
499
+ stableSoftmax(
500
+ outputs: number[],
501
+ ): number[]
502
+ ```
503
+
504
+ Computes a numerically stable softmax from raw output scores.
505
+
506
+ Parameters:
507
+ - `outputs` - - Raw logits or scores.
508
+
509
+ Returns: Softmax probabilities corresponding to the inputs.
@@ -271,32 +271,41 @@ Returns: A function that calculates the decayed learning rate for a given iterat
271
271
  Learning rate schedule signature that maps a base rate and iteration index to a rate value.
272
272
  Useful for each stateless schedule strategy.
273
273
 
274
- ### createFixedRateSchedule
274
+ ### createCosineAnnealingRateSchedule
275
275
 
276
276
  ```ts
277
- createFixedRateSchedule(): RateSchedule
277
+ createCosineAnnealingRateSchedule(
278
+ period: number,
279
+ minimumRate: number,
280
+ ): RateSchedule
278
281
  ```
279
282
 
280
- Returns a schedule that always yields the base learning rate.
283
+ Returns a cosine annealing learning rate schedule.
281
284
 
282
- Returns: A learning rate schedule that ignores iteration and returns baseRate.
285
+ Parameters:
286
+ - `period` - Length of a full cosine cycle.
287
+ - `minimumRate` - Minimum rate reached at the end of a cycle.
283
288
 
284
- ### createStepRateSchedule
289
+ Returns: A learning rate schedule implementing cosine annealing.
290
+
291
+ ### createCosineAnnealingWarmRestartsSchedule
285
292
 
286
293
  ```ts
287
- createStepRateSchedule(
288
- decayFactor: number,
289
- decayStepSize: number,
294
+ createCosineAnnealingWarmRestartsSchedule(
295
+ initialPeriod: number,
296
+ minimumRate: number,
297
+ periodGrowthMultiplier: number,
290
298
  ): RateSchedule
291
299
  ```
292
300
 
293
- Returns a step decay learning rate schedule.
301
+ Returns a cosine annealing schedule with warm restarts and growing cycles.
294
302
 
295
303
  Parameters:
296
- - `decayFactor` - Multiplicative decay applied at each decay step.
297
- - `decayStepSize` - Number of iterations before applying another decay step.
304
+ - `initialPeriod` - Length of the initial cycle.
305
+ - `minimumRate` - Minimum learning rate reached at the end of each cycle.
306
+ - `periodGrowthMultiplier` - Multiplier applied to the period after each restart.
298
307
 
299
- Returns: A learning rate schedule implementing step decay.
308
+ Returns: A learning rate schedule implementing SGDR-style warm restarts.
300
309
 
301
310
  ### createExponentialRateSchedule
302
311
 
@@ -313,6 +322,16 @@ Parameters:
313
322
 
314
323
  Returns: A learning rate schedule implementing exponential decay.
315
324
 
325
+ ### createFixedRateSchedule
326
+
327
+ ```ts
328
+ createFixedRateSchedule(): RateSchedule
329
+ ```
330
+
331
+ Returns a schedule that always yields the base learning rate.
332
+
333
+ Returns: A learning rate schedule that ignores iteration and returns baseRate.
334
+
316
335
  ### createInverseRateSchedule
317
336
 
318
337
  ```ts
@@ -330,42 +349,6 @@ Parameters:
330
349
 
331
350
  Returns: A learning rate schedule implementing inverse decay.
332
351
 
333
- ### createCosineAnnealingRateSchedule
334
-
335
- ```ts
336
- createCosineAnnealingRateSchedule(
337
- period: number,
338
- minimumRate: number,
339
- ): RateSchedule
340
- ```
341
-
342
- Returns a cosine annealing learning rate schedule.
343
-
344
- Parameters:
345
- - `period` - Length of a full cosine cycle.
346
- - `minimumRate` - Minimum rate reached at the end of a cycle.
347
-
348
- Returns: A learning rate schedule implementing cosine annealing.
349
-
350
- ### createCosineAnnealingWarmRestartsSchedule
351
-
352
- ```ts
353
- createCosineAnnealingWarmRestartsSchedule(
354
- initialPeriod: number,
355
- minimumRate: number,
356
- periodGrowthMultiplier: number,
357
- ): RateSchedule
358
- ```
359
-
360
- Returns a cosine annealing schedule with warm restarts and growing cycles.
361
-
362
- Parameters:
363
- - `initialPeriod` - Length of the initial cycle.
364
- - `minimumRate` - Minimum learning rate reached at the end of each cycle.
365
- - `periodGrowthMultiplier` - Multiplier applied to the period after each restart.
366
-
367
- Returns: A learning rate schedule implementing SGDR-style warm restarts.
368
-
369
352
  ### createLinearWarmupDecaySchedule
370
353
 
371
354
  ```ts
@@ -400,34 +383,26 @@ Parameters:
400
383
 
401
384
  Returns: A stateful schedule that reacts to lack of improvement.
402
385
 
403
- ### RateSchedule
386
+ ### createStepRateSchedule
404
387
 
405
388
  ```ts
406
- RateSchedule(
407
- baseRate: number,
408
- iteration: number,
409
- ): number
389
+ createStepRateSchedule(
390
+ decayFactor: number,
391
+ decayStepSize: number,
392
+ ): RateSchedule
410
393
  ```
411
394
 
412
- Learning rate schedule signature that maps a base rate and iteration index to a rate value.
413
- Useful for each stateless schedule strategy.
414
-
415
- ### ReduceOnPlateauSchedule
395
+ Returns a step decay learning rate schedule.
416
396
 
417
- ```ts
418
- ReduceOnPlateauSchedule(
419
- baseRate: number,
420
- iteration: number,
421
- lastError: number | undefined,
422
- ): number
423
- ```
397
+ Parameters:
398
+ - `decayFactor` - Multiplicative decay applied at each decay step.
399
+ - `decayStepSize` - Number of iterations before applying another decay step.
424
400
 
425
- Stateful ReduceLROnPlateau schedule signature that can react to a loss signal.
426
- The third argument is optional and only needed when monitoring validation error.
401
+ Returns: A learning rate schedule implementing step decay.
427
402
 
428
- ### DEFAULT_STEP_DECAY_FACTOR
403
+ ### DEFAULT_COSINE_PERIOD
429
404
 
430
- Step decay multiplier (close to 1 slows decay; smaller drops faster).
405
+ Length of one cosine annealing cycle in iterations.
431
406
 
432
407
  ### DEFAULT_DECAY_STEP_SIZE
433
408
 
@@ -437,6 +412,10 @@ Step decay interval in iterations; larger values mean fewer decay events.
437
412
 
438
413
  Per-iteration exponential decay factor; values just below 1 create gentle decay.
439
414
 
415
+ ### DEFAULT_INITIAL_PERIOD
416
+
417
+ Initial period length for cosine-with-restarts before growth is applied.
418
+
440
419
  ### DEFAULT_INVERSE_DECAY_FACTOR
441
420
 
442
421
  Inverse decay multiplier; higher values push the denominator up faster and shrink the rate sooner.
@@ -445,46 +424,67 @@ Inverse decay multiplier; higher values push the denominator up faster and shrin
445
424
 
446
425
  Inverse decay exponent; 1 makes decay linear in iteration, 2 makes it quadratic.
447
426
 
448
- ### DEFAULT_COSINE_PERIOD
427
+ ### DEFAULT_LINEAR_END_RATE
449
428
 
450
- Length of one cosine annealing cycle in iterations.
429
+ Target rate after warmup-decay finishes; often zero or a small floor.
451
430
 
452
431
  ### DEFAULT_MINIMUM_RATE
453
432
 
454
433
  Floor learning rate for cosine schedules; keeps the rate from reaching zero.
455
434
 
456
- ### DEFAULT_INITIAL_PERIOD
457
-
458
- Initial period length for cosine-with-restarts before growth is applied.
459
-
460
435
  ### DEFAULT_PERIOD_GROWTH_MULTIPLIER
461
436
 
462
437
  Multiplier applied to the cosine cycle length after each restart (>= 1).
463
438
 
464
- ### DEFAULT_LINEAR_END_RATE
465
-
466
- Target rate after warmup-decay finishes; often zero or a small floor.
467
-
468
- ### DEFAULT_WARMUP_RATIO
439
+ ### DEFAULT_REDUCE_ON_PLATEAU_COOLDOWN
469
440
 
470
- Default warmup share of the schedule; 0.1 means 10% of total steps.
441
+ Cooldown iterations after a reduction to avoid rapid successive cuts.
471
442
 
472
443
  ### DEFAULT_REDUCE_ON_PLATEAU_FACTOR
473
444
 
474
445
  Reduce-on-plateau shrink factor; halving (0.5) is a common conservative step.
475
446
 
447
+ ### DEFAULT_REDUCE_ON_PLATEAU_MIN_DELTA
448
+
449
+ Minimum required improvement to count as progress when monitoring error.
450
+
451
+ ### DEFAULT_REDUCE_ON_PLATEAU_MIN_RATE
452
+
453
+ Minimum rate allowed during reduce-on-plateau adjustments.
454
+
476
455
  ### DEFAULT_REDUCE_ON_PLATEAU_PATIENCE
477
456
 
478
457
  Patience for reduce-on-plateau in iterations before triggering a cut.
479
458
 
480
- ### DEFAULT_REDUCE_ON_PLATEAU_MIN_DELTA
459
+ ### DEFAULT_STEP_DECAY_FACTOR
481
460
 
482
- Minimum required improvement to count as progress when monitoring error.
461
+ Step decay multiplier (close to 1 slows decay; smaller drops faster).
483
462
 
484
- ### DEFAULT_REDUCE_ON_PLATEAU_COOLDOWN
463
+ ### DEFAULT_WARMUP_RATIO
485
464
 
486
- Cooldown iterations after a reduction to avoid rapid successive cuts.
465
+ Default warmup share of the schedule; 0.1 means 10% of total steps.
487
466
 
488
- ### DEFAULT_REDUCE_ON_PLATEAU_MIN_RATE
467
+ ### RateSchedule
489
468
 
490
- Minimum rate allowed during reduce-on-plateau adjustments.
469
+ ```ts
470
+ RateSchedule(
471
+ baseRate: number,
472
+ iteration: number,
473
+ ): number
474
+ ```
475
+
476
+ Learning rate schedule signature that maps a base rate and iteration index to a rate value.
477
+ Useful for each stateless schedule strategy.
478
+
479
+ ### ReduceOnPlateauSchedule
480
+
481
+ ```ts
482
+ ReduceOnPlateauSchedule(
483
+ baseRate: number,
484
+ iteration: number,
485
+ lastError: number | undefined,
486
+ ): number
487
+ ```
488
+
489
+ Stateful ReduceLROnPlateau schedule signature that can react to a loss signal.
490
+ The third argument is optional and only needed when monitoring validation error.