@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.
- package/.github/copilot-instructions.md +11 -0
- package/.github/skills/trace-analyzer-extension/SKILL.md +3 -3
- package/.github/skills/trace-analyzer-extension/assets/extension-checklist.md +1 -1
- package/.github/skills/trace-analyzer-extension/references/analyzer-extension-workflow.md +1 -1
- package/.github/skills/trace-audit-reporting/SKILL.md +3 -3
- package/.github/skills/trace-audit-reporting/references/trace-analysis-workflow.md +1 -1
- package/package.json +19 -13
- package/plans/Flappy_Bird_Folder_Documentation_Pass.md +4 -4
- package/plans/README.md +24 -0
- package/plans/Roadmap.md +62 -40
- package/plans/analyze-trace-solid-split.plans.md +66 -0
- package/plans/architecture-solid-split.plans.md +9 -15
- package/plans/asciiMaze-typescript-repair.plans.md +1 -1
- package/plans/generate-docs-solid-split.plans.md +87 -0
- package/plans/methods-docs.plans.md +25 -1
- package/plans/methods-solid-split.plans.md +14 -14
- package/plans/neat-docs.plans.md +9 -1
- package/plans/neat-test-surface-repair.plans.md +1 -1
- package/plans/render-docs-html-solid-split.plans.md +68 -0
- package/plans/src-no-explicit-any-cleanup.plans.md +1 -1
- package/plans/utils-docs.plans.md +6 -1
- package/scripts/analyze-trace/analyze-trace.analysis.ts +479 -0
- package/scripts/analyze-trace/analyze-trace.constants.ts +35 -0
- package/scripts/analyze-trace/analyze-trace.io.ts +69 -0
- package/scripts/analyze-trace/analyze-trace.report.ts +100 -0
- package/scripts/analyze-trace/analyze-trace.shared.ts +116 -0
- package/scripts/analyze-trace/analyze-trace.ts +45 -0
- package/scripts/analyze-trace/analyze-trace.types.ts +72 -0
- package/scripts/assets/theme.css +80 -23
- package/scripts/copy-examples.ts +239 -0
- package/scripts/export-onnx.ts +223 -0
- package/scripts/generate-bench-tables.ts +378 -37
- package/scripts/generate-docs/generate-docs.constants.ts +107 -0
- package/scripts/generate-docs/generate-docs.order.ts +355 -0
- package/scripts/generate-docs/generate-docs.state.ts +31 -0
- package/scripts/generate-docs/generate-docs.targets.ts +165 -0
- package/scripts/generate-docs/generate-docs.ts +63 -0
- package/scripts/generate-docs/generate-docs.types.ts +112 -0
- package/scripts/generate-docs/output/generate-docs.output.folder-index.utils.ts +167 -0
- package/scripts/generate-docs/output/generate-docs.output.ordering.utils.ts +353 -0
- package/scripts/generate-docs/output/generate-docs.output.readme.utils.ts +420 -0
- package/scripts/generate-docs/output/generate-docs.output.ts +123 -0
- package/scripts/generate-docs/output/generate-docs.output.warnings.utils.ts +219 -0
- package/scripts/generate-docs/symbols/generate-docs.symbols.collection.utils.ts +365 -0
- package/scripts/generate-docs/symbols/generate-docs.symbols.jsdoc.utils.ts +373 -0
- package/scripts/generate-docs/symbols/generate-docs.symbols.normalize.utils.ts +155 -0
- package/scripts/generate-docs/symbols/generate-docs.symbols.render.utils.ts +149 -0
- package/scripts/generate-docs/symbols/generate-docs.symbols.signature.utils.ts +289 -0
- package/scripts/generate-docs/symbols/generate-docs.symbols.ts +11 -0
- package/scripts/mermaid-cli.mjs +102 -22
- package/scripts/mermaid-cli.ts +736 -0
- package/scripts/render-docs-html/render-docs-html.assets.ts +54 -0
- package/scripts/render-docs-html/render-docs-html.mermaid.ts +245 -0
- package/scripts/{render-docs-html.sidebar.ts → render-docs-html/render-docs-html.navigation.ts} +141 -144
- package/scripts/render-docs-html/render-docs-html.pages.ts +333 -0
- package/scripts/render-docs-html/render-docs-html.shared.ts +333 -0
- package/scripts/render-docs-html/render-docs-html.types.ts +42 -0
- package/scripts/render-docs-html.ts +23 -587
- package/scripts/run-docs.ts +238 -0
- package/scripts/write-dist-docs-pkg.ts +40 -0
- package/src/README.md +75 -75
- package/src/architecture/connection/README.md +5 -5
- package/src/architecture/layer/README.md +508 -508
- package/src/architecture/network/README.md +1458 -1458
- package/src/architecture/network/activate/README.md +694 -694
- package/src/architecture/network/bootstrap/README.md +77 -77
- package/src/architecture/network/connect/README.md +74 -74
- package/src/architecture/network/deterministic/README.md +135 -135
- package/src/architecture/network/evolve/README.md +364 -364
- package/src/architecture/network/gating/README.md +130 -130
- package/src/architecture/network/genetic/README.md +399 -399
- package/src/architecture/network/mutate/README.md +897 -897
- package/src/architecture/network/onnx/README.md +720 -720
- package/src/architecture/network/onnx/export/README.md +728 -728
- package/src/architecture/network/onnx/export/layers/README.md +450 -450
- package/src/architecture/network/onnx/import/README.md +618 -618
- package/src/architecture/network/onnx/schema/README.md +32 -32
- package/src/architecture/network/prune/README.md +245 -245
- package/src/architecture/network/remove/README.md +135 -135
- package/src/architecture/network/runtime/README.md +106 -106
- package/src/architecture/network/serialize/README.md +542 -542
- package/src/architecture/network/slab/README.md +608 -608
- package/src/architecture/network/standalone/README.md +212 -212
- package/src/architecture/network/stats/README.md +84 -84
- package/src/architecture/network/topology/README.md +465 -465
- package/src/architecture/network/training/README.md +200 -200
- package/src/architecture/node/README.md +5 -5
- package/src/architecture/nodePool/README.md +14 -14
- package/src/methods/README.md +99 -99
- package/src/methods/activation/README.md +189 -189
- package/src/methods/cost/README.md +131 -131
- package/src/methods/rate/README.md +86 -86
- package/src/multithreading/README.md +77 -77
- package/src/multithreading/workers/browser/README.md +8 -8
- package/src/multithreading/workers/node/README.md +8 -8
- package/src/neat/README.md +148 -148
- package/src/neat/adaptive/README.md +120 -120
- package/src/neat/adaptive/acceptance/README.md +40 -40
- package/src/neat/adaptive/complexity/README.md +137 -137
- package/src/neat/adaptive/core/README.md +197 -197
- package/src/neat/adaptive/lineage/README.md +90 -90
- package/src/neat/adaptive/mutation/README.md +284 -284
- package/src/neat/compat/README.md +43 -43
- package/src/neat/compat/core/README.md +90 -90
- package/src/neat/diversity/README.md +35 -35
- package/src/neat/diversity/core/README.md +88 -88
- package/src/neat/evaluate/README.md +85 -85
- package/src/neat/evaluate/auto-distance/README.md +75 -75
- package/src/neat/evaluate/entropy-compat/README.md +37 -37
- package/src/neat/evaluate/entropy-sharing/README.md +43 -43
- package/src/neat/evaluate/fitness/README.md +23 -23
- package/src/neat/evaluate/novelty/README.md +120 -120
- package/src/neat/evaluate/objectives/README.md +17 -17
- package/src/neat/evaluate/shared/README.md +94 -94
- package/src/neat/evolve/README.md +96 -96
- package/src/neat/evolve/adaptive/README.md +60 -60
- package/src/neat/evolve/objectives/README.md +63 -63
- package/src/neat/evolve/offspring/README.md +56 -56
- package/src/neat/evolve/population/README.md +171 -171
- package/src/neat/evolve/runtime/README.md +79 -79
- package/src/neat/evolve/speciation/README.md +74 -74
- package/src/neat/evolve/warnings/README.md +10 -10
- package/src/neat/export/README.md +114 -114
- package/src/neat/helpers/README.md +50 -50
- package/src/neat/init/README.md +9 -9
- package/src/neat/lineage/core/README.md +101 -101
- package/src/neat/multiobjective/category/README.md +74 -74
- package/src/neat/multiobjective/crowding/README.md +272 -272
- package/src/neat/multiobjective/dominance/README.md +171 -171
- package/src/neat/multiobjective/fronts/README.md +68 -68
- package/src/neat/multiobjective/metrics/README.md +43 -43
- package/src/neat/multiobjective/objectives/README.md +31 -31
- package/src/neat/multiobjective/shared/README.md +27 -27
- package/src/neat/mutation/README.md +97 -97
- package/src/neat/mutation/add-conn/README.md +115 -115
- package/src/neat/mutation/add-node/README.md +126 -126
- package/src/neat/mutation/flow/README.md +149 -149
- package/src/neat/mutation/repair/README.md +185 -185
- package/src/neat/mutation/select/README.md +117 -117
- package/src/neat/mutation/shared/README.md +32 -32
- package/src/neat/objectives/README.md +25 -25
- package/src/neat/objectives/core/README.md +67 -67
- package/src/neat/pruning/README.md +40 -40
- package/src/neat/pruning/core/README.md +171 -171
- package/src/neat/pruning/facade/README.md +32 -32
- package/src/neat/rng/README.md +104 -104
- package/src/neat/rng/core/README.md +137 -137
- package/src/neat/rng/facade/README.md +50 -50
- package/src/neat/selection/README.md +111 -111
- package/src/neat/selection/core/README.md +227 -227
- package/src/neat/selection/facade/README.md +61 -61
- package/src/neat/shared/README.md +163 -163
- package/src/neat/speciation/README.md +31 -31
- package/src/neat/speciation/threshold/README.md +35 -35
- package/src/neat/species/README.md +25 -25
- package/src/neat/species/core/README.md +20 -20
- package/src/neat/species/core/shared/README.md +18 -18
- package/src/neat/species/history/context/README.md +22 -22
- package/src/neat/telemetry/accessors/README.md +58 -58
- package/src/neat/telemetry/exports/README.md +233 -233
- package/src/neat/telemetry/facade/README.md +252 -252
- package/src/neat/telemetry/facade/archive/README.md +57 -57
- package/src/neat/telemetry/facade/buffer/README.md +43 -43
- package/src/neat/telemetry/facade/lineage/README.md +12 -12
- package/src/neat/telemetry/facade/objectives/README.md +44 -44
- package/src/neat/telemetry/facade/runtime/README.md +26 -26
- package/src/neat/telemetry/facade/species/README.md +27 -27
- package/src/neat/telemetry/metrics/README.md +696 -696
- package/src/neat/telemetry/recorder/README.md +57 -57
- package/src/neat/telemetry/types/README.md +32 -32
- package/src/neat/topology-intent/README.md +75 -75
- package/src/utils/README.md +193 -193
- package/test/examples/asciiMaze/browser-entry/README.md +92 -92
- package/test/examples/asciiMaze/dashboardManager/README.md +109 -109
- package/test/examples/asciiMaze/dashboardManager/telemetry/README.md +28 -28
- package/test/examples/asciiMaze/evolutionEngine/README.md +1527 -1527
- package/test/examples/asciiMaze/mazeMovement/README.md +105 -105
- package/test/examples/asciiMaze/mazeMovement/finalization/README.md +16 -16
- package/test/examples/asciiMaze/mazeMovement/policy/README.md +57 -57
- package/test/examples/asciiMaze/mazeMovement/runtime/README.md +52 -52
- package/test/examples/asciiMaze/mazeMovement/shaping/README.md +46 -46
- package/test/examples/flappy_bird/browser-entry/README.md +508 -508
- package/test/examples/flappy_bird/browser-entry/host/README.md +101 -101
- package/test/examples/flappy_bird/browser-entry/host/resize/README.md +144 -144
- package/test/examples/flappy_bird/browser-entry/network-view/README.md +194 -194
- package/test/examples/flappy_bird/browser-entry/playback/README.md +278 -278
- package/test/examples/flappy_bird/browser-entry/playback/background/README.md +129 -129
- package/test/examples/flappy_bird/browser-entry/playback/background/ground-grid/README.md +502 -502
- package/test/examples/flappy_bird/browser-entry/playback/frame-render/README.md +139 -139
- package/test/examples/flappy_bird/browser-entry/playback/snapshot/README.md +10 -10
- package/test/examples/flappy_bird/browser-entry/playback/trail/README.md +43 -43
- package/test/examples/flappy_bird/browser-entry/playback/worker-channel/README.md +30 -30
- package/test/examples/flappy_bird/browser-entry/runtime/README.md +59 -59
- package/test/examples/flappy_bird/browser-entry/visualization/README.md +276 -276
- package/test/examples/flappy_bird/browser-entry/worker-channel/README.md +16 -16
- package/test/examples/flappy_bird/constants/README.md +1070 -1070
- package/test/examples/flappy_bird/environment/README.md +22 -22
- package/test/examples/flappy_bird/evaluation/README.md +32 -32
- package/test/examples/flappy_bird/evaluation/rollout/README.md +141 -141
- package/test/examples/flappy_bird/flappy-evolution-worker/README.md +425 -425
- package/test/examples/flappy_bird/simulation-shared/README.md +170 -170
- package/test/examples/flappy_bird/simulation-shared/observation/README.md +109 -109
- package/test/examples/flappy_bird/trainer/README.md +325 -325
- package/test/examples/flappy_bird/trainer/evaluation/README.md +74 -74
- package/scripts/analyze-trace.ts +0 -590
- package/scripts/copy-examples.mjs +0 -114
- package/scripts/export-onnx.mjs +0 -86
- package/scripts/generate-bench-tables.mjs +0 -182
- package/scripts/generate-docs.ts +0 -2900
- 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
|
-
###
|
|
269
|
+
### computeFocalLoss
|
|
219
270
|
|
|
220
271
|
```ts
|
|
221
|
-
|
|
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
|
|
280
|
+
Computes focal loss for imbalanced classification tasks.
|
|
228
281
|
|
|
229
282
|
Parameters:
|
|
230
|
-
- `targets` - -
|
|
231
|
-
- `outputs` - -
|
|
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:
|
|
288
|
+
Returns: Mean focal loss.
|
|
234
289
|
|
|
235
|
-
###
|
|
290
|
+
### computeHingeLoss
|
|
236
291
|
|
|
237
292
|
```ts
|
|
238
|
-
|
|
293
|
+
computeHingeLoss(
|
|
239
294
|
targets: number[],
|
|
240
295
|
outputs: number[],
|
|
241
296
|
): number
|
|
242
297
|
```
|
|
243
298
|
|
|
244
|
-
Computes
|
|
299
|
+
Computes hinge loss for margin-based classification.
|
|
245
300
|
|
|
246
301
|
Parameters:
|
|
247
|
-
- `targets` - -
|
|
248
|
-
- `outputs` - - Model outputs.
|
|
302
|
+
- `targets` - - Target labels encoded as -1 or 1.
|
|
303
|
+
- `outputs` - - Model outputs (raw scores).
|
|
249
304
|
|
|
250
|
-
Returns: Mean
|
|
305
|
+
Returns: Mean hinge loss.
|
|
251
306
|
|
|
252
|
-
###
|
|
307
|
+
### computeLabelSmoothingLoss
|
|
253
308
|
|
|
254
309
|
```ts
|
|
255
|
-
|
|
310
|
+
computeLabelSmoothingLoss(
|
|
256
311
|
targets: number[],
|
|
257
312
|
outputs: number[],
|
|
313
|
+
smoothing: number,
|
|
258
314
|
): number
|
|
259
315
|
```
|
|
260
316
|
|
|
261
|
-
Computes
|
|
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:
|
|
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
|
-
###
|
|
360
|
+
### computeMeanSquaredError
|
|
304
361
|
|
|
305
362
|
```ts
|
|
306
|
-
|
|
363
|
+
computeMeanSquaredError(
|
|
307
364
|
targets: number[],
|
|
308
365
|
outputs: number[],
|
|
309
366
|
): number
|
|
310
367
|
```
|
|
311
368
|
|
|
312
|
-
Computes mean squared
|
|
369
|
+
Computes mean squared error between targets and outputs.
|
|
313
370
|
|
|
314
371
|
Parameters:
|
|
315
|
-
- `targets` - - Desired
|
|
316
|
-
- `outputs` - - Model outputs
|
|
372
|
+
- `targets` - - Desired target values.
|
|
373
|
+
- `outputs` - - Model outputs.
|
|
317
374
|
|
|
318
|
-
Returns: Mean squared
|
|
375
|
+
Returns: Mean squared error.
|
|
319
376
|
|
|
320
|
-
###
|
|
377
|
+
### computeMeanSquaredLogarithmicError
|
|
321
378
|
|
|
322
379
|
```ts
|
|
323
|
-
|
|
380
|
+
computeMeanSquaredLogarithmicError(
|
|
324
381
|
targets: number[],
|
|
325
382
|
outputs: number[],
|
|
326
383
|
): number
|
|
327
384
|
```
|
|
328
385
|
|
|
329
|
-
Computes
|
|
386
|
+
Computes mean squared logarithmic error between targets and outputs.
|
|
330
387
|
|
|
331
388
|
Parameters:
|
|
332
|
-
- `targets` - -
|
|
333
|
-
- `outputs` - - Model outputs (
|
|
389
|
+
- `targets` - - Desired non-negative target values.
|
|
390
|
+
- `outputs` - - Model outputs (expected non-negative).
|
|
334
391
|
|
|
335
|
-
Returns: Mean
|
|
392
|
+
Returns: Mean squared logarithmic error.
|
|
336
393
|
|
|
337
|
-
###
|
|
394
|
+
### computeSoftmaxCrossEntropy
|
|
338
395
|
|
|
339
396
|
```ts
|
|
340
|
-
|
|
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
|
|
403
|
+
Computes the softmax cross entropy given targets and raw score outputs.
|
|
349
404
|
|
|
350
405
|
Parameters:
|
|
351
|
-
- `targets` - -
|
|
352
|
-
- `outputs` - -
|
|
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:
|
|
409
|
+
Returns: Total (non-averaged) softmax cross-entropy loss.
|
|
357
410
|
|
|
358
|
-
###
|
|
411
|
+
### crossEntropyTerm
|
|
359
412
|
|
|
360
413
|
```ts
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
smoothing: number,
|
|
414
|
+
crossEntropyTerm(
|
|
415
|
+
targetProbability: number,
|
|
416
|
+
clampedProbability: number,
|
|
365
417
|
): number
|
|
366
418
|
```
|
|
367
419
|
|
|
368
|
-
Computes cross
|
|
420
|
+
Computes the cross-entropy contribution for a single target/output pair.
|
|
369
421
|
|
|
370
422
|
Parameters:
|
|
371
|
-
- `
|
|
372
|
-
- `
|
|
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
|
-
|
|
426
|
+
Returns: Cross-entropy term for the sample.
|
|
392
427
|
|
|
393
|
-
###
|
|
428
|
+
### DEFAULT_FOCAL_ALPHA
|
|
394
429
|
|
|
395
|
-
|
|
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
|
-
###
|
|
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
|
-
|
|
428
|
-
- `probability` - - Raw probability value to bound.
|
|
442
|
+
Margin enforced by hinge loss.
|
|
429
443
|
|
|
430
|
-
|
|
444
|
+
### LABEL_SMOOTHING_BASELINE
|
|
431
445
|
|
|
432
|
-
|
|
446
|
+
Baseline probability used when smoothing targets.
|
|
433
447
|
|
|
434
|
-
|
|
435
|
-
crossEntropyTerm(
|
|
436
|
-
targetProbability: number,
|
|
437
|
-
clampedProbability: number,
|
|
438
|
-
): number
|
|
439
|
-
```
|
|
448
|
+
### LENGTH_MISMATCH_MESSAGE
|
|
440
449
|
|
|
441
|
-
|
|
450
|
+
Error message thrown when target and output arrays differ in length.
|
|
442
451
|
|
|
443
|
-
|
|
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
|
-
|
|
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
|
-
###
|
|
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
|
-
|
|
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
|
-
###
|
|
274
|
+
### createCosineAnnealingRateSchedule
|
|
275
275
|
|
|
276
276
|
```ts
|
|
277
|
-
|
|
277
|
+
createCosineAnnealingRateSchedule(
|
|
278
|
+
period: number,
|
|
279
|
+
minimumRate: number,
|
|
280
|
+
): RateSchedule
|
|
278
281
|
```
|
|
279
282
|
|
|
280
|
-
Returns a
|
|
283
|
+
Returns a cosine annealing learning rate schedule.
|
|
281
284
|
|
|
282
|
-
|
|
285
|
+
Parameters:
|
|
286
|
+
- `period` - Length of a full cosine cycle.
|
|
287
|
+
- `minimumRate` - Minimum rate reached at the end of a cycle.
|
|
283
288
|
|
|
284
|
-
|
|
289
|
+
Returns: A learning rate schedule implementing cosine annealing.
|
|
290
|
+
|
|
291
|
+
### createCosineAnnealingWarmRestartsSchedule
|
|
285
292
|
|
|
286
293
|
```ts
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
294
|
+
createCosineAnnealingWarmRestartsSchedule(
|
|
295
|
+
initialPeriod: number,
|
|
296
|
+
minimumRate: number,
|
|
297
|
+
periodGrowthMultiplier: number,
|
|
290
298
|
): RateSchedule
|
|
291
299
|
```
|
|
292
300
|
|
|
293
|
-
Returns a
|
|
301
|
+
Returns a cosine annealing schedule with warm restarts and growing cycles.
|
|
294
302
|
|
|
295
303
|
Parameters:
|
|
296
|
-
- `
|
|
297
|
-
- `
|
|
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
|
|
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
|
-
###
|
|
386
|
+
### createStepRateSchedule
|
|
404
387
|
|
|
405
388
|
```ts
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
):
|
|
389
|
+
createStepRateSchedule(
|
|
390
|
+
decayFactor: number,
|
|
391
|
+
decayStepSize: number,
|
|
392
|
+
): RateSchedule
|
|
410
393
|
```
|
|
411
394
|
|
|
412
|
-
|
|
413
|
-
Useful for each stateless schedule strategy.
|
|
414
|
-
|
|
415
|
-
### ReduceOnPlateauSchedule
|
|
395
|
+
Returns a step decay learning rate schedule.
|
|
416
396
|
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
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
|
-
|
|
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
|
-
###
|
|
403
|
+
### DEFAULT_COSINE_PERIOD
|
|
429
404
|
|
|
430
|
-
|
|
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
|
-
###
|
|
427
|
+
### DEFAULT_LINEAR_END_RATE
|
|
449
428
|
|
|
450
|
-
|
|
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
|
-
###
|
|
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
|
-
|
|
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
|
-
###
|
|
459
|
+
### DEFAULT_STEP_DECAY_FACTOR
|
|
481
460
|
|
|
482
|
-
|
|
461
|
+
Step decay multiplier (close to 1 slows decay; smaller drops faster).
|
|
483
462
|
|
|
484
|
-
###
|
|
463
|
+
### DEFAULT_WARMUP_RATIO
|
|
485
464
|
|
|
486
|
-
|
|
465
|
+
Default warmup share of the schedule; 0.1 means 10% of total steps.
|
|
487
466
|
|
|
488
|
-
###
|
|
467
|
+
### RateSchedule
|
|
489
468
|
|
|
490
|
-
|
|
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.
|