@reicek/neataptic-ts 0.1.21 → 0.1.22
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/agents/boundary-mapper.agent.md +29 -0
- package/.github/agents/docs-scout.agent.md +29 -0
- package/.github/agents/plan-scout.agent.md +29 -0
- package/.github/agents/solid-split.agent.md +138 -0
- package/.github/copilot-instructions.md +103 -0
- package/package.json +6 -3
- package/plans/ES2023 migration +13 -8
- package/plans/Evolution_Training_Interoperability_Contracts.md +1 -1
- package/plans/Interactive_Examples_and_Learning_Path.md +10 -2
- package/plans/Memory_Optimization.md +3 -3
- package/plans/README.md +63 -0
- package/plans/Roadmap.md +15 -3
- package/plans/asciiMaze_SOLID_split.done.md +130 -0
- package/plans/flappy_bird_SOLID_split.done.md +67 -0
- package/scripts/assets/theme.css +221 -34
- package/scripts/copy-examples.mjs +9 -5
- package/scripts/export-onnx.mjs +3 -3
- package/scripts/generate-bench-tables.mjs +10 -10
- package/scripts/generate-bench-tables.ts +10 -10
- package/scripts/generate-docs.ts +1415 -449
- package/scripts/render-docs-html.ts +15 -8
- package/src/README.md +101 -223
- package/src/architecture/README.md +57 -185
- package/src/architecture/layer/README.md +38 -38
- package/src/architecture/network/README.md +33 -31
- package/src/architecture/network/activate/README.md +77 -77
- package/src/architecture/network/connect/README.md +15 -13
- package/src/architecture/network/deterministic/README.md +7 -7
- package/src/architecture/network/evolve/README.md +44 -44
- package/src/architecture/network/gating/README.md +20 -20
- package/src/architecture/network/genetic/README.md +51 -51
- package/src/architecture/network/mutate/README.md +97 -97
- package/src/architecture/network/onnx/README.md +264 -264
- package/src/architecture/network/prune/README.md +39 -39
- package/src/architecture/network/remove/README.md +26 -26
- package/src/architecture/network/serialize/README.md +56 -56
- package/src/architecture/network/slab/README.md +61 -61
- package/src/architecture/network/standalone/README.md +24 -24
- package/src/architecture/network/stats/README.md +9 -9
- package/src/architecture/network/topology/README.md +46 -46
- package/src/architecture/network/training/README.md +21 -21
- package/src/methods/README.md +9 -87
- package/src/multithreading/README.md +8 -77
- package/src/multithreading/workers/README.md +2 -2
- package/src/multithreading/workers/browser/README.md +0 -6
- package/src/multithreading/workers/node/README.md +0 -3
- package/src/neat/README.md +562 -568
- package/src/utils/README.md +18 -18
- package/test/examples/asciiMaze/README.md +59 -59
- package/test/examples/asciiMaze/asciiMaze.e2e.test.ts +14 -9
- package/test/examples/asciiMaze/browser-entry/README.md +196 -0
- package/test/examples/asciiMaze/browser-entry/browser-entry.abort.services.ts +95 -0
- package/test/examples/asciiMaze/browser-entry/browser-entry.constants.ts +23 -0
- package/test/examples/asciiMaze/browser-entry/browser-entry.curriculum.services.ts +115 -0
- package/test/examples/asciiMaze/browser-entry/browser-entry.globals.services.ts +106 -0
- package/test/examples/asciiMaze/browser-entry/browser-entry.host.services.ts +157 -0
- package/test/examples/asciiMaze/browser-entry/browser-entry.services.ts +14 -0
- package/test/examples/asciiMaze/browser-entry/browser-entry.ts +129 -0
- package/test/examples/asciiMaze/browser-entry/browser-entry.types.ts +120 -0
- package/test/examples/asciiMaze/browser-entry/browser-entry.utils.ts +98 -0
- package/test/examples/asciiMaze/browser-entry.ts +10 -576
- package/test/examples/asciiMaze/dashboardManager/README.md +276 -0
- package/test/examples/asciiMaze/dashboardManager/archive/README.md +16 -0
- package/test/examples/asciiMaze/dashboardManager/archive/dashboardManager.archive.services.ts +267 -0
- package/test/examples/asciiMaze/dashboardManager/dashboardManager.constants.ts +35 -0
- package/test/examples/asciiMaze/dashboardManager/dashboardManager.services.ts +103 -0
- package/test/examples/asciiMaze/dashboardManager/dashboardManager.ts +181 -0
- package/test/examples/asciiMaze/dashboardManager/dashboardManager.types.ts +267 -0
- package/test/examples/asciiMaze/dashboardManager/dashboardManager.utils.ts +254 -0
- package/test/examples/asciiMaze/dashboardManager/live/README.md +14 -0
- package/test/examples/asciiMaze/dashboardManager/live/dashboardManager.live.services.ts +264 -0
- package/test/examples/asciiMaze/dashboardManager/telemetry/README.md +47 -0
- package/test/examples/asciiMaze/dashboardManager/telemetry/dashboardManager.telemetry.services.ts +513 -0
- package/test/examples/asciiMaze/dashboardManager.ts +13 -2335
- package/test/examples/asciiMaze/evolutionEngine/README.md +1058 -0
- package/test/examples/asciiMaze/evolutionEngine/curriculumPhase.ts +90 -0
- package/test/examples/asciiMaze/evolutionEngine/engineState.constants.ts +36 -0
- package/test/examples/asciiMaze/evolutionEngine/engineState.ts +58 -513
- package/test/examples/asciiMaze/evolutionEngine/engineState.types.ts +212 -0
- package/test/examples/asciiMaze/evolutionEngine/engineState.utils.ts +301 -0
- package/test/examples/asciiMaze/evolutionEngine/evolutionEngine.types.ts +445 -0
- package/test/examples/asciiMaze/evolutionEngine/evolutionLoop.ts +81 -50
- package/test/examples/asciiMaze/evolutionEngine/optionsAndSetup.ts +2 -4
- package/test/examples/asciiMaze/evolutionEngine/populationDynamics.ts +17 -33
- package/test/examples/asciiMaze/evolutionEngine/populationPruning.ts +1 -1
- package/test/examples/asciiMaze/evolutionEngine/rngAndTiming.ts +1 -2
- package/test/examples/asciiMaze/evolutionEngine/sampling.ts +1 -1
- package/test/examples/asciiMaze/evolutionEngine/scratchPools.ts +2 -5
- package/test/examples/asciiMaze/evolutionEngine/setupHelpers.ts +30 -37
- package/test/examples/asciiMaze/evolutionEngine/telemetryMetrics.ts +16 -58
- package/test/examples/asciiMaze/evolutionEngine/trainingWarmStart.ts +2 -2
- package/test/examples/asciiMaze/evolutionEngine.ts +55 -55
- package/test/examples/asciiMaze/fitness.ts +2 -2
- package/test/examples/asciiMaze/fitness.types.ts +65 -0
- package/test/examples/asciiMaze/interfaces.ts +64 -1352
- package/test/examples/asciiMaze/mazeMovement/README.md +356 -0
- package/test/examples/asciiMaze/mazeMovement/finalization/README.md +49 -0
- package/test/examples/asciiMaze/mazeMovement/finalization/mazeMovement.finalization.ts +138 -0
- package/test/examples/asciiMaze/mazeMovement/mazeMovement.constants.ts +101 -0
- package/test/examples/asciiMaze/mazeMovement/mazeMovement.services.ts +230 -0
- package/test/examples/asciiMaze/mazeMovement/mazeMovement.ts +299 -0
- package/test/examples/asciiMaze/mazeMovement/mazeMovement.types.ts +185 -0
- package/test/examples/asciiMaze/mazeMovement/mazeMovement.utils.ts +153 -0
- package/test/examples/asciiMaze/mazeMovement/policy/README.md +91 -0
- package/test/examples/asciiMaze/mazeMovement/policy/mazeMovement.policy.ts +467 -0
- package/test/examples/asciiMaze/mazeMovement/runtime/README.md +95 -0
- package/test/examples/asciiMaze/mazeMovement/runtime/mazeMovement.runtime.ts +354 -0
- package/test/examples/asciiMaze/mazeMovement/shaping/README.md +124 -0
- package/test/examples/asciiMaze/mazeMovement/shaping/mazeMovement.shaping.ts +459 -0
- package/test/examples/asciiMaze/mazeMovement.ts +12 -2978
- package/test/examples/flappy_bird/Trace-20260309T191949.json +24124 -0
- package/test/examples/flappy_bird/browser-entry/README.md +1129 -0
- package/test/examples/flappy_bird/browser-entry/browser-entry.host.utils.ts +4 -324
- package/test/examples/flappy_bird/browser-entry/browser-entry.network-view.utils.ts +6 -399
- package/test/examples/flappy_bird/browser-entry/browser-entry.playback.utils.ts +1 -717
- package/test/examples/flappy_bird/browser-entry/browser-entry.spawn.utils.ts +11 -31
- package/test/examples/flappy_bird/browser-entry/browser-entry.visualization.utils.ts +15 -893
- package/test/examples/flappy_bird/browser-entry/host/README.md +307 -0
- package/test/examples/flappy_bird/browser-entry/host/host.resize.service.ts +1 -295
- package/test/examples/flappy_bird/browser-entry/host/host.ts +562 -6
- package/test/examples/flappy_bird/browser-entry/host/resize/README.md +274 -0
- package/test/examples/flappy_bird/browser-entry/host/resize/host.resize.service.constants.ts +31 -0
- package/test/examples/flappy_bird/browser-entry/host/resize/host.resize.service.services.ts +360 -0
- package/test/examples/flappy_bird/browser-entry/host/resize/host.resize.service.ts +117 -0
- package/test/examples/flappy_bird/browser-entry/host/resize/host.resize.service.types.ts +63 -0
- package/test/examples/flappy_bird/browser-entry/host/resize/host.resize.service.utils.ts +250 -0
- package/test/examples/flappy_bird/browser-entry/network-view/README.md +399 -0
- package/test/examples/flappy_bird/browser-entry/network-view/network-view.topology.utils.ts +255 -0
- package/test/examples/flappy_bird/browser-entry/network-view/network-view.ts +802 -7
- package/test/examples/flappy_bird/browser-entry/playback/README.md +684 -0
- package/test/examples/flappy_bird/browser-entry/playback/background/README.md +277 -0
- package/test/examples/flappy_bird/browser-entry/playback/background/ground-grid/README.md +770 -0
- package/test/examples/flappy_bird/browser-entry/playback/background/ground-grid/playback.background.ground-grid.cache.services.ts +178 -0
- package/test/examples/flappy_bird/browser-entry/playback/background/ground-grid/playback.background.ground-grid.constants.ts +107 -0
- package/test/examples/flappy_bird/browser-entry/playback/background/ground-grid/playback.background.ground-grid.geometry.utils.ts +518 -0
- package/test/examples/flappy_bird/browser-entry/playback/background/ground-grid/playback.background.ground-grid.math.utils.ts +117 -0
- package/test/examples/flappy_bird/browser-entry/playback/background/ground-grid/playback.background.ground-grid.pulse.utils.ts +233 -0
- package/test/examples/flappy_bird/browser-entry/playback/background/ground-grid/playback.background.ground-grid.services.ts +211 -0
- package/test/examples/flappy_bird/browser-entry/playback/background/ground-grid/playback.background.ground-grid.ts +48 -0
- package/test/examples/flappy_bird/browser-entry/playback/background/ground-grid/playback.background.ground-grid.types.ts +212 -0
- package/test/examples/flappy_bird/browser-entry/playback/background/ground-grid/playback.background.ground-grid.utils.ts +81 -0
- package/test/examples/flappy_bird/browser-entry/playback/background/playback.background.cache.services.ts +96 -0
- package/test/examples/flappy_bird/browser-entry/playback/background/playback.background.constants.ts +62 -0
- package/test/examples/flappy_bird/browser-entry/playback/background/playback.background.services.ts +244 -0
- package/test/examples/flappy_bird/browser-entry/playback/background/playback.background.ts +53 -0
- package/test/examples/flappy_bird/browser-entry/playback/background/playback.background.types.ts +68 -0
- package/test/examples/flappy_bird/browser-entry/playback/background/playback.background.utils.ts +100 -0
- package/test/examples/flappy_bird/browser-entry/playback/frame-render/README.md +310 -0
- package/test/examples/flappy_bird/browser-entry/playback/frame-render/playback.frame-render.service.ts +92 -0
- package/test/examples/flappy_bird/browser-entry/playback/frame-render/playback.frame-render.services.ts +272 -0
- package/test/examples/flappy_bird/browser-entry/playback/frame-render/playback.frame-render.types.ts +39 -0
- package/test/examples/flappy_bird/browser-entry/playback/frame-render/playback.frame-render.utils.ts +493 -0
- package/test/examples/flappy_bird/browser-entry/playback/playback.constants.ts +1 -1
- package/test/examples/flappy_bird/browser-entry/playback/playback.frame-render.service.ts +4 -0
- package/test/examples/flappy_bird/browser-entry/playback/playback.snapshot.utils.ts +44 -0
- package/test/examples/flappy_bird/browser-entry/playback/playback.starfield.service.ts +39 -122
- package/test/examples/flappy_bird/browser-entry/playback/playback.starfield.services.ts +272 -0
- package/test/examples/flappy_bird/browser-entry/playback/playback.starfield.types.ts +62 -0
- package/test/examples/flappy_bird/browser-entry/playback/playback.starfield.utils.ts +11 -4
- package/test/examples/flappy_bird/browser-entry/playback/playback.ts +409 -8
- package/test/examples/flappy_bird/browser-entry/playback/playback.types.ts +4 -12
- package/test/examples/flappy_bird/browser-entry/runtime/README.md +235 -0
- package/test/examples/flappy_bird/browser-entry/runtime/runtime.evolution-launch.service.ts +45 -0
- package/test/examples/flappy_bird/browser-entry/runtime/runtime.lifecycle.service.ts +81 -0
- package/test/examples/flappy_bird/browser-entry/runtime/runtime.startup.service.ts +74 -0
- package/test/examples/flappy_bird/browser-entry/runtime/runtime.ts +31 -121
- package/test/examples/flappy_bird/browser-entry/runtime/runtime.types.ts +36 -0
- package/test/examples/flappy_bird/browser-entry/visualization/README.md +557 -0
- package/test/examples/flappy_bird/browser-entry/visualization/visualization.constants.ts +110 -0
- package/test/examples/flappy_bird/browser-entry/visualization/visualization.draw.service.ts +957 -19
- package/test/examples/flappy_bird/browser-entry/visualization/visualization.legend.utils.ts +138 -3
- package/test/examples/flappy_bird/browser-entry/visualization/visualization.topology.utils.ts +3 -27
- package/test/examples/flappy_bird/browser-entry/visualization/visualization.ts +1 -23
- package/test/examples/flappy_bird/browser-entry/worker-channel/README.md +156 -0
- package/test/examples/flappy_bird/constants/README.md +1179 -0
- package/test/examples/flappy_bird/constants/constants.network-view.ts +24 -0
- package/test/examples/flappy_bird/constants/constants.palette.ts +7 -0
- package/test/examples/flappy_bird/constants/constants.starfield.ts +78 -3
- package/test/examples/flappy_bird/environment/README.md +143 -0
- package/test/examples/flappy_bird/environment/environment.observation.utils.ts +1 -19
- package/test/examples/flappy_bird/environment/environment.step.service.ts +3 -66
- package/test/examples/flappy_bird/evaluation/README.md +130 -0
- package/test/examples/flappy_bird/evaluation/evaluation.fitness.utils.ts +1 -1
- package/test/examples/flappy_bird/evaluation/evaluation.rollout.service.ts +5 -375
- package/test/examples/flappy_bird/evaluation/rollout/README.md +291 -0
- package/test/examples/flappy_bird/evaluation/rollout/evaluation.rollout.constants.ts +30 -0
- package/test/examples/flappy_bird/evaluation/rollout/evaluation.rollout.service.ts +58 -0
- package/test/examples/flappy_bird/evaluation/rollout/evaluation.rollout.services.ts +310 -0
- package/test/examples/flappy_bird/evaluation/rollout/evaluation.rollout.types.ts +56 -0
- package/test/examples/flappy_bird/evaluation/rollout/evaluation.rollout.utils.ts +368 -0
- package/test/examples/flappy_bird/flappy-evolution-worker/README.md +618 -0
- package/test/examples/flappy_bird/flappy-evolution-worker/flappy-evolution-worker.playback.service.ts +7 -7
- package/test/examples/flappy_bird/flappy-evolution-worker/flappy-evolution-worker.simulation.frame.service.ts +364 -0
- package/test/examples/flappy_bird/flappy-evolution-worker/flappy-evolution-worker.simulation.types.ts +14 -0
- package/test/examples/flappy_bird/flappy-evolution-worker/flappy-evolution-worker.simulation.utils.ts +4 -201
- package/test/examples/flappy_bird/flappy-evolution-worker/flappy-evolution-worker.ts +184 -345
- package/test/examples/flappy_bird/flappy-evolution-worker/flappy-evolution-worker.warm-start.service.ts +291 -0
- package/test/examples/flappy_bird/flappy.simulation.shared.utils.ts +5 -0
- package/test/examples/flappy_bird/simulation-shared/README.md +417 -0
- package/test/examples/flappy_bird/simulation-shared/observation/README.md +183 -0
- package/test/examples/flappy_bird/simulation-shared/observation/observation.features.utils.ts +301 -0
- package/test/examples/flappy_bird/simulation-shared/observation/observation.ts +9 -0
- package/test/examples/flappy_bird/simulation-shared/observation/observation.vector.utils.ts +59 -0
- package/test/examples/flappy_bird/simulation-shared/simulation-shared.observation.utils.ts +5 -403
- package/test/examples/flappy_bird/simulation-shared/simulation-shared.spawn.utils.ts +20 -6
- package/test/examples/flappy_bird/{evaluation/evaluation.statistics.utils.ts → simulation-shared/simulation-shared.statistics.utils.ts} +23 -8
- package/test/examples/flappy_bird/trainer/README.md +563 -0
- package/test/examples/flappy_bird/trainer/evaluation/README.md +199 -0
- package/test/examples/flappy_bird/trainer/evaluation/trainer.evaluation.service.constants.ts +9 -0
- package/test/examples/flappy_bird/trainer/evaluation/trainer.evaluation.service.services.ts +73 -0
- package/test/examples/flappy_bird/trainer/evaluation/trainer.evaluation.service.ts +165 -0
- package/test/examples/flappy_bird/trainer/evaluation/trainer.evaluation.service.types.ts +25 -0
- package/test/examples/flappy_bird/trainer/evaluation/trainer.evaluation.service.utils.ts +161 -0
- package/test/examples/flappy_bird/trainer/trainer.evaluation.service.ts +13 -0
- package/test/examples/flappy_bird/trainer/trainer.report.service.services.ts +181 -0
- package/test/examples/flappy_bird/trainer/trainer.report.service.ts +126 -0
- package/test/examples/flappy_bird/trainer/trainer.selection.utils.ts +89 -0
- package/test/examples/flappy_bird/trainer/trainer.ts +11 -553
- package/test/examples/flappy_bird/browser-entry/browser-entry.utils.ts +0 -12
- package/test/examples/flappy_bird/environment/environment.ts +0 -7
- package/test/examples/flappy_bird/evaluation/evaluation.ts +0 -7
- package/test/examples/flappy_bird/simulation-shared/simulation-shared.ts +0 -15
- package/test/examples/flappy_bird/trainer/trainer.statistics.utils.ts +0 -78
|
@@ -55,7 +55,7 @@ Global index counter for assigning unique indices to nodes.
|
|
|
55
55
|
|
|
56
56
|
#### _safeUpdateWeight
|
|
57
57
|
|
|
58
|
-
`(connection: import("
|
|
58
|
+
`(connection: import("src/architecture/connection").default, delta: number) => void`
|
|
59
59
|
|
|
60
60
|
Internal helper to safely update a connection weight with clipping and NaN checks.
|
|
61
61
|
|
|
@@ -159,7 +159,7 @@ Useful for starting a new activation sequence (e.g., for a new input pattern).
|
|
|
159
159
|
|
|
160
160
|
#### connect
|
|
161
161
|
|
|
162
|
-
`(target: import("
|
|
162
|
+
`(target: import("src/architecture/node").default | { nodes: import("src/architecture/node").default[]; }, weight: number | undefined) => import("src/architecture/connection").default[]`
|
|
163
163
|
|
|
164
164
|
Creates a connection from this node to a target node or all nodes in a group.
|
|
165
165
|
|
|
@@ -179,7 +179,7 @@ The derivative of the activation function evaluated at the node's current state.
|
|
|
179
179
|
|
|
180
180
|
#### disconnect
|
|
181
181
|
|
|
182
|
-
`(target: import("
|
|
182
|
+
`(target: import("src/architecture/node").default, twosided: boolean) => void`
|
|
183
183
|
|
|
184
184
|
Removes the connection from this node to the target node.
|
|
185
185
|
|
|
@@ -193,7 +193,7 @@ Stores error values calculated during backpropagation.
|
|
|
193
193
|
|
|
194
194
|
#### fromJSON
|
|
195
195
|
|
|
196
|
-
`(json: { bias: number; type: string; squash: string; mask: number; }) => import("
|
|
196
|
+
`(json: { bias: number; type: string; squash: string; mask: number; }) => import("src/architecture/node").default`
|
|
197
197
|
|
|
198
198
|
Creates a Node instance from a JSON object.
|
|
199
199
|
|
|
@@ -204,7 +204,7 @@ Returns: A new Node instance configured according to the JSON object.
|
|
|
204
204
|
|
|
205
205
|
#### gate
|
|
206
206
|
|
|
207
|
-
`(connections: import("
|
|
207
|
+
`(connections: import("src/architecture/connection").default | import("src/architecture/connection").default[]) => void`
|
|
208
208
|
|
|
209
209
|
Makes this node gate the provided connection(s).
|
|
210
210
|
The connection's gain will be controlled by this node's activation value.
|
|
@@ -226,7 +226,7 @@ Internal flag to detect cycles during activation
|
|
|
226
226
|
|
|
227
227
|
#### isConnectedTo
|
|
228
228
|
|
|
229
|
-
`(target: import("
|
|
229
|
+
`(target: import("src/architecture/node").default) => boolean`
|
|
230
230
|
|
|
231
231
|
Checks if this node is connected to another node.
|
|
232
232
|
|
|
@@ -237,7 +237,7 @@ Returns: True if connected, otherwise false.
|
|
|
237
237
|
|
|
238
238
|
#### isProjectedBy
|
|
239
239
|
|
|
240
|
-
`(node: import("
|
|
240
|
+
`(node: import("src/architecture/node").default) => boolean`
|
|
241
241
|
|
|
242
242
|
Checks if the given node has a direct outgoing connection to this node.
|
|
243
243
|
Considers both regular incoming connections and the self-connection.
|
|
@@ -249,7 +249,7 @@ Returns: True if the given node projects to this node, false otherwise.
|
|
|
249
249
|
|
|
250
250
|
#### isProjectingTo
|
|
251
251
|
|
|
252
|
-
`(node: import("
|
|
252
|
+
`(node: import("src/architecture/node").default) => boolean`
|
|
253
253
|
|
|
254
254
|
Checks if this node has a direct outgoing connection to the given node.
|
|
255
255
|
Considers both regular outgoing connections and the self-connection.
|
|
@@ -369,7 +369,7 @@ Determines behavior (e.g., input nodes don't have biases modified typically, out
|
|
|
369
369
|
|
|
370
370
|
#### ungate
|
|
371
371
|
|
|
372
|
-
`(connections: import("
|
|
372
|
+
`(connections: import("src/architecture/connection").default | import("src/architecture/connection").default[]) => void`
|
|
373
373
|
|
|
374
374
|
Removes this node's gating control over the specified connection(s).
|
|
375
375
|
Resets the connection's gain to 1 and removes it from the `connections.gated` list.
|
|
@@ -394,7 +394,7 @@ may reject the model.
|
|
|
394
394
|
|
|
395
395
|
### exportToONNX
|
|
396
396
|
|
|
397
|
-
`(network: import("
|
|
397
|
+
`(network: import("src/architecture/network").default, options: import("src/architecture/network/onnx/network.onnx.utils.types").OnnxExportOptions) => import("src/architecture/network/onnx/network.onnx.utils.types").OnnxModel`
|
|
398
398
|
|
|
399
399
|
Export a NeatapticTS network to an ONNX-like **JSON object** (`OnnxModel`).
|
|
400
400
|
|
|
@@ -432,7 +432,7 @@ Returns: ONNX-like model object suitable for persistence or re-import.
|
|
|
432
432
|
|
|
433
433
|
### importFromONNX
|
|
434
434
|
|
|
435
|
-
`(onnx: import("
|
|
435
|
+
`(onnx: import("src/architecture/network/onnx/network.onnx.utils.types").OnnxModel) => import("src/architecture/network").default`
|
|
436
436
|
|
|
437
437
|
Reconstruct a NeatapticTS network from an exported `OnnxModel`.
|
|
438
438
|
|
|
@@ -534,9 +534,6 @@ Activates all nodes in the group. If input values are provided, they are assigne
|
|
|
534
534
|
sequentially to the nodes before activation. Otherwise, nodes activate based on their
|
|
535
535
|
existing states and incoming connections.
|
|
536
536
|
|
|
537
|
-
Parameters:
|
|
538
|
-
- `` - - An optional array of input values. If provided, its length must match the number of nodes in the group.
|
|
539
|
-
|
|
540
537
|
Returns: An array containing the activation value of each node in the group, in order.
|
|
541
538
|
|
|
542
539
|
#### clear
|
|
@@ -549,16 +546,11 @@ especially relevant in recurrent networks or sequence processing.
|
|
|
549
546
|
|
|
550
547
|
#### connect
|
|
551
548
|
|
|
552
|
-
`(target: import("
|
|
549
|
+
`(target: import("src/architecture/node").default | import("src/architecture/layer").default | import("src/architecture/group").default, method: unknown, weight: number | undefined) => import("src/architecture/connection").default[]`
|
|
553
550
|
|
|
554
551
|
Establishes connections from all nodes in this group to a target Group, Layer, or Node.
|
|
555
552
|
The connection pattern (e.g., all-to-all, one-to-one) can be specified.
|
|
556
553
|
|
|
557
|
-
Parameters:
|
|
558
|
-
- `` - - The destination entity (Group, Layer, or Node) to connect to.
|
|
559
|
-
- `` - - The connection method/type (e.g., `methods.groupConnection.ALL_TO_ALL`, `methods.groupConnection.ONE_TO_ONE`). Defaults depend on the target type and whether it's the same group.
|
|
560
|
-
- `` - - An optional fixed weight to assign to all created connections. If not provided, weights might be initialized randomly or based on node defaults.
|
|
561
|
-
|
|
562
554
|
Returns: An array containing all the connection objects created.
|
|
563
555
|
|
|
564
556
|
#### connections
|
|
@@ -570,25 +562,17 @@ Stores connection information related to this group.
|
|
|
570
562
|
|
|
571
563
|
#### disconnect
|
|
572
564
|
|
|
573
|
-
`(target: import("
|
|
565
|
+
`(target: import("src/architecture/node").default | import("src/architecture/group").default, twosided: boolean) => void`
|
|
574
566
|
|
|
575
567
|
Removes connections between nodes in this group and a target Group or Node.
|
|
576
568
|
|
|
577
|
-
Parameters:
|
|
578
|
-
- `` - - The Group or Node to disconnect from.
|
|
579
|
-
- `` - - If true, also removes connections originating from the `target` and ending in this group. Defaults to false (only removes connections from this group to the target).
|
|
580
|
-
|
|
581
569
|
#### gate
|
|
582
570
|
|
|
583
|
-
`(connections: import("
|
|
571
|
+
`(connections: import("src/architecture/connection").default | import("src/architecture/connection").default[], method: unknown) => void`
|
|
584
572
|
|
|
585
573
|
Configures nodes within this group to act as gates for the specified connection(s).
|
|
586
574
|
Gating allows the output of a node in this group to modulate the flow of signal through the gated connection.
|
|
587
575
|
|
|
588
|
-
Parameters:
|
|
589
|
-
- `` - - A single connection object or an array of connection objects to be gated.
|
|
590
|
-
- `` - - The gating mechanism to use (e.g., `methods.gating.INPUT`, `methods.gating.OUTPUT`, `methods.gating.SELF`). Specifies which part of the connection is influenced by the gater node.
|
|
591
|
-
|
|
592
576
|
#### nodes
|
|
593
577
|
|
|
594
578
|
An array holding all the nodes within this group.
|
|
@@ -601,23 +585,12 @@ Propagates the error backward through all nodes in the group. If target values a
|
|
|
601
585
|
the error is calculated against these targets (typically for output layers). Otherwise,
|
|
602
586
|
the error is calculated based on the error propagated from subsequent layers/nodes.
|
|
603
587
|
|
|
604
|
-
Parameters:
|
|
605
|
-
- `` - - The learning rate to apply during weight updates.
|
|
606
|
-
- `` - - The momentum factor to apply during weight updates.
|
|
607
|
-
- `` - - Optional target values for error calculation. If provided, its length must match the number of nodes.
|
|
608
|
-
|
|
609
588
|
#### set
|
|
610
589
|
|
|
611
590
|
`(values: { bias?: number | undefined; squash?: ((x: number, derivate?: boolean | undefined) => number) | undefined; type?: string | undefined; }) => void`
|
|
612
591
|
|
|
613
592
|
Sets specific properties (like bias, squash function, or type) for all nodes within the group.
|
|
614
593
|
|
|
615
|
-
Parameters:
|
|
616
|
-
- `` - - An object containing the properties and their new values. Only provided properties are updated.
|
|
617
|
-
`bias`: Sets the bias term for all nodes.
|
|
618
|
-
`squash`: Sets the activation function (squashing function) for all nodes.
|
|
619
|
-
`type`: Sets the node type (e.g., 'input', 'hidden', 'output') for all nodes.
|
|
620
|
-
|
|
621
594
|
#### toJSON
|
|
622
595
|
|
|
623
596
|
`() => { size: number; nodeIndices: (number | undefined)[]; connections: { in: number; out: number; self: number; }; }`
|
|
@@ -670,7 +643,7 @@ Returns: An array containing the activation value of each node in the layer afte
|
|
|
670
643
|
|
|
671
644
|
#### attention
|
|
672
645
|
|
|
673
|
-
`(size: number, heads: number) => import("
|
|
646
|
+
`(size: number, heads: number) => import("src/architecture/layer").default`
|
|
674
647
|
|
|
675
648
|
Creates a multi-head self-attention layer (stub implementation).
|
|
676
649
|
|
|
@@ -682,7 +655,7 @@ Returns: A new Layer instance representing an attention layer.
|
|
|
682
655
|
|
|
683
656
|
#### batchNorm
|
|
684
657
|
|
|
685
|
-
`(size: number) => import("
|
|
658
|
+
`(size: number) => import("src/architecture/layer").default`
|
|
686
659
|
|
|
687
660
|
Creates a batch normalization layer.
|
|
688
661
|
Applies batch normalization to the activations of the nodes in this layer during activation.
|
|
@@ -701,7 +674,7 @@ This is typically done before processing a new input sequence or sample.
|
|
|
701
674
|
|
|
702
675
|
#### connect
|
|
703
676
|
|
|
704
|
-
`(target: import("
|
|
677
|
+
`(target: import("src/architecture/node").default | import("src/architecture/group").default | import("src/architecture/layer/layer.utils.types").LayerLike, method: unknown, weight: number | undefined) => import("src/architecture/connection").default[]`
|
|
705
678
|
|
|
706
679
|
Connects this layer's output to a target component (Layer, Group, or Node).
|
|
707
680
|
|
|
@@ -726,7 +699,7 @@ by the network or higher-level structures rather than directly by the layer itse
|
|
|
726
699
|
|
|
727
700
|
#### conv1d
|
|
728
701
|
|
|
729
|
-
`(size: number, kernelSize: number, stride: number, padding: number) => import("
|
|
702
|
+
`(size: number, kernelSize: number, stride: number, padding: number) => import("src/architecture/layer").default`
|
|
730
703
|
|
|
731
704
|
Creates a 1D convolutional layer (stub implementation).
|
|
732
705
|
|
|
@@ -740,7 +713,7 @@ Returns: A new Layer instance representing a 1D convolutional layer.
|
|
|
740
713
|
|
|
741
714
|
#### dense
|
|
742
715
|
|
|
743
|
-
`(size: number) => import("
|
|
716
|
+
`(size: number) => import("src/architecture/layer").default`
|
|
744
717
|
|
|
745
718
|
Creates a standard fully connected (dense) layer.
|
|
746
719
|
|
|
@@ -754,7 +727,7 @@ Returns: A new Layer instance configured as a dense layer.
|
|
|
754
727
|
|
|
755
728
|
#### disconnect
|
|
756
729
|
|
|
757
|
-
`(target: import("
|
|
730
|
+
`(target: import("src/architecture/node").default | import("src/architecture/group").default, twosided: boolean | undefined) => void`
|
|
758
731
|
|
|
759
732
|
Removes connections between this layer's nodes and a target Group or Node.
|
|
760
733
|
|
|
@@ -769,7 +742,7 @@ Layer-level dropout takes precedence over node-level dropout for nodes in this l
|
|
|
769
742
|
|
|
770
743
|
#### gate
|
|
771
744
|
|
|
772
|
-
`(connections: import("
|
|
745
|
+
`(connections: import("src/architecture/connection").default[], method: unknown) => void`
|
|
773
746
|
|
|
774
747
|
Applies gating to a set of connections originating from this layer's output group.
|
|
775
748
|
|
|
@@ -782,7 +755,7 @@ Parameters:
|
|
|
782
755
|
|
|
783
756
|
#### gru
|
|
784
757
|
|
|
785
|
-
`(size: number) => import("
|
|
758
|
+
`(size: number) => import("src/architecture/layer").default`
|
|
786
759
|
|
|
787
760
|
Creates a Gated Recurrent Unit (GRU) layer.
|
|
788
761
|
|
|
@@ -797,7 +770,7 @@ Returns: A new Layer instance configured as a GRU layer.
|
|
|
797
770
|
|
|
798
771
|
#### input
|
|
799
772
|
|
|
800
|
-
`(from: import("
|
|
773
|
+
`(from: import("src/architecture/group").default | import("src/architecture/layer/layer.utils.types").LayerLike, method: unknown, weight: number | undefined) => import("src/architecture/connection").default[]`
|
|
801
774
|
|
|
802
775
|
Handles the connection logic when this layer is the *target* of a connection.
|
|
803
776
|
|
|
@@ -814,7 +787,7 @@ Returns: An array containing the newly created connection objects.
|
|
|
814
787
|
|
|
815
788
|
#### layerNorm
|
|
816
789
|
|
|
817
|
-
`(size: number) => import("
|
|
790
|
+
`(size: number) => import("src/architecture/layer").default`
|
|
818
791
|
|
|
819
792
|
Creates a layer normalization layer.
|
|
820
793
|
Applies layer normalization to the activations of the nodes in this layer during activation.
|
|
@@ -826,7 +799,7 @@ Returns: A new Layer instance configured as a layer normalization layer.
|
|
|
826
799
|
|
|
827
800
|
#### lstm
|
|
828
801
|
|
|
829
|
-
`(size: number) => import("
|
|
802
|
+
`(size: number) => import("src/architecture/layer").default`
|
|
830
803
|
|
|
831
804
|
Creates a Long Short-Term Memory (LSTM) layer.
|
|
832
805
|
|
|
@@ -841,7 +814,7 @@ Returns: A new Layer instance configured as an LSTM layer.
|
|
|
841
814
|
|
|
842
815
|
#### memory
|
|
843
816
|
|
|
844
|
-
`(size: number, memory: number) => import("
|
|
817
|
+
`(size: number, memory: number) => import("src/architecture/layer").default`
|
|
845
818
|
|
|
846
819
|
Creates a Memory layer, designed to hold state over a fixed number of time steps.
|
|
847
820
|
|
|
@@ -1023,7 +996,7 @@ Whether to apply separate bias clipping.
|
|
|
1023
996
|
|
|
1024
997
|
#### _hasPath
|
|
1025
998
|
|
|
1026
|
-
`(from: import("
|
|
999
|
+
`(from: import("src/architecture/node").default, to: import("src/architecture/node").default) => boolean`
|
|
1027
1000
|
|
|
1028
1001
|
Check whether a directed path exists between two nodes.
|
|
1029
1002
|
|
|
@@ -1169,11 +1142,6 @@ Original weights captured for weight-noise recovery.
|
|
|
1169
1142
|
Activates the network using the given input array.
|
|
1170
1143
|
Performs a forward pass through the network, calculating the activation of each node.
|
|
1171
1144
|
|
|
1172
|
-
Parameters:
|
|
1173
|
-
- `` - - An array of numerical values corresponding to the network's input nodes.
|
|
1174
|
-
- `` - - Flag indicating if the activation is part of a training process.
|
|
1175
|
-
- `` - - Maximum allowed activation depth to prevent infinite loops/cycles.
|
|
1176
|
-
|
|
1177
1145
|
Returns: An array of numerical values representing the activations of the network's output nodes.
|
|
1178
1146
|
|
|
1179
1147
|
#### activateBatch
|
|
@@ -1194,7 +1162,7 @@ Returns: Array of output vectors, each length equals this.output
|
|
|
1194
1162
|
|
|
1195
1163
|
#### activateRaw
|
|
1196
1164
|
|
|
1197
|
-
`(input: number[], training: boolean, maxActivationDepth: number) => import("
|
|
1165
|
+
`(input: number[], training: boolean, maxActivationDepth: number) => import("src/architecture/activationArrayPool").ActivationArray`
|
|
1198
1166
|
|
|
1199
1167
|
Raw activation that can return a typed array when pooling is enabled (zero-copy).
|
|
1200
1168
|
If reuseActivationArrays=false falls back to standard activate().
|
|
@@ -1240,7 +1208,7 @@ Clear the dynamic global weight-noise schedule.
|
|
|
1240
1208
|
|
|
1241
1209
|
#### clone
|
|
1242
1210
|
|
|
1243
|
-
`() => import("
|
|
1211
|
+
`() => import("src/architecture/network").default`
|
|
1244
1212
|
|
|
1245
1213
|
Creates a deep copy of the network.
|
|
1246
1214
|
|
|
@@ -1257,17 +1225,12 @@ Parameters:
|
|
|
1257
1225
|
|
|
1258
1226
|
#### connect
|
|
1259
1227
|
|
|
1260
|
-
`(from: import("
|
|
1228
|
+
`(from: import("src/architecture/node").default, to: import("src/architecture/node").default, weight: number | undefined) => import("src/architecture/connection").default[]`
|
|
1261
1229
|
|
|
1262
1230
|
Creates a connection between two nodes in the network.
|
|
1263
1231
|
Handles both regular connections and self-connections.
|
|
1264
1232
|
Adds the new connection object(s) to the appropriate network list (`connections` or `selfconns`).
|
|
1265
1233
|
|
|
1266
|
-
Parameters:
|
|
1267
|
-
- `` - - The source node of the connection.
|
|
1268
|
-
- `` - - The target node of the connection.
|
|
1269
|
-
- `` - - Optional weight for the connection. If not provided, a random weight is usually assigned by the underlying `Node.connect` method.
|
|
1270
|
-
|
|
1271
1234
|
Returns: An array containing the newly created connection object(s). Typically contains one connection, but might be empty or contain more in specialized node types.
|
|
1272
1235
|
|
|
1273
1236
|
#### connections
|
|
@@ -1276,20 +1239,15 @@ Connection list.
|
|
|
1276
1239
|
|
|
1277
1240
|
#### createMLP
|
|
1278
1241
|
|
|
1279
|
-
`(inputCount: number, hiddenCounts: number[], outputCount: number) => import("
|
|
1242
|
+
`(inputCount: number, hiddenCounts: number[], outputCount: number) => import("src/architecture/network").default`
|
|
1280
1243
|
|
|
1281
1244
|
Creates a fully connected, strictly layered MLP network.
|
|
1282
1245
|
|
|
1283
|
-
Parameters:
|
|
1284
|
-
- `` - - Number of input nodes
|
|
1285
|
-
- `` - - Array of hidden layer sizes (e.g. [2,3] for two hidden layers)
|
|
1286
|
-
- `` - - Number of output nodes
|
|
1287
|
-
|
|
1288
1246
|
Returns: A new, fully connected, layered MLP
|
|
1289
1247
|
|
|
1290
1248
|
#### crossOver
|
|
1291
1249
|
|
|
1292
|
-
`(network1: import("
|
|
1250
|
+
`(network1: import("src/architecture/network").default, network2: import("src/architecture/network").default, equal: boolean) => import("src/architecture/network").default`
|
|
1293
1251
|
|
|
1294
1252
|
Creates a new offspring network by performing crossover between two parent networks.
|
|
1295
1253
|
This method implements the crossover mechanism inspired by the NEAT algorithm and described
|
|
@@ -1297,17 +1255,11 @@ in the Instinct paper, combining genes (nodes and connections) from both parents
|
|
|
1297
1255
|
Fitness scores can influence the inheritance process. Matching genes are inherited randomly,
|
|
1298
1256
|
while disjoint/excess genes are typically inherited from the fitter parent (or randomly if fitness is equal or `equal` flag is set).
|
|
1299
1257
|
|
|
1300
|
-
Parameters:
|
|
1301
|
-
- `` - - The first parent network.
|
|
1302
|
-
- `` - - The second parent network.
|
|
1303
|
-
- `` - - If true, disjoint and excess genes are inherited randomly regardless of fitness.
|
|
1304
|
-
If false (default), they are inherited from the fitter parent.
|
|
1305
|
-
|
|
1306
1258
|
Returns: A new Network instance representing the offspring.
|
|
1307
1259
|
|
|
1308
1260
|
#### describeArchitecture
|
|
1309
1261
|
|
|
1310
|
-
`() => import("
|
|
1262
|
+
`() => import("src/architecture/network/network.types").NetworkArchitectureDescriptor`
|
|
1311
1263
|
|
|
1312
1264
|
Resolves a stable architecture descriptor for telemetry/UI consumers.
|
|
1313
1265
|
|
|
@@ -1318,17 +1270,11 @@ Returns: Architecture descriptor with hidden-layer widths and provenance.
|
|
|
1318
1270
|
|
|
1319
1271
|
#### deserialize
|
|
1320
1272
|
|
|
1321
|
-
`(data: [number[], number[], string[], { from: number; to: number; weight: number; gater: number | null; }[], number, number] | unknown[], inputSize: number | undefined, outputSize: number | undefined) => import("
|
|
1273
|
+
`(data: [number[], number[], string[], { from: number; to: number; weight: number; gater: number | null; }[], number, number] | unknown[], inputSize: number | undefined, outputSize: number | undefined) => import("src/architecture/network").default`
|
|
1322
1274
|
|
|
1323
1275
|
Creates a Network instance from serialized data produced by `serialize()`.
|
|
1324
1276
|
Reconstructs the network structure and state based on the provided arrays.
|
|
1325
1277
|
|
|
1326
|
-
Parameters:
|
|
1327
|
-
- `` - - The serialized network data array, typically obtained from `network.serialize()`.
|
|
1328
|
-
Expected format: `[activations, states, squashNames, connectionData, inputSize, outputSize]`.
|
|
1329
|
-
- `` - - Optional input size override.
|
|
1330
|
-
- `` - - Optional output size override.
|
|
1331
|
-
|
|
1332
1278
|
Returns: A new Network instance reconstructed from the serialized data.
|
|
1333
1279
|
|
|
1334
1280
|
#### disableDropConnect
|
|
@@ -1351,16 +1297,12 @@ Disable all weight-noise settings.
|
|
|
1351
1297
|
|
|
1352
1298
|
#### disconnect
|
|
1353
1299
|
|
|
1354
|
-
`(from: import("
|
|
1300
|
+
`(from: import("src/architecture/node").default, to: import("src/architecture/node").default) => void`
|
|
1355
1301
|
|
|
1356
1302
|
Disconnects two nodes, removing the connection between them.
|
|
1357
1303
|
Handles both regular connections and self-connections.
|
|
1358
1304
|
If the connection being removed was gated, it is also ungated.
|
|
1359
1305
|
|
|
1360
|
-
Parameters:
|
|
1361
|
-
- `` - - The source node of the connection to remove.
|
|
1362
|
-
- `` - - The target node of the connection to remove.
|
|
1363
|
-
|
|
1364
1306
|
#### dropout
|
|
1365
1307
|
|
|
1366
1308
|
Dropout probability.
|
|
@@ -1396,35 +1338,28 @@ Returns: Activation output.
|
|
|
1396
1338
|
|
|
1397
1339
|
#### fromJSON
|
|
1398
1340
|
|
|
1399
|
-
`(json: Record<string, unknown>) => import("
|
|
1341
|
+
`(json: Record<string, unknown>) => import("src/architecture/network").default`
|
|
1400
1342
|
|
|
1401
1343
|
Reconstructs a network from a JSON object (latest standard).
|
|
1402
1344
|
Handles formatVersion, robust error handling, and index-based references.
|
|
1403
1345
|
|
|
1404
|
-
Parameters:
|
|
1405
|
-
- `` - - The JSON object representing the network.
|
|
1406
|
-
|
|
1407
1346
|
Returns: The reconstructed network.
|
|
1408
1347
|
|
|
1409
1348
|
#### gate
|
|
1410
1349
|
|
|
1411
|
-
`(node: import("
|
|
1350
|
+
`(node: import("src/architecture/node").default, connection: import("src/architecture/connection").default) => void`
|
|
1412
1351
|
|
|
1413
1352
|
Gates a connection with a specified node.
|
|
1414
1353
|
The activation of the `node` (gater) will modulate the weight of the `connection`.
|
|
1415
1354
|
Adds the connection to the network's `gates` list.
|
|
1416
1355
|
|
|
1417
|
-
Parameters:
|
|
1418
|
-
- `` - - The node that will act as the gater. Must be part of this network.
|
|
1419
|
-
- `` - - The connection to be gated.
|
|
1420
|
-
|
|
1421
1356
|
#### gates
|
|
1422
1357
|
|
|
1423
1358
|
Network gates collection.
|
|
1424
1359
|
|
|
1425
1360
|
#### getConnectionSlab
|
|
1426
1361
|
|
|
1427
|
-
`() => import("
|
|
1362
|
+
`() => import("src/architecture/network/slab/network.slab.utils.types").ConnectionSlabView`
|
|
1428
1363
|
|
|
1429
1364
|
Read slab structures for fast activation.
|
|
1430
1365
|
|
|
@@ -1492,7 +1427,7 @@ Optional layered view cache.
|
|
|
1492
1427
|
|
|
1493
1428
|
#### mutate
|
|
1494
1429
|
|
|
1495
|
-
`(method: import("
|
|
1430
|
+
`(method: import("src/architecture/network/network.types").MutationMethod) => void`
|
|
1496
1431
|
|
|
1497
1432
|
Mutates the network's structure or parameters according to the specified method.
|
|
1498
1433
|
This is a core operation for neuro-evolutionary algorithms (like NEAT).
|
|
@@ -1514,10 +1449,6 @@ Activates the network without calculating eligibility traces.
|
|
|
1514
1449
|
This is a performance optimization for scenarios where backpropagation is not needed,
|
|
1515
1450
|
such as during testing, evaluation, or deployment (inference).
|
|
1516
1451
|
|
|
1517
|
-
Parameters:
|
|
1518
|
-
- `` - - An array of numerical values corresponding to the network's input nodes.
|
|
1519
|
-
The length must match the network's `input` size.
|
|
1520
|
-
|
|
1521
1452
|
Returns: An array of numerical values representing the activations of the network's output nodes.
|
|
1522
1453
|
|
|
1523
1454
|
#### output
|
|
@@ -1535,15 +1466,6 @@ learning rate, momentum, and optional L2 regularization.
|
|
|
1535
1466
|
|
|
1536
1467
|
The process starts from the output nodes and moves backward layer by layer (or topologically for recurrent nets).
|
|
1537
1468
|
|
|
1538
|
-
Parameters:
|
|
1539
|
-
- `` - - The learning rate (controls the step size of weight adjustments).
|
|
1540
|
-
- `` - - The momentum factor (helps overcome local minima and speeds up convergence). Typically between 0 and 1.
|
|
1541
|
-
- `` - - If true, apply the calculated weight and bias updates. If false, only calculate gradients (e.g., for batch accumulation).
|
|
1542
|
-
- `` - - An array of target values corresponding to the network's output nodes.
|
|
1543
|
-
The length must match the network's `output` size.
|
|
1544
|
-
- `` - - The L2 regularization factor (lambda). Helps prevent overfitting by penalizing large weights.
|
|
1545
|
-
- `` - - Optional derivative of the cost function for output nodes.
|
|
1546
|
-
|
|
1547
1469
|
#### pruneToSparsity
|
|
1548
1470
|
|
|
1549
1471
|
`(targetSparsity: number, method: "magnitude" | "snip") => void`
|
|
@@ -1557,15 +1479,12 @@ Parameters:
|
|
|
1557
1479
|
|
|
1558
1480
|
#### rebuildConnections
|
|
1559
1481
|
|
|
1560
|
-
`(net: import("
|
|
1482
|
+
`(net: import("src/architecture/network").default) => void`
|
|
1561
1483
|
|
|
1562
1484
|
Rebuilds the network's connections array from all per-node connections.
|
|
1563
1485
|
This ensures that the network.connections array is consistent with the actual
|
|
1564
1486
|
outgoing connections of all nodes. Useful after manual wiring or node manipulation.
|
|
1565
1487
|
|
|
1566
|
-
Parameters:
|
|
1567
|
-
- `` - - The network instance to rebuild connections for.
|
|
1568
|
-
|
|
1569
1488
|
Returns: Example usage:
|
|
1570
1489
|
Network.rebuildConnections(net);
|
|
1571
1490
|
|
|
@@ -1582,7 +1501,7 @@ Returns: Slab rebuild result.
|
|
|
1582
1501
|
|
|
1583
1502
|
#### remove
|
|
1584
1503
|
|
|
1585
|
-
`(node: import("
|
|
1504
|
+
`(node: import("src/architecture/node").default) => void`
|
|
1586
1505
|
|
|
1587
1506
|
Removes a node from the network.
|
|
1588
1507
|
This involves:
|
|
@@ -1594,9 +1513,6 @@ This involves:
|
|
|
1594
1513
|
5. Handling gates involving the removed node (ungating connections gated *by* this node,
|
|
1595
1514
|
and potentially re-gating connections that were gated *by other nodes* onto the removed node's connections).
|
|
1596
1515
|
|
|
1597
|
-
Parameters:
|
|
1598
|
-
- `` - - The node instance to remove. Must exist within the network's `nodes` list.
|
|
1599
|
-
|
|
1600
1516
|
#### resetDropoutMasks
|
|
1601
1517
|
|
|
1602
1518
|
`() => void`
|
|
@@ -1623,7 +1539,7 @@ Self-connection list.
|
|
|
1623
1539
|
|
|
1624
1540
|
#### serialize
|
|
1625
1541
|
|
|
1626
|
-
`() => [number[], number[], string[], import("
|
|
1542
|
+
`() => [number[], number[], string[], import("src/architecture/network/network.types").SerializedConnection[], number, number]`
|
|
1627
1543
|
|
|
1628
1544
|
Lightweight tuple serializer delegating to network.serialize.ts
|
|
1629
1545
|
|
|
@@ -1634,9 +1550,6 @@ Lightweight tuple serializer delegating to network.serialize.ts
|
|
|
1634
1550
|
Sets specified properties (e.g., bias, squash function) for all nodes in the network.
|
|
1635
1551
|
Useful for initializing or resetting node properties uniformly.
|
|
1636
1552
|
|
|
1637
|
-
Parameters:
|
|
1638
|
-
- `` - - An object containing the properties and values to set.
|
|
1639
|
-
|
|
1640
1553
|
#### setEnforceAcyclic
|
|
1641
1554
|
|
|
1642
1555
|
`(flag: boolean) => void`
|
|
@@ -1702,7 +1615,7 @@ Parameters:
|
|
|
1702
1615
|
|
|
1703
1616
|
#### snapshotRNG
|
|
1704
1617
|
|
|
1705
|
-
`() => import("
|
|
1618
|
+
`() => import("src/architecture/network/network.types").RNGSnapshot`
|
|
1706
1619
|
|
|
1707
1620
|
Snapshot deterministic RNG runtime state.
|
|
1708
1621
|
|
|
@@ -1717,10 +1630,6 @@ Calculates the average error over the dataset using a specified cost function.
|
|
|
1717
1630
|
Uses `noTraceActivate` for efficiency as gradients are not needed.
|
|
1718
1631
|
Handles dropout scaling if dropout was used during training.
|
|
1719
1632
|
|
|
1720
|
-
Parameters:
|
|
1721
|
-
- `` - - The test dataset, an array of objects with `input` and `output` arrays.
|
|
1722
|
-
- `` - - The cost function to evaluate the error. Defaults to Mean Squared Error.
|
|
1723
|
-
|
|
1724
1633
|
Returns: An object containing the calculated average error over the dataset and the time taken for the test in milliseconds.
|
|
1725
1634
|
|
|
1726
1635
|
#### testForceOverflow
|
|
@@ -1741,7 +1650,7 @@ Returns: A JSON-compatible object representing the network.
|
|
|
1741
1650
|
|
|
1742
1651
|
#### toONNX
|
|
1743
1652
|
|
|
1744
|
-
`() => import("
|
|
1653
|
+
`() => import("src/architecture/network/onnx/network.onnx.utils.types").OnnxModel`
|
|
1745
1654
|
|
|
1746
1655
|
Exports the network to ONNX format (JSON object, minimal MLP support).
|
|
1747
1656
|
Only standard feedforward architectures and standard activations are supported.
|
|
@@ -1755,15 +1664,12 @@ Current training step counter.
|
|
|
1755
1664
|
|
|
1756
1665
|
#### ungate
|
|
1757
1666
|
|
|
1758
|
-
`(connection: import("
|
|
1667
|
+
`(connection: import("src/architecture/connection").default) => void`
|
|
1759
1668
|
|
|
1760
1669
|
Removes the gate from a specified connection.
|
|
1761
1670
|
The connection will no longer be modulated by its gater node.
|
|
1762
1671
|
Removes the connection from the network's `gates` list.
|
|
1763
1672
|
|
|
1764
|
-
Parameters:
|
|
1765
|
-
- `` - - The connection object to ungate.
|
|
1766
|
-
|
|
1767
1673
|
## architecture/nodePool.ts
|
|
1768
1674
|
|
|
1769
1675
|
### nodePool
|
|
@@ -1788,7 +1694,7 @@ Deferred (Phase 3+): preWarm(count), adaptive trim(), leak pattern heuristics, s
|
|
|
1788
1694
|
|
|
1789
1695
|
### acquireNode
|
|
1790
1696
|
|
|
1791
|
-
`(opts: import("
|
|
1697
|
+
`(opts: import("src/architecture/nodePool").AcquireNodeOptions) => import("src/architecture/node").default`
|
|
1792
1698
|
|
|
1793
1699
|
### AcquireNodeOptions
|
|
1794
1700
|
|
|
@@ -1800,7 +1706,7 @@ Options bag for acquiring a node.
|
|
|
1800
1706
|
|
|
1801
1707
|
### releaseNode
|
|
1802
1708
|
|
|
1803
|
-
`(node: import("
|
|
1709
|
+
`(node: import("src/architecture/node").default) => void`
|
|
1804
1710
|
|
|
1805
1711
|
### resetNodePool
|
|
1806
1712
|
|
|
@@ -1836,7 +1742,7 @@ connection strategies from `methods.groupConnection`.
|
|
|
1836
1742
|
|
|
1837
1743
|
#### construct
|
|
1838
1744
|
|
|
1839
|
-
`(list: (import("
|
|
1745
|
+
`(list: (import("src/architecture/node").default | import("src/architecture/layer").default | import("src/architecture/group").default)[]) => import("src/architecture/network").default`
|
|
1840
1746
|
|
|
1841
1747
|
Constructs a Network instance from an array of interconnected Layers, Groups, or Nodes.
|
|
1842
1748
|
|
|
@@ -1845,101 +1751,73 @@ gates, and self-connections, and determines the network's input and output sizes
|
|
|
1845
1751
|
on the `type` property ('input' or 'output') set on the nodes. It uses Sets internally
|
|
1846
1752
|
for efficient handling of unique elements during construction.
|
|
1847
1753
|
|
|
1848
|
-
Parameters:
|
|
1849
|
-
- `` - - An array containing the building blocks (Nodes, Layers, Groups) of the network, assumed to be already interconnected.
|
|
1850
|
-
|
|
1851
1754
|
Returns: A Network object representing the constructed architecture.
|
|
1852
1755
|
|
|
1853
1756
|
#### enforceMinimumHiddenLayerSizes
|
|
1854
1757
|
|
|
1855
|
-
`(network: import("
|
|
1758
|
+
`(network: import("src/architecture/network").default) => import("src/architecture/network").default`
|
|
1856
1759
|
|
|
1857
1760
|
Enforces the minimum hidden layer size rule on a network.
|
|
1858
1761
|
|
|
1859
1762
|
This ensures that all hidden layers have at least min(input, output) + 1 nodes,
|
|
1860
1763
|
which is a common heuristic to ensure networks have adequate representation capacity.
|
|
1861
1764
|
|
|
1862
|
-
Parameters:
|
|
1863
|
-
- `` - - The network to enforce minimum hidden layer sizes on
|
|
1864
|
-
|
|
1865
1765
|
Returns: The same network with properly sized hidden layers
|
|
1866
1766
|
|
|
1867
1767
|
#### gru
|
|
1868
1768
|
|
|
1869
|
-
`(layers: number[]) => import("
|
|
1769
|
+
`(layers: number[]) => import("src/architecture/network").default`
|
|
1870
1770
|
|
|
1871
1771
|
Creates a Gated Recurrent Unit (GRU) network.
|
|
1872
1772
|
GRUs are another type of recurrent neural network, similar to LSTMs but often simpler.
|
|
1873
1773
|
This constructor uses `Layer.gru` to create the core GRU blocks.
|
|
1874
1774
|
|
|
1875
|
-
Parameters:
|
|
1876
|
-
- `` - - A sequence of numbers representing the size (number of units) of each layer: input layer size, hidden GRU layer sizes..., output layer size. Must include at least input, one hidden, and output layer sizes.
|
|
1877
|
-
|
|
1878
1775
|
Returns: The constructed GRU network.
|
|
1879
1776
|
|
|
1880
1777
|
#### hopfield
|
|
1881
1778
|
|
|
1882
|
-
`(size: number) => import("
|
|
1779
|
+
`(size: number) => import("src/architecture/network").default`
|
|
1883
1780
|
|
|
1884
1781
|
Creates a Hopfield network.
|
|
1885
1782
|
Hopfield networks are a form of recurrent neural network often used for associative memory tasks.
|
|
1886
1783
|
This implementation creates a simple, fully connected structure.
|
|
1887
1784
|
|
|
1888
|
-
Parameters:
|
|
1889
|
-
- `` - - The number of nodes in the network (input and output layers will have this size).
|
|
1890
|
-
|
|
1891
1785
|
Returns: The constructed Hopfield network.
|
|
1892
1786
|
|
|
1893
1787
|
#### lstm
|
|
1894
1788
|
|
|
1895
|
-
`(layerArgs: (number | { inputToOutput?: boolean | undefined; })[]) => import("
|
|
1789
|
+
`(layerArgs: (number | { inputToOutput?: boolean | undefined; })[]) => import("src/architecture/network").default`
|
|
1896
1790
|
|
|
1897
1791
|
Creates a Long Short-Term Memory (LSTM) network.
|
|
1898
1792
|
LSTMs are a type of recurrent neural network (RNN) capable of learning long-range dependencies.
|
|
1899
1793
|
This constructor uses `Layer.lstm` to create the core LSTM blocks.
|
|
1900
1794
|
|
|
1901
|
-
Parameters:
|
|
1902
|
-
- `` - - A sequence of arguments defining the network structure:
|
|
1903
|
-
- Numbers represent the size (number of units) of each layer: input layer size, hidden LSTM layer sizes..., output layer size.
|
|
1904
|
-
- An optional configuration object can be provided as the last argument.
|
|
1905
|
-
- `` - - Configuration options (if passed as the last argument).
|
|
1906
|
-
|
|
1907
1795
|
Returns: The constructed LSTM network.
|
|
1908
1796
|
|
|
1909
1797
|
#### narx
|
|
1910
1798
|
|
|
1911
|
-
`(inputSize: number, hiddenLayers: number | number[], outputSize: number, previousInput: number, previousOutput: number) => import("
|
|
1799
|
+
`(inputSize: number, hiddenLayers: number | number[], outputSize: number, previousInput: number, previousOutput: number) => import("src/architecture/network").default`
|
|
1912
1800
|
|
|
1913
1801
|
Creates a Nonlinear AutoRegressive network with eXogenous inputs (NARX).
|
|
1914
1802
|
NARX networks are recurrent networks often used for time series prediction.
|
|
1915
1803
|
They predict the next value of a time series based on previous values of the series
|
|
1916
1804
|
and previous values of external (exogenous) input series.
|
|
1917
1805
|
|
|
1918
|
-
Parameters:
|
|
1919
|
-
- `` - - The number of input nodes for the exogenous inputs at each time step.
|
|
1920
|
-
- `` - - The size of the hidden layer(s). Can be a single number for one hidden layer, or an array of numbers for multiple hidden layers. Use 0 or [] for no hidden layers.
|
|
1921
|
-
- `` - - The number of output nodes (predicting the time series).
|
|
1922
|
-
- `` - - The number of past time steps of the exogenous input to feed back into the network.
|
|
1923
|
-
- `` - - The number of past time steps of the network's own output to feed back into the network (autoregressive part).
|
|
1924
|
-
|
|
1925
1806
|
Returns: The constructed NARX network.
|
|
1926
1807
|
|
|
1927
1808
|
#### perceptron
|
|
1928
1809
|
|
|
1929
|
-
`(layers: number[]) => import("
|
|
1810
|
+
`(layers: number[]) => import("src/architecture/network").default`
|
|
1930
1811
|
|
|
1931
1812
|
Creates a standard Multi-Layer Perceptron (MLP) network.
|
|
1932
1813
|
An MLP consists of an input layer, one or more hidden layers, and an output layer,
|
|
1933
1814
|
fully connected layer by layer.
|
|
1934
1815
|
|
|
1935
|
-
Parameters:
|
|
1936
|
-
- `` - - A sequence of numbers representing the size (number of nodes) of each layer, starting with the input layer, followed by hidden layers, and ending with the output layer. Must include at least input, one hidden, and output layer sizes.
|
|
1937
|
-
|
|
1938
1816
|
Returns: The constructed MLP network.
|
|
1939
1817
|
|
|
1940
1818
|
#### random
|
|
1941
1819
|
|
|
1942
|
-
`(input: number, hidden: number, output: number, options: { connections?: number | undefined; backconnections?: number | undefined; selfconnections?: number | undefined; gates?: number | undefined; }) => import("
|
|
1820
|
+
`(input: number, hidden: number, output: number, options: { connections?: number | undefined; backconnections?: number | undefined; selfconnections?: number | undefined; gates?: number | undefined; }) => import("src/architecture/network").default`
|
|
1943
1821
|
|
|
1944
1822
|
Creates a randomly structured network based on specified node counts and connection options.
|
|
1945
1823
|
|
|
@@ -1948,12 +1826,6 @@ It initializes a network with input and output nodes and then iteratively adds h
|
|
|
1948
1826
|
and various types of connections (forward, backward, self) and gates using mutation methods.
|
|
1949
1827
|
This approach is inspired by neuro-evolution techniques where network topology evolves.
|
|
1950
1828
|
|
|
1951
|
-
Parameters:
|
|
1952
|
-
- `` - - The number of input nodes.
|
|
1953
|
-
- `` - - The number of hidden nodes to add.
|
|
1954
|
-
- `` - - The number of output nodes.
|
|
1955
|
-
- `` - - Optional configuration for the network structure.
|
|
1956
|
-
|
|
1957
1829
|
Returns: The constructed network with a randomized topology.
|
|
1958
1830
|
|
|
1959
1831
|
## architecture/connection.ts
|
|
@@ -1990,7 +1862,7 @@ bits4+ reserved.
|
|
|
1990
1862
|
|
|
1991
1863
|
#### acquire
|
|
1992
1864
|
|
|
1993
|
-
`(from: import("
|
|
1865
|
+
`(from: import("src/architecture/node").default, to: import("src/architecture/node").default, weight: number | undefined) => import("src/architecture/connection").default`
|
|
1994
1866
|
|
|
1995
1867
|
Acquire a `Connection` from the pool (or construct new). Fields are fully reset & given
|
|
1996
1868
|
a fresh sequential `innovation` id. Prefer this in evolutionary algorithms that mutate
|
|
@@ -2091,7 +1963,7 @@ Last applied delta weight (used by classic momentum).
|
|
|
2091
1963
|
|
|
2092
1964
|
#### release
|
|
2093
1965
|
|
|
2094
|
-
`(conn: import("
|
|
1966
|
+
`(conn: import("src/architecture/connection").default) => void`
|
|
2095
1967
|
|
|
2096
1968
|
Return a `Connection` to the internal pool for later reuse. Do NOT use the instance again
|
|
2097
1969
|
afterward unless re-acquired (treat as surrendered). Optimizer / trace fields are not
|