@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
package/src/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
#
|
|
1
|
+
# src
|
|
2
2
|
|
|
3
3
|
## neat.ts
|
|
4
4
|
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
### buildEmptyDiversityStats
|
|
8
8
|
|
|
9
|
-
`(populationSize: number) => import("
|
|
9
|
+
`(populationSize: number) => import("src/neat/neat.diversity.utils").DiversityStats`
|
|
10
10
|
|
|
11
11
|
Build a zeroed diversity stats snapshot to use when no population metrics exist yet.
|
|
12
12
|
|
|
@@ -74,7 +74,7 @@ Returns: Adjusted species fitness data.
|
|
|
74
74
|
|
|
75
75
|
#### _compatibilityDistance
|
|
76
76
|
|
|
77
|
-
`(netA: import("
|
|
77
|
+
`(netA: import("src/architecture/network").default, netB: import("src/architecture/network").default) => number`
|
|
78
78
|
|
|
79
79
|
Compute compatibility distance between two networks (delegates to compat module).
|
|
80
80
|
|
|
@@ -86,7 +86,7 @@ Returns: Compatibility distance scalar.
|
|
|
86
86
|
|
|
87
87
|
#### _computeDiversityStats
|
|
88
88
|
|
|
89
|
-
`() => import("
|
|
89
|
+
`() => import("src/neat/neat.diversity.utils").DiversityStats`
|
|
90
90
|
|
|
91
91
|
Compute and cache diversity statistics used by telemetry and tests.
|
|
92
92
|
|
|
@@ -109,7 +109,7 @@ Returns: Innovation id for the connection.
|
|
|
109
109
|
|
|
110
110
|
#### _getObjectives
|
|
111
111
|
|
|
112
|
-
`() => import("
|
|
112
|
+
`() => import("src/neat/neat.types").ObjectiveDescriptor[]`
|
|
113
113
|
|
|
114
114
|
Internal: return cached objective descriptors, building if stale.
|
|
115
115
|
|
|
@@ -150,7 +150,7 @@ Whether lineage metadata should be recorded on genomes.
|
|
|
150
150
|
|
|
151
151
|
#### _mutateAddConnReuse
|
|
152
152
|
|
|
153
|
-
`(genome: import("
|
|
153
|
+
`(genome: import("src/architecture/network").default) => void`
|
|
154
154
|
|
|
155
155
|
Add-connection mutation that reuses global innovation ids when possible.
|
|
156
156
|
|
|
@@ -161,7 +161,7 @@ Returns: Mutated genome with added connection.
|
|
|
161
161
|
|
|
162
162
|
#### _mutateAddNodeReuse
|
|
163
163
|
|
|
164
|
-
`(genome: import("
|
|
164
|
+
`(genome: import("src/architecture/network").default) => Promise<void>`
|
|
165
165
|
|
|
166
166
|
Add-node mutation that reuses global innovation ids when possible.
|
|
167
167
|
|
|
@@ -204,7 +204,7 @@ Internal numeric state for the deterministic xorshift RNG when no user RNG is pr
|
|
|
204
204
|
|
|
205
205
|
#### _sortSpeciesMembers
|
|
206
206
|
|
|
207
|
-
`(sp: import("
|
|
207
|
+
`(sp: import("src/neat/neat.types").SpeciesLike) => void`
|
|
208
208
|
|
|
209
209
|
Sort members within a species according to fitness and lineage rules.
|
|
210
210
|
|
|
@@ -227,7 +227,7 @@ Time-series history of species stats (for exports/telemetry).
|
|
|
227
227
|
|
|
228
228
|
#### _structuralEntropy
|
|
229
229
|
|
|
230
|
-
`(genome: import("
|
|
230
|
+
`(genome: import("src/architecture/network").default) => number`
|
|
231
231
|
|
|
232
232
|
Compatibility wrapper retained for tests that reference (neat as any)._structuralEntropy.
|
|
233
233
|
|
|
@@ -256,7 +256,7 @@ Emit a standardized warning when evolution loop finds no valid best genome (test
|
|
|
256
256
|
|
|
257
257
|
#### addGenome
|
|
258
258
|
|
|
259
|
-
`(genome: import("
|
|
259
|
+
`(genome: import("src/architecture/network").default, parents: number[] | undefined) => void`
|
|
260
260
|
|
|
261
261
|
Register an externally-created genome into the `Neat` population.
|
|
262
262
|
|
|
@@ -293,19 +293,19 @@ Clear telemetry buffer and cached entries.
|
|
|
293
293
|
|
|
294
294
|
#### createPool
|
|
295
295
|
|
|
296
|
-
`(network: import("
|
|
296
|
+
`(network: import("src/architecture/network").default | null) => void`
|
|
297
297
|
|
|
298
298
|
Create initial population pool. Delegates to helpers if present.
|
|
299
299
|
|
|
300
300
|
#### ensureMinHiddenNodes
|
|
301
301
|
|
|
302
|
-
`(network: import("
|
|
302
|
+
`(network: import("src/architecture/network").default, multiplierOverride: number | undefined) => Promise<void>`
|
|
303
303
|
|
|
304
304
|
Ensure a network has the minimum number of hidden nodes according to configured policy.
|
|
305
305
|
|
|
306
306
|
#### ensureNoDeadEnds
|
|
307
307
|
|
|
308
|
-
`(network: import("
|
|
308
|
+
`(network: import("src/architecture/network").default) => void`
|
|
309
309
|
|
|
310
310
|
Delegate ensureNoDeadEnds to mutation module (added for backward compat).
|
|
311
311
|
|
|
@@ -320,7 +320,7 @@ Returns: Aggregated evaluation result (implementation specific).
|
|
|
320
320
|
|
|
321
321
|
#### evolve
|
|
322
322
|
|
|
323
|
-
`() => Promise<import("
|
|
323
|
+
`() => Promise<import("src/architecture/network").default>`
|
|
324
324
|
|
|
325
325
|
Evolves the population by selecting, mutating, and breeding genomes.
|
|
326
326
|
This method is delegated to `src/neat/neat.evolve.ts` during the migration.
|
|
@@ -381,13 +381,13 @@ Calculates the average fitness score of the population.
|
|
|
381
381
|
|
|
382
382
|
#### getDiversityStats
|
|
383
383
|
|
|
384
|
-
`() => import("
|
|
384
|
+
`() => import("src/neat/neat.diversity.utils").DiversityStats`
|
|
385
385
|
|
|
386
386
|
Return the latest cached diversity statistics.
|
|
387
387
|
|
|
388
388
|
#### getFittest
|
|
389
389
|
|
|
390
|
-
`() => import("
|
|
390
|
+
`() => import("src/architecture/network").default`
|
|
391
391
|
|
|
392
392
|
Retrieves the fittest genome from the population.
|
|
393
393
|
|
|
@@ -435,7 +435,7 @@ Return a lightweight list of registered objective keys and their directions.
|
|
|
435
435
|
|
|
436
436
|
#### getOffspring
|
|
437
437
|
|
|
438
|
-
`() => import("
|
|
438
|
+
`() => import("src/architecture/network").default`
|
|
439
439
|
|
|
440
440
|
Generates an offspring by crossing over two parent networks.
|
|
441
441
|
Uses the crossover method described in the Instinct algorithm.
|
|
@@ -450,7 +450,7 @@ Returns a summary of mutation/operator statistics used by operator adaptation.
|
|
|
450
450
|
|
|
451
451
|
#### getParent
|
|
452
452
|
|
|
453
|
-
`() => import("
|
|
453
|
+
`() => import("src/architecture/network").default`
|
|
454
454
|
|
|
455
455
|
Selects a parent genome for breeding based on the selection method.
|
|
456
456
|
Supports multiple selection strategies, including POWER, FITNESS_PROPORTIONATE, and TOURNAMENT.
|
|
@@ -459,13 +459,13 @@ Returns: The selected parent genome.
|
|
|
459
459
|
|
|
460
460
|
#### getParetoArchive
|
|
461
461
|
|
|
462
|
-
`(maxEntries: number) => import("
|
|
462
|
+
`(maxEntries: number) => import("src/neat/neat.types").ParetoArchiveEntry[]`
|
|
463
463
|
|
|
464
464
|
Get recent Pareto archive entries (meta information about archived fronts).
|
|
465
465
|
|
|
466
466
|
#### getParetoFronts
|
|
467
467
|
|
|
468
|
-
`(maxFronts: number) => import("
|
|
468
|
+
`(maxFronts: number) => import("src/architecture/network").default[][]`
|
|
469
469
|
|
|
470
470
|
Reconstruct Pareto fronts for the current population snapshot.
|
|
471
471
|
|
|
@@ -477,7 +477,7 @@ Return recent performance statistics for the most recent evaluation and evolve o
|
|
|
477
477
|
|
|
478
478
|
#### getSpeciesHistory
|
|
479
479
|
|
|
480
|
-
`() => import("
|
|
480
|
+
`() => import("src/neat/neat.types").SpeciesHistoryEntry[]`
|
|
481
481
|
|
|
482
482
|
Returns the historical species statistics recorded each generation.
|
|
483
483
|
|
|
@@ -489,7 +489,7 @@ Return a concise summary for each current species.
|
|
|
489
489
|
|
|
490
490
|
#### getTelemetry
|
|
491
491
|
|
|
492
|
-
`() => import("
|
|
492
|
+
`() => import("src/neat/neat.types").TelemetryEntry[]`
|
|
493
493
|
|
|
494
494
|
Return the internal telemetry buffer.
|
|
495
495
|
|
|
@@ -510,7 +510,7 @@ Parameters:
|
|
|
510
510
|
|
|
511
511
|
#### importState
|
|
512
512
|
|
|
513
|
-
`(bundle: any, fitness: (n: import("
|
|
513
|
+
`(bundle: any, fitness: (n: import("src/architecture/network").default) => number) => Promise<import("src/neat").default>`
|
|
514
514
|
|
|
515
515
|
Convenience: restore full evolutionary state previously produced by exportState().
|
|
516
516
|
|
|
@@ -561,7 +561,7 @@ Returns: Array of deterministic random samples.
|
|
|
561
561
|
|
|
562
562
|
#### selectMutationMethod
|
|
563
563
|
|
|
564
|
-
`(genome: import("
|
|
564
|
+
`(genome: import("src/architecture/network").default, rawReturnForTest: boolean) => any`
|
|
565
565
|
|
|
566
566
|
Selects a mutation method for a given genome based on constraints.
|
|
567
567
|
|
|
@@ -580,7 +580,7 @@ Sorts the population in descending order of fitness scores.
|
|
|
580
580
|
|
|
581
581
|
#### spawnFromParent
|
|
582
582
|
|
|
583
|
-
`(parent: import("
|
|
583
|
+
`(parent: import("src/architecture/network").default, mutateCount: number) => import("src/architecture/network").default`
|
|
584
584
|
|
|
585
585
|
Spawn a new genome derived from a single parent while preserving Neat bookkeeping.
|
|
586
586
|
|
|
@@ -717,7 +717,7 @@ Returns: True when fast-slab activation can be used.
|
|
|
717
717
|
|
|
718
718
|
#### _compatibilityDistance
|
|
719
719
|
|
|
720
|
-
`(netA: import("
|
|
720
|
+
`(netA: import("src/architecture/network").default, netB: import("src/architecture/network").default) => number`
|
|
721
721
|
|
|
722
722
|
Compute compatibility distance between two networks (delegates to compat module).
|
|
723
723
|
|
|
@@ -729,7 +729,7 @@ Returns: Compatibility distance scalar.
|
|
|
729
729
|
|
|
730
730
|
#### _computeDiversityStats
|
|
731
731
|
|
|
732
|
-
`() => import("
|
|
732
|
+
`() => import("src/neat/neat.diversity.utils").DiversityStats`
|
|
733
733
|
|
|
734
734
|
Compute and cache diversity statistics used by telemetry and tests.
|
|
735
735
|
|
|
@@ -831,7 +831,7 @@ Returns: Gaussian random value.
|
|
|
831
831
|
|
|
832
832
|
#### _getObjectives
|
|
833
833
|
|
|
834
|
-
`() => import("
|
|
834
|
+
`() => import("src/neat/neat.types").ObjectiveDescriptor[]`
|
|
835
835
|
|
|
836
836
|
Internal: return cached objective descriptors, building if stale.
|
|
837
837
|
|
|
@@ -863,7 +863,7 @@ Whether to apply separate bias clipping.
|
|
|
863
863
|
|
|
864
864
|
#### _hasPath
|
|
865
865
|
|
|
866
|
-
`(from: import("
|
|
866
|
+
`(from: import("src/architecture/node").default, to: import("src/architecture/node").default) => boolean`
|
|
867
867
|
|
|
868
868
|
Check whether a directed path exists between two nodes.
|
|
869
869
|
|
|
@@ -943,7 +943,7 @@ Mixed precision state counters.
|
|
|
943
943
|
|
|
944
944
|
#### _mutateAddConnReuse
|
|
945
945
|
|
|
946
|
-
`(genome: import("
|
|
946
|
+
`(genome: import("src/architecture/network").default) => void`
|
|
947
947
|
|
|
948
948
|
Add-connection mutation that reuses global innovation ids when possible.
|
|
949
949
|
|
|
@@ -954,7 +954,7 @@ Returns: Mutated genome with added connection.
|
|
|
954
954
|
|
|
955
955
|
#### _mutateAddNodeReuse
|
|
956
956
|
|
|
957
|
-
`(genome: import("
|
|
957
|
+
`(genome: import("src/architecture/network").default) => Promise<void>`
|
|
958
958
|
|
|
959
959
|
Add-node mutation that reuses global innovation ids when possible.
|
|
960
960
|
|
|
@@ -1035,7 +1035,7 @@ Internal numeric state for the deterministic xorshift RNG when no user RNG is pr
|
|
|
1035
1035
|
|
|
1036
1036
|
#### _safeUpdateWeight
|
|
1037
1037
|
|
|
1038
|
-
`(connection: import("
|
|
1038
|
+
`(connection: import("src/architecture/connection").default, delta: number) => void`
|
|
1039
1039
|
|
|
1040
1040
|
Internal helper to safely update a connection weight with clipping and NaN checks.
|
|
1041
1041
|
|
|
@@ -1045,7 +1045,7 @@ Slab dirty marker.
|
|
|
1045
1045
|
|
|
1046
1046
|
#### _sortSpeciesMembers
|
|
1047
1047
|
|
|
1048
|
-
`(sp: import("
|
|
1048
|
+
`(sp: import("src/neat/neat.types").SpeciesLike) => void`
|
|
1049
1049
|
|
|
1050
1050
|
Sort members within a species according to fitness and lineage rules.
|
|
1051
1051
|
|
|
@@ -1076,7 +1076,7 @@ Dynamic stochastic depth schedule.
|
|
|
1076
1076
|
|
|
1077
1077
|
#### _structuralEntropy
|
|
1078
1078
|
|
|
1079
|
-
`(genome: import("
|
|
1079
|
+
`(genome: import("src/architecture/network").default) => number`
|
|
1080
1080
|
|
|
1081
1081
|
Compatibility wrapper retained for tests that reference (neat as any)._structuralEntropy.
|
|
1082
1082
|
|
|
@@ -1137,7 +1137,7 @@ Original weights captured for weight-noise recovery.
|
|
|
1137
1137
|
|
|
1138
1138
|
#### acquire
|
|
1139
1139
|
|
|
1140
|
-
`(from: import("
|
|
1140
|
+
`(from: import("src/architecture/node").default, to: import("src/architecture/node").default, weight: number | undefined) => import("src/architecture/connection").default`
|
|
1141
1141
|
|
|
1142
1142
|
Acquire a `Connection` from the pool (or construct new). Fields are fully reset & given
|
|
1143
1143
|
a fresh sequential `innovation` id. Prefer this in evolutionary algorithms that mutate
|
|
@@ -1157,11 +1157,6 @@ Returns: Reinitialized connection instance.
|
|
|
1157
1157
|
Activates the network using the given input array.
|
|
1158
1158
|
Performs a forward pass through the network, calculating the activation of each node.
|
|
1159
1159
|
|
|
1160
|
-
Parameters:
|
|
1161
|
-
- `` - - An array of numerical values corresponding to the network's input nodes.
|
|
1162
|
-
- `` - - Flag indicating if the activation is part of a training process.
|
|
1163
|
-
- `` - - Maximum allowed activation depth to prevent infinite loops/cycles.
|
|
1164
|
-
|
|
1165
1160
|
Returns: An array of numerical values representing the activations of the network's output nodes.
|
|
1166
1161
|
|
|
1167
1162
|
#### activate
|
|
@@ -1214,9 +1209,6 @@ Activates all nodes in the group. If input values are provided, they are assigne
|
|
|
1214
1209
|
sequentially to the nodes before activation. Otherwise, nodes activate based on their
|
|
1215
1210
|
existing states and incoming connections.
|
|
1216
1211
|
|
|
1217
|
-
Parameters:
|
|
1218
|
-
- `` - - An optional array of input values. If provided, its length must match the number of nodes in the group.
|
|
1219
|
-
|
|
1220
1212
|
Returns: An array containing the activation value of each node in the group, in order.
|
|
1221
1213
|
|
|
1222
1214
|
#### activateBatch
|
|
@@ -1237,7 +1229,7 @@ Returns: Array of output vectors, each length equals this.output
|
|
|
1237
1229
|
|
|
1238
1230
|
#### activateRaw
|
|
1239
1231
|
|
|
1240
|
-
`(input: number[], training: boolean, maxActivationDepth: number) => import("
|
|
1232
|
+
`(input: number[], training: boolean, maxActivationDepth: number) => import("src/architecture/activationArrayPool").ActivationArray`
|
|
1241
1233
|
|
|
1242
1234
|
Raw activation that can return a typed array when pooling is enabled (zero-copy).
|
|
1243
1235
|
If reuseActivationArrays=false falls back to standard activate().
|
|
@@ -1255,7 +1247,7 @@ The output value of the node after applying the activation function. This is the
|
|
|
1255
1247
|
|
|
1256
1248
|
#### addGenome
|
|
1257
1249
|
|
|
1258
|
-
`(genome: import("
|
|
1250
|
+
`(genome: import("src/architecture/network").default, parents: number[] | undefined) => void`
|
|
1259
1251
|
|
|
1260
1252
|
Register an externally-created genome into the `Neat` population.
|
|
1261
1253
|
|
|
@@ -1344,7 +1336,7 @@ index and configuration in `options.evolutionPruning`.
|
|
|
1344
1336
|
|
|
1345
1337
|
#### attention
|
|
1346
1338
|
|
|
1347
|
-
`(size: number, heads: number) => import("
|
|
1339
|
+
`(size: number, heads: number) => import("src/architecture/layer").default`
|
|
1348
1340
|
|
|
1349
1341
|
Creates a multi-head self-attention layer (stub implementation).
|
|
1350
1342
|
|
|
@@ -1356,7 +1348,7 @@ Returns: A new Layer instance representing an attention layer.
|
|
|
1356
1348
|
|
|
1357
1349
|
#### batchNorm
|
|
1358
1350
|
|
|
1359
|
-
`(size: number) => import("
|
|
1351
|
+
`(size: number) => import("src/architecture/layer").default`
|
|
1360
1352
|
|
|
1361
1353
|
Creates a batch normalization layer.
|
|
1362
1354
|
Applies batch normalization to the activations of the nodes in this layer during activation.
|
|
@@ -1411,7 +1403,7 @@ Clear the dynamic global weight-noise schedule.
|
|
|
1411
1403
|
|
|
1412
1404
|
#### clone
|
|
1413
1405
|
|
|
1414
|
-
`() => import("
|
|
1406
|
+
`() => import("src/architecture/network").default`
|
|
1415
1407
|
|
|
1416
1408
|
Creates a deep copy of the network.
|
|
1417
1409
|
|
|
@@ -1428,22 +1420,17 @@ Parameters:
|
|
|
1428
1420
|
|
|
1429
1421
|
#### connect
|
|
1430
1422
|
|
|
1431
|
-
`(from: import("
|
|
1423
|
+
`(from: import("src/architecture/node").default, to: import("src/architecture/node").default, weight: number | undefined) => import("src/architecture/connection").default[]`
|
|
1432
1424
|
|
|
1433
1425
|
Creates a connection between two nodes in the network.
|
|
1434
1426
|
Handles both regular connections and self-connections.
|
|
1435
1427
|
Adds the new connection object(s) to the appropriate network list (`connections` or `selfconns`).
|
|
1436
1428
|
|
|
1437
|
-
Parameters:
|
|
1438
|
-
- `` - - The source node of the connection.
|
|
1439
|
-
- `` - - The target node of the connection.
|
|
1440
|
-
- `` - - Optional weight for the connection. If not provided, a random weight is usually assigned by the underlying `Node.connect` method.
|
|
1441
|
-
|
|
1442
1429
|
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.
|
|
1443
1430
|
|
|
1444
1431
|
#### connect
|
|
1445
1432
|
|
|
1446
|
-
`(target: import("
|
|
1433
|
+
`(target: import("src/architecture/node").default | { nodes: import("src/architecture/node").default[]; }, weight: number | undefined) => import("src/architecture/connection").default[]`
|
|
1447
1434
|
|
|
1448
1435
|
Creates a connection from this node to a target node or all nodes in a group.
|
|
1449
1436
|
|
|
@@ -1455,7 +1442,7 @@ Returns: An array containing the newly created Connection object(s).
|
|
|
1455
1442
|
|
|
1456
1443
|
#### connect
|
|
1457
1444
|
|
|
1458
|
-
`(target: import("
|
|
1445
|
+
`(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[]`
|
|
1459
1446
|
|
|
1460
1447
|
Connects this layer's output to a target component (Layer, Group, or Node).
|
|
1461
1448
|
|
|
@@ -1472,16 +1459,11 @@ Returns: An array containing the newly created connection objects.
|
|
|
1472
1459
|
|
|
1473
1460
|
#### connect
|
|
1474
1461
|
|
|
1475
|
-
`(target: import("
|
|
1462
|
+
`(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[]`
|
|
1476
1463
|
|
|
1477
1464
|
Establishes connections from all nodes in this group to a target Group, Layer, or Node.
|
|
1478
1465
|
The connection pattern (e.g., all-to-all, one-to-one) can be specified.
|
|
1479
1466
|
|
|
1480
|
-
Parameters:
|
|
1481
|
-
- `` - - The destination entity (Group, Layer, or Node) to connect to.
|
|
1482
|
-
- `` - - 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.
|
|
1483
|
-
- `` - - An optional fixed weight to assign to all created connections. If not provided, weights might be initialized randomly or based on node defaults.
|
|
1484
|
-
|
|
1485
1467
|
Returns: An array containing all the connection objects created.
|
|
1486
1468
|
|
|
1487
1469
|
#### connections
|
|
@@ -1490,7 +1472,7 @@ Connection list.
|
|
|
1490
1472
|
|
|
1491
1473
|
#### construct
|
|
1492
1474
|
|
|
1493
|
-
`(list: (import("
|
|
1475
|
+
`(list: (import("src/architecture/node").default | import("src/architecture/layer").default | import("src/architecture/group").default)[]) => import("src/architecture/network").default`
|
|
1494
1476
|
|
|
1495
1477
|
Constructs a Network instance from an array of interconnected Layers, Groups, or Nodes.
|
|
1496
1478
|
|
|
@@ -1499,14 +1481,11 @@ gates, and self-connections, and determines the network's input and output sizes
|
|
|
1499
1481
|
on the `type` property ('input' or 'output') set on the nodes. It uses Sets internally
|
|
1500
1482
|
for efficient handling of unique elements during construction.
|
|
1501
1483
|
|
|
1502
|
-
Parameters:
|
|
1503
|
-
- `` - - An array containing the building blocks (Nodes, Layers, Groups) of the network, assumed to be already interconnected.
|
|
1504
|
-
|
|
1505
1484
|
Returns: A Network object representing the constructed architecture.
|
|
1506
1485
|
|
|
1507
1486
|
#### conv1d
|
|
1508
1487
|
|
|
1509
|
-
`(size: number, kernelSize: number, stride: number, padding: number) => import("
|
|
1488
|
+
`(size: number, kernelSize: number, stride: number, padding: number) => import("src/architecture/layer").default`
|
|
1510
1489
|
|
|
1511
1490
|
Creates a 1D convolutional layer (stub implementation).
|
|
1512
1491
|
|
|
@@ -1520,26 +1499,21 @@ Returns: A new Layer instance representing a 1D convolutional layer.
|
|
|
1520
1499
|
|
|
1521
1500
|
#### createMLP
|
|
1522
1501
|
|
|
1523
|
-
`(inputCount: number, hiddenCounts: number[], outputCount: number) => import("
|
|
1502
|
+
`(inputCount: number, hiddenCounts: number[], outputCount: number) => import("src/architecture/network").default`
|
|
1524
1503
|
|
|
1525
1504
|
Creates a fully connected, strictly layered MLP network.
|
|
1526
1505
|
|
|
1527
|
-
Parameters:
|
|
1528
|
-
- `` - - Number of input nodes
|
|
1529
|
-
- `` - - Array of hidden layer sizes (e.g. [2,3] for two hidden layers)
|
|
1530
|
-
- `` - - Number of output nodes
|
|
1531
|
-
|
|
1532
1506
|
Returns: A new, fully connected, layered MLP
|
|
1533
1507
|
|
|
1534
1508
|
#### createPool
|
|
1535
1509
|
|
|
1536
|
-
`(network: import("
|
|
1510
|
+
`(network: import("src/architecture/network").default | null) => void`
|
|
1537
1511
|
|
|
1538
1512
|
Create initial population pool. Delegates to helpers if present.
|
|
1539
1513
|
|
|
1540
1514
|
#### crossOver
|
|
1541
1515
|
|
|
1542
|
-
`(network1: import("
|
|
1516
|
+
`(network1: import("src/architecture/network").default, network2: import("src/architecture/network").default, equal: boolean) => import("src/architecture/network").default`
|
|
1543
1517
|
|
|
1544
1518
|
Creates a new offspring network by performing crossover between two parent networks.
|
|
1545
1519
|
This method implements the crossover mechanism inspired by the NEAT algorithm and described
|
|
@@ -1547,12 +1521,6 @@ in the Instinct paper, combining genes (nodes and connections) from both parents
|
|
|
1547
1521
|
Fitness scores can influence the inheritance process. Matching genes are inherited randomly,
|
|
1548
1522
|
while disjoint/excess genes are typically inherited from the fitter parent (or randomly if fitness is equal or `equal` flag is set).
|
|
1549
1523
|
|
|
1550
|
-
Parameters:
|
|
1551
|
-
- `` - - The first parent network.
|
|
1552
|
-
- `` - - The second parent network.
|
|
1553
|
-
- `` - - If true, disjoint and excess genes are inherited randomly regardless of fitness.
|
|
1554
|
-
If false (default), they are inherited from the fitter parent.
|
|
1555
|
-
|
|
1556
1524
|
Returns: A new Network instance representing the offspring.
|
|
1557
1525
|
|
|
1558
1526
|
#### dcMask
|
|
@@ -1561,7 +1529,7 @@ DropConnect active mask: 1 = not dropped (active), 0 = dropped for this stochast
|
|
|
1561
1529
|
|
|
1562
1530
|
#### dense
|
|
1563
1531
|
|
|
1564
|
-
`(size: number) => import("
|
|
1532
|
+
`(size: number) => import("src/architecture/layer").default`
|
|
1565
1533
|
|
|
1566
1534
|
Creates a standard fully connected (dense) layer.
|
|
1567
1535
|
|
|
@@ -1579,7 +1547,7 @@ The derivative of the activation function evaluated at the node's current state.
|
|
|
1579
1547
|
|
|
1580
1548
|
#### describeArchitecture
|
|
1581
1549
|
|
|
1582
|
-
`() => import("
|
|
1550
|
+
`() => import("src/architecture/network/network.types").NetworkArchitectureDescriptor`
|
|
1583
1551
|
|
|
1584
1552
|
Resolves a stable architecture descriptor for telemetry/UI consumers.
|
|
1585
1553
|
|
|
@@ -1590,17 +1558,11 @@ Returns: Architecture descriptor with hidden-layer widths and provenance.
|
|
|
1590
1558
|
|
|
1591
1559
|
#### deserialize
|
|
1592
1560
|
|
|
1593
|
-
`(data: [number[], number[], string[], { from: number; to: number; weight: number; gater: number | null; }[], number, number] | unknown[], inputSize: number | undefined, outputSize: number | undefined) => import("
|
|
1561
|
+
`(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`
|
|
1594
1562
|
|
|
1595
1563
|
Creates a Network instance from serialized data produced by `serialize()`.
|
|
1596
1564
|
Reconstructs the network structure and state based on the provided arrays.
|
|
1597
1565
|
|
|
1598
|
-
Parameters:
|
|
1599
|
-
- `` - - The serialized network data array, typically obtained from `network.serialize()`.
|
|
1600
|
-
Expected format: `[activations, states, squashNames, connectionData, inputSize, outputSize]`.
|
|
1601
|
-
- `` - - Optional input size override.
|
|
1602
|
-
- `` - - Optional output size override.
|
|
1603
|
-
|
|
1604
1566
|
Returns: A new Network instance reconstructed from the serialized data.
|
|
1605
1567
|
|
|
1606
1568
|
#### disableDropConnect
|
|
@@ -1623,19 +1585,15 @@ Disable all weight-noise settings.
|
|
|
1623
1585
|
|
|
1624
1586
|
#### disconnect
|
|
1625
1587
|
|
|
1626
|
-
`(from: import("
|
|
1588
|
+
`(from: import("src/architecture/node").default, to: import("src/architecture/node").default) => void`
|
|
1627
1589
|
|
|
1628
1590
|
Disconnects two nodes, removing the connection between them.
|
|
1629
1591
|
Handles both regular connections and self-connections.
|
|
1630
1592
|
If the connection being removed was gated, it is also ungated.
|
|
1631
1593
|
|
|
1632
|
-
Parameters:
|
|
1633
|
-
- `` - - The source node of the connection to remove.
|
|
1634
|
-
- `` - - The target node of the connection to remove.
|
|
1635
|
-
|
|
1636
1594
|
#### disconnect
|
|
1637
1595
|
|
|
1638
|
-
`(target: import("
|
|
1596
|
+
`(target: import("src/architecture/node").default, twosided: boolean) => void`
|
|
1639
1597
|
|
|
1640
1598
|
Removes the connection from this node to the target node.
|
|
1641
1599
|
|
|
@@ -1645,7 +1603,7 @@ Parameters:
|
|
|
1645
1603
|
|
|
1646
1604
|
#### disconnect
|
|
1647
1605
|
|
|
1648
|
-
`(target: import("
|
|
1606
|
+
`(target: import("src/architecture/node").default | import("src/architecture/group").default, twosided: boolean | undefined) => void`
|
|
1649
1607
|
|
|
1650
1608
|
Removes connections between this layer's nodes and a target Group or Node.
|
|
1651
1609
|
|
|
@@ -1655,14 +1613,10 @@ Parameters:
|
|
|
1655
1613
|
|
|
1656
1614
|
#### disconnect
|
|
1657
1615
|
|
|
1658
|
-
`(target: import("
|
|
1616
|
+
`(target: import("src/architecture/node").default | import("src/architecture/group").default, twosided: boolean) => void`
|
|
1659
1617
|
|
|
1660
1618
|
Removes connections between nodes in this group and a target Group or Node.
|
|
1661
1619
|
|
|
1662
|
-
Parameters:
|
|
1663
|
-
- `` - - The Group or Node to disconnect from.
|
|
1664
|
-
- `` - - 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).
|
|
1665
|
-
|
|
1666
1620
|
#### dropConnectActiveMask
|
|
1667
1621
|
|
|
1668
1622
|
Convenience alias for DropConnect mask with clearer naming.
|
|
@@ -1699,27 +1653,24 @@ Parameters:
|
|
|
1699
1653
|
|
|
1700
1654
|
#### enforceMinimumHiddenLayerSizes
|
|
1701
1655
|
|
|
1702
|
-
`(network: import("
|
|
1656
|
+
`(network: import("src/architecture/network").default) => import("src/architecture/network").default`
|
|
1703
1657
|
|
|
1704
1658
|
Enforces the minimum hidden layer size rule on a network.
|
|
1705
1659
|
|
|
1706
1660
|
This ensures that all hidden layers have at least min(input, output) + 1 nodes,
|
|
1707
1661
|
which is a common heuristic to ensure networks have adequate representation capacity.
|
|
1708
1662
|
|
|
1709
|
-
Parameters:
|
|
1710
|
-
- `` - - The network to enforce minimum hidden layer sizes on
|
|
1711
|
-
|
|
1712
1663
|
Returns: The same network with properly sized hidden layers
|
|
1713
1664
|
|
|
1714
1665
|
#### ensureMinHiddenNodes
|
|
1715
1666
|
|
|
1716
|
-
`(network: import("
|
|
1667
|
+
`(network: import("src/architecture/network").default, multiplierOverride: number | undefined) => Promise<void>`
|
|
1717
1668
|
|
|
1718
1669
|
Ensure a network has the minimum number of hidden nodes according to configured policy.
|
|
1719
1670
|
|
|
1720
1671
|
#### ensureNoDeadEnds
|
|
1721
1672
|
|
|
1722
|
-
`(network: import("
|
|
1673
|
+
`(network: import("src/architecture/network").default) => void`
|
|
1723
1674
|
|
|
1724
1675
|
Delegate ensureNoDeadEnds to mutation module (added for backward compat).
|
|
1725
1676
|
|
|
@@ -1738,7 +1689,7 @@ Returns: Aggregated evaluation result (implementation specific).
|
|
|
1738
1689
|
|
|
1739
1690
|
#### evolve
|
|
1740
1691
|
|
|
1741
|
-
`() => Promise<import("
|
|
1692
|
+
`() => Promise<import("src/architecture/network").default>`
|
|
1742
1693
|
|
|
1743
1694
|
Evolves the population by selecting, mutating, and breeding genomes.
|
|
1744
1695
|
This method is delegated to `src/neat/neat.evolve.ts` during the migration.
|
|
@@ -1812,19 +1763,16 @@ The source (pre-synaptic) node supplying activation.
|
|
|
1812
1763
|
|
|
1813
1764
|
#### fromJSON
|
|
1814
1765
|
|
|
1815
|
-
`(json: Record<string, unknown>) => import("
|
|
1766
|
+
`(json: Record<string, unknown>) => import("src/architecture/network").default`
|
|
1816
1767
|
|
|
1817
1768
|
Reconstructs a network from a JSON object (latest standard).
|
|
1818
1769
|
Handles formatVersion, robust error handling, and index-based references.
|
|
1819
1770
|
|
|
1820
|
-
Parameters:
|
|
1821
|
-
- `` - - The JSON object representing the network.
|
|
1822
|
-
|
|
1823
1771
|
Returns: The reconstructed network.
|
|
1824
1772
|
|
|
1825
1773
|
#### fromJSON
|
|
1826
1774
|
|
|
1827
|
-
`(json: { bias: number; type: string; squash: string; mask: number; }) => import("
|
|
1775
|
+
`(json: { bias: number; type: string; squash: string; mask: number; }) => import("src/architecture/node").default`
|
|
1828
1776
|
|
|
1829
1777
|
Creates a Node instance from a JSON object.
|
|
1830
1778
|
|
|
@@ -1841,19 +1789,15 @@ large populations where most connections are ungated.
|
|
|
1841
1789
|
|
|
1842
1790
|
#### gate
|
|
1843
1791
|
|
|
1844
|
-
`(node: import("
|
|
1792
|
+
`(node: import("src/architecture/node").default, connection: import("src/architecture/connection").default) => void`
|
|
1845
1793
|
|
|
1846
1794
|
Gates a connection with a specified node.
|
|
1847
1795
|
The activation of the `node` (gater) will modulate the weight of the `connection`.
|
|
1848
1796
|
Adds the connection to the network's `gates` list.
|
|
1849
1797
|
|
|
1850
|
-
Parameters:
|
|
1851
|
-
- `` - - The node that will act as the gater. Must be part of this network.
|
|
1852
|
-
- `` - - The connection to be gated.
|
|
1853
|
-
|
|
1854
1798
|
#### gate
|
|
1855
1799
|
|
|
1856
|
-
`(connections: import("
|
|
1800
|
+
`(connections: import("src/architecture/connection").default | import("src/architecture/connection").default[]) => void`
|
|
1857
1801
|
|
|
1858
1802
|
Makes this node gate the provided connection(s).
|
|
1859
1803
|
The connection's gain will be controlled by this node's activation value.
|
|
@@ -1863,7 +1807,7 @@ Parameters:
|
|
|
1863
1807
|
|
|
1864
1808
|
#### gate
|
|
1865
1809
|
|
|
1866
|
-
`(connections: import("
|
|
1810
|
+
`(connections: import("src/architecture/connection").default[], method: unknown) => void`
|
|
1867
1811
|
|
|
1868
1812
|
Applies gating to a set of connections originating from this layer's output group.
|
|
1869
1813
|
|
|
@@ -1876,15 +1820,11 @@ Parameters:
|
|
|
1876
1820
|
|
|
1877
1821
|
#### gate
|
|
1878
1822
|
|
|
1879
|
-
`(connections: import("
|
|
1823
|
+
`(connections: import("src/architecture/connection").default | import("src/architecture/connection").default[], method: unknown) => void`
|
|
1880
1824
|
|
|
1881
1825
|
Configures nodes within this group to act as gates for the specified connection(s).
|
|
1882
1826
|
Gating allows the output of a node in this group to modulate the flow of signal through the gated connection.
|
|
1883
1827
|
|
|
1884
|
-
Parameters:
|
|
1885
|
-
- `` - - A single connection object or an array of connection objects to be gated.
|
|
1886
|
-
- `` - - 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.
|
|
1887
|
-
|
|
1888
1828
|
#### gater
|
|
1889
1829
|
|
|
1890
1830
|
Optional gating node whose activation can modulate effective weight (symbol-backed).
|
|
@@ -1905,7 +1845,7 @@ Calculates the average fitness score of the population.
|
|
|
1905
1845
|
|
|
1906
1846
|
#### getConnectionSlab
|
|
1907
1847
|
|
|
1908
|
-
`() => import("
|
|
1848
|
+
`() => import("src/architecture/network/slab/network.slab.utils.types").ConnectionSlabView`
|
|
1909
1849
|
|
|
1910
1850
|
Read slab structures for fast activation.
|
|
1911
1851
|
|
|
@@ -1921,13 +1861,13 @@ Returns: Current sparsity in $[0,1]$.
|
|
|
1921
1861
|
|
|
1922
1862
|
#### getDiversityStats
|
|
1923
1863
|
|
|
1924
|
-
`() => import("
|
|
1864
|
+
`() => import("src/neat/neat.diversity.utils").DiversityStats`
|
|
1925
1865
|
|
|
1926
1866
|
Return the latest cached diversity statistics.
|
|
1927
1867
|
|
|
1928
1868
|
#### getFittest
|
|
1929
1869
|
|
|
1930
|
-
`() => import("
|
|
1870
|
+
`() => import("src/architecture/network").default`
|
|
1931
1871
|
|
|
1932
1872
|
Retrieves the fittest genome from the population.
|
|
1933
1873
|
|
|
@@ -1987,7 +1927,7 @@ Return a lightweight list of registered objective keys and their directions.
|
|
|
1987
1927
|
|
|
1988
1928
|
#### getOffspring
|
|
1989
1929
|
|
|
1990
|
-
`() => import("
|
|
1930
|
+
`() => import("src/architecture/network").default`
|
|
1991
1931
|
|
|
1992
1932
|
Generates an offspring by crossing over two parent networks.
|
|
1993
1933
|
Uses the crossover method described in the Instinct algorithm.
|
|
@@ -2002,7 +1942,7 @@ Returns a summary of mutation/operator statistics used by operator adaptation.
|
|
|
2002
1942
|
|
|
2003
1943
|
#### getParent
|
|
2004
1944
|
|
|
2005
|
-
`() => import("
|
|
1945
|
+
`() => import("src/architecture/network").default`
|
|
2006
1946
|
|
|
2007
1947
|
Selects a parent genome for breeding based on the selection method.
|
|
2008
1948
|
Supports multiple selection strategies, including POWER, FITNESS_PROPORTIONATE, and TOURNAMENT.
|
|
@@ -2011,13 +1951,13 @@ Returns: The selected parent genome.
|
|
|
2011
1951
|
|
|
2012
1952
|
#### getParetoArchive
|
|
2013
1953
|
|
|
2014
|
-
`(maxEntries: number) => import("
|
|
1954
|
+
`(maxEntries: number) => import("src/neat/neat.types").ParetoArchiveEntry[]`
|
|
2015
1955
|
|
|
2016
1956
|
Get recent Pareto archive entries (meta information about archived fronts).
|
|
2017
1957
|
|
|
2018
1958
|
#### getParetoFronts
|
|
2019
1959
|
|
|
2020
|
-
`(maxFronts: number) => import("
|
|
1960
|
+
`(maxFronts: number) => import("src/architecture/network").default[][]`
|
|
2021
1961
|
|
|
2022
1962
|
Reconstruct Pareto fronts for the current population snapshot.
|
|
2023
1963
|
|
|
@@ -2051,7 +1991,7 @@ Returns: RNG state value when present.
|
|
|
2051
1991
|
|
|
2052
1992
|
#### getSpeciesHistory
|
|
2053
1993
|
|
|
2054
|
-
`() => import("
|
|
1994
|
+
`() => import("src/neat/neat.types").SpeciesHistoryEntry[]`
|
|
2055
1995
|
|
|
2056
1996
|
Returns the historical species statistics recorded each generation.
|
|
2057
1997
|
|
|
@@ -2063,7 +2003,7 @@ Return a concise summary for each current species.
|
|
|
2063
2003
|
|
|
2064
2004
|
#### getTelemetry
|
|
2065
2005
|
|
|
2066
|
-
`() => import("
|
|
2006
|
+
`() => import("src/neat/neat.types").TelemetryEntry[]`
|
|
2067
2007
|
|
|
2068
2008
|
Return the internal telemetry buffer.
|
|
2069
2009
|
|
|
@@ -2079,7 +2019,7 @@ Generic gradient accumulator (RMSProp / AdaGrad) (was opt_cache).
|
|
|
2079
2019
|
|
|
2080
2020
|
#### gru
|
|
2081
2021
|
|
|
2082
|
-
`(size: number) => import("
|
|
2022
|
+
`(size: number) => import("src/architecture/layer").default`
|
|
2083
2023
|
|
|
2084
2024
|
Creates a Gated Recurrent Unit (GRU) layer.
|
|
2085
2025
|
|
|
@@ -2094,15 +2034,12 @@ Returns: A new Layer instance configured as a GRU layer.
|
|
|
2094
2034
|
|
|
2095
2035
|
#### gru
|
|
2096
2036
|
|
|
2097
|
-
`(layers: number[]) => import("
|
|
2037
|
+
`(layers: number[]) => import("src/architecture/network").default`
|
|
2098
2038
|
|
|
2099
2039
|
Creates a Gated Recurrent Unit (GRU) network.
|
|
2100
2040
|
GRUs are another type of recurrent neural network, similar to LSTMs but often simpler.
|
|
2101
2041
|
This constructor uses `Layer.gru` to create the core GRU blocks.
|
|
2102
2042
|
|
|
2103
|
-
Parameters:
|
|
2104
|
-
- `` - - 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.
|
|
2105
|
-
|
|
2106
2043
|
Returns: The constructed GRU network.
|
|
2107
2044
|
|
|
2108
2045
|
#### hasGater
|
|
@@ -2111,15 +2048,12 @@ Whether a gater node is assigned (modulates gain); true if the gater symbol fiel
|
|
|
2111
2048
|
|
|
2112
2049
|
#### hopfield
|
|
2113
2050
|
|
|
2114
|
-
`(size: number) => import("
|
|
2051
|
+
`(size: number) => import("src/architecture/network").default`
|
|
2115
2052
|
|
|
2116
2053
|
Creates a Hopfield network.
|
|
2117
2054
|
Hopfield networks are a form of recurrent neural network often used for associative memory tasks.
|
|
2118
2055
|
This implementation creates a simple, fully connected structure.
|
|
2119
2056
|
|
|
2120
|
-
Parameters:
|
|
2121
|
-
- `` - - The number of nodes in the network (input and output layers will have this size).
|
|
2122
|
-
|
|
2123
2057
|
Returns: The constructed Hopfield network.
|
|
2124
2058
|
|
|
2125
2059
|
#### import
|
|
@@ -2139,7 +2073,7 @@ Parameters:
|
|
|
2139
2073
|
|
|
2140
2074
|
#### importState
|
|
2141
2075
|
|
|
2142
|
-
`(bundle: any, fitness: (n: import("
|
|
2076
|
+
`(bundle: any, fitness: (n: import("src/architecture/network").default) => number) => Promise<import("src/neat").default>`
|
|
2143
2077
|
|
|
2144
2078
|
Convenience: restore full evolutionary state previously produced by exportState().
|
|
2145
2079
|
|
|
@@ -2181,7 +2115,7 @@ Input node count.
|
|
|
2181
2115
|
|
|
2182
2116
|
#### input
|
|
2183
2117
|
|
|
2184
|
-
`(from: import("
|
|
2118
|
+
`(from: import("src/architecture/group").default | import("src/architecture/layer/layer.utils.types").LayerLike, method: unknown, weight: number | undefined) => import("src/architecture/connection").default[]`
|
|
2185
2119
|
|
|
2186
2120
|
Handles the connection logic when this layer is the *target* of a connection.
|
|
2187
2121
|
|
|
@@ -2202,7 +2136,7 @@ Internal flag to detect cycles during activation
|
|
|
2202
2136
|
|
|
2203
2137
|
#### isConnectedTo
|
|
2204
2138
|
|
|
2205
|
-
`(target: import("
|
|
2139
|
+
`(target: import("src/architecture/node").default) => boolean`
|
|
2206
2140
|
|
|
2207
2141
|
Checks if this node is connected to another node.
|
|
2208
2142
|
|
|
@@ -2213,7 +2147,7 @@ Returns: True if connected, otherwise false.
|
|
|
2213
2147
|
|
|
2214
2148
|
#### isProjectedBy
|
|
2215
2149
|
|
|
2216
|
-
`(node: import("
|
|
2150
|
+
`(node: import("src/architecture/node").default) => boolean`
|
|
2217
2151
|
|
|
2218
2152
|
Checks if the given node has a direct outgoing connection to this node.
|
|
2219
2153
|
Considers both regular incoming connections and the self-connection.
|
|
@@ -2225,7 +2159,7 @@ Returns: True if the given node projects to this node, false otherwise.
|
|
|
2225
2159
|
|
|
2226
2160
|
#### isProjectingTo
|
|
2227
2161
|
|
|
2228
|
-
`(node: import("
|
|
2162
|
+
`(node: import("src/architecture/node").default) => boolean`
|
|
2229
2163
|
|
|
2230
2164
|
Checks if this node has a direct outgoing connection to the given node.
|
|
2231
2165
|
Considers both regular outgoing connections and the self-connection.
|
|
@@ -2241,7 +2175,7 @@ Last skipped stochastic-depth layers from activation runtime state.
|
|
|
2241
2175
|
|
|
2242
2176
|
#### layerNorm
|
|
2243
2177
|
|
|
2244
|
-
`(size: number) => import("
|
|
2178
|
+
`(size: number) => import("src/architecture/layer").default`
|
|
2245
2179
|
|
|
2246
2180
|
Creates a layer normalization layer.
|
|
2247
2181
|
Applies layer normalization to the activations of the nodes in this layer during activation.
|
|
@@ -2261,7 +2195,7 @@ Lookahead: shadow (slow) weight parameter (was _la_shadowWeight).
|
|
|
2261
2195
|
|
|
2262
2196
|
#### lstm
|
|
2263
2197
|
|
|
2264
|
-
`(size: number) => import("
|
|
2198
|
+
`(size: number) => import("src/architecture/layer").default`
|
|
2265
2199
|
|
|
2266
2200
|
Creates a Long Short-Term Memory (LSTM) layer.
|
|
2267
2201
|
|
|
@@ -2276,18 +2210,12 @@ Returns: A new Layer instance configured as an LSTM layer.
|
|
|
2276
2210
|
|
|
2277
2211
|
#### lstm
|
|
2278
2212
|
|
|
2279
|
-
`(layerArgs: (number | { inputToOutput?: boolean | undefined; })[]) => import("
|
|
2213
|
+
`(layerArgs: (number | { inputToOutput?: boolean | undefined; })[]) => import("src/architecture/network").default`
|
|
2280
2214
|
|
|
2281
2215
|
Creates a Long Short-Term Memory (LSTM) network.
|
|
2282
2216
|
LSTMs are a type of recurrent neural network (RNN) capable of learning long-range dependencies.
|
|
2283
2217
|
This constructor uses `Layer.lstm` to create the core LSTM blocks.
|
|
2284
2218
|
|
|
2285
|
-
Parameters:
|
|
2286
|
-
- `` - - A sequence of arguments defining the network structure:
|
|
2287
|
-
- Numbers represent the size (number of units) of each layer: input layer size, hidden LSTM layer sizes..., output layer size.
|
|
2288
|
-
- An optional configuration object can be provided as the last argument.
|
|
2289
|
-
- `` - - Configuration options (if passed as the last argument).
|
|
2290
|
-
|
|
2291
2219
|
Returns: The constructed LSTM network.
|
|
2292
2220
|
|
|
2293
2221
|
#### mask
|
|
@@ -2300,7 +2228,7 @@ AMSGrad: Maximum of past second moment (was opt_vhat).
|
|
|
2300
2228
|
|
|
2301
2229
|
#### memory
|
|
2302
2230
|
|
|
2303
|
-
`(size: number, memory: number) => import("
|
|
2231
|
+
`(size: number, memory: number) => import("src/architecture/layer").default`
|
|
2304
2232
|
|
|
2305
2233
|
Creates a Memory layer, designed to hold state over a fixed number of time steps.
|
|
2306
2234
|
|
|
@@ -2325,7 +2253,7 @@ Slightly increases the chance of ADD_CONN mutation for more connectivity.
|
|
|
2325
2253
|
|
|
2326
2254
|
#### mutate
|
|
2327
2255
|
|
|
2328
|
-
`(method: import("
|
|
2256
|
+
`(method: import("src/architecture/network/network.types").MutationMethod) => void`
|
|
2329
2257
|
|
|
2330
2258
|
Mutates the network's structure or parameters according to the specified method.
|
|
2331
2259
|
This is a core operation for neuro-evolutionary algorithms (like NEAT).
|
|
@@ -2349,20 +2277,13 @@ Parameters:
|
|
|
2349
2277
|
|
|
2350
2278
|
#### narx
|
|
2351
2279
|
|
|
2352
|
-
`(inputSize: number, hiddenLayers: number | number[], outputSize: number, previousInput: number, previousOutput: number) => import("
|
|
2280
|
+
`(inputSize: number, hiddenLayers: number | number[], outputSize: number, previousInput: number, previousOutput: number) => import("src/architecture/network").default`
|
|
2353
2281
|
|
|
2354
2282
|
Creates a Nonlinear AutoRegressive network with eXogenous inputs (NARX).
|
|
2355
2283
|
NARX networks are recurrent networks often used for time series prediction.
|
|
2356
2284
|
They predict the next value of a time series based on previous values of the series
|
|
2357
2285
|
and previous values of external (exogenous) input series.
|
|
2358
2286
|
|
|
2359
|
-
Parameters:
|
|
2360
|
-
- `` - - The number of input nodes for the exogenous inputs at each time step.
|
|
2361
|
-
- `` - - 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.
|
|
2362
|
-
- `` - - The number of output nodes (predicting the time series).
|
|
2363
|
-
- `` - - The number of past time steps of the exogenous input to feed back into the network.
|
|
2364
|
-
- `` - - The number of past time steps of the network's own output to feed back into the network (autoregressive part).
|
|
2365
|
-
|
|
2366
2287
|
Returns: The constructed NARX network.
|
|
2367
2288
|
|
|
2368
2289
|
#### nodes
|
|
@@ -2377,10 +2298,6 @@ Activates the network without calculating eligibility traces.
|
|
|
2377
2298
|
This is a performance optimization for scenarios where backpropagation is not needed,
|
|
2378
2299
|
such as during testing, evaluation, or deployment (inference).
|
|
2379
2300
|
|
|
2380
|
-
Parameters:
|
|
2381
|
-
- `` - - An array of numerical values corresponding to the network's input nodes.
|
|
2382
|
-
The length must match the network's `input` size.
|
|
2383
|
-
|
|
2384
2301
|
Returns: An array of numerical values representing the activations of the network's output nodes.
|
|
2385
2302
|
|
|
2386
2303
|
#### noTraceActivate
|
|
@@ -2406,15 +2323,12 @@ Output node count.
|
|
|
2406
2323
|
|
|
2407
2324
|
#### perceptron
|
|
2408
2325
|
|
|
2409
|
-
`(layers: number[]) => import("
|
|
2326
|
+
`(layers: number[]) => import("src/architecture/network").default`
|
|
2410
2327
|
|
|
2411
2328
|
Creates a standard Multi-Layer Perceptron (MLP) network.
|
|
2412
2329
|
An MLP consists of an input layer, one or more hidden layers, and an output layer,
|
|
2413
2330
|
fully connected layer by layer.
|
|
2414
2331
|
|
|
2415
|
-
Parameters:
|
|
2416
|
-
- `` - - 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.
|
|
2417
|
-
|
|
2418
2332
|
Returns: The constructed MLP network.
|
|
2419
2333
|
|
|
2420
2334
|
#### plastic
|
|
@@ -2444,15 +2358,6 @@ learning rate, momentum, and optional L2 regularization.
|
|
|
2444
2358
|
|
|
2445
2359
|
The process starts from the output nodes and moves backward layer by layer (or topologically for recurrent nets).
|
|
2446
2360
|
|
|
2447
|
-
Parameters:
|
|
2448
|
-
- `` - - The learning rate (controls the step size of weight adjustments).
|
|
2449
|
-
- `` - - The momentum factor (helps overcome local minima and speeds up convergence). Typically between 0 and 1.
|
|
2450
|
-
- `` - - If true, apply the calculated weight and bias updates. If false, only calculate gradients (e.g., for batch accumulation).
|
|
2451
|
-
- `` - - An array of target values corresponding to the network's output nodes.
|
|
2452
|
-
The length must match the network's `output` size.
|
|
2453
|
-
- `` - - The L2 regularization factor (lambda). Helps prevent overfitting by penalizing large weights.
|
|
2454
|
-
- `` - - Optional derivative of the cost function for output nodes.
|
|
2455
|
-
|
|
2456
2361
|
#### propagate
|
|
2457
2362
|
|
|
2458
2363
|
`(rate: number, momentum: number, update: boolean, regularization: number | { type: "L1" | "L2"; lambda: number; } | ((weight: number) => number), target: number | undefined) => void`
|
|
@@ -2494,7 +2399,6 @@ Parameters:
|
|
|
2494
2399
|
- `rate` - - The learning rate, controlling the step size of weight adjustments.
|
|
2495
2400
|
- `momentum` - - The momentum factor, used to smooth weight updates and escape local minima.
|
|
2496
2401
|
- `target` - - An optional array of target values (expected outputs) for the layer's nodes. The length must match the number of nodes.
|
|
2497
|
-
- `` - - The learning rate to apply during weight updates.
|
|
2498
2402
|
|
|
2499
2403
|
#### pruneToSparsity
|
|
2500
2404
|
|
|
@@ -2509,7 +2413,7 @@ Parameters:
|
|
|
2509
2413
|
|
|
2510
2414
|
#### random
|
|
2511
2415
|
|
|
2512
|
-
`(input: number, hidden: number, output: number, options: { connections?: number | undefined; backconnections?: number | undefined; selfconnections?: number | undefined; gates?: number | undefined; }) => import("
|
|
2416
|
+
`(input: number, hidden: number, output: number, options: { connections?: number | undefined; backconnections?: number | undefined; selfconnections?: number | undefined; gates?: number | undefined; }) => import("src/architecture/network").default`
|
|
2513
2417
|
|
|
2514
2418
|
Creates a randomly structured network based on specified node counts and connection options.
|
|
2515
2419
|
|
|
@@ -2518,25 +2422,16 @@ It initializes a network with input and output nodes and then iteratively adds h
|
|
|
2518
2422
|
and various types of connections (forward, backward, self) and gates using mutation methods.
|
|
2519
2423
|
This approach is inspired by neuro-evolution techniques where network topology evolves.
|
|
2520
2424
|
|
|
2521
|
-
Parameters:
|
|
2522
|
-
- `` - - The number of input nodes.
|
|
2523
|
-
- `` - - The number of hidden nodes to add.
|
|
2524
|
-
- `` - - The number of output nodes.
|
|
2525
|
-
- `` - - Optional configuration for the network structure.
|
|
2526
|
-
|
|
2527
2425
|
Returns: The constructed network with a randomized topology.
|
|
2528
2426
|
|
|
2529
2427
|
#### rebuildConnections
|
|
2530
2428
|
|
|
2531
|
-
`(net: import("
|
|
2429
|
+
`(net: import("src/architecture/network").default) => void`
|
|
2532
2430
|
|
|
2533
2431
|
Rebuilds the network's connections array from all per-node connections.
|
|
2534
2432
|
This ensures that the network.connections array is consistent with the actual
|
|
2535
2433
|
outgoing connections of all nodes. Useful after manual wiring or node manipulation.
|
|
2536
2434
|
|
|
2537
|
-
Parameters:
|
|
2538
|
-
- `` - - The network instance to rebuild connections for.
|
|
2539
|
-
|
|
2540
2435
|
Returns: Example usage:
|
|
2541
2436
|
Network.rebuildConnections(net);
|
|
2542
2437
|
|
|
@@ -2559,7 +2454,7 @@ Register a custom objective for multi-objective optimization.
|
|
|
2559
2454
|
|
|
2560
2455
|
#### release
|
|
2561
2456
|
|
|
2562
|
-
`(conn: import("
|
|
2457
|
+
`(conn: import("src/architecture/connection").default) => void`
|
|
2563
2458
|
|
|
2564
2459
|
Return a `Connection` to the internal pool for later reuse. Do NOT use the instance again
|
|
2565
2460
|
afterward unless re-acquired (treat as surrendered). Optimizer / trace fields are not
|
|
@@ -2570,7 +2465,7 @@ Parameters:
|
|
|
2570
2465
|
|
|
2571
2466
|
#### remove
|
|
2572
2467
|
|
|
2573
|
-
`(node: import("
|
|
2468
|
+
`(node: import("src/architecture/node").default) => void`
|
|
2574
2469
|
|
|
2575
2470
|
Removes a node from the network.
|
|
2576
2471
|
This involves:
|
|
@@ -2582,9 +2477,6 @@ This involves:
|
|
|
2582
2477
|
5. Handling gates involving the removed node (ungating connections gated *by* this node,
|
|
2583
2478
|
and potentially re-gating connections that were gated *by other nodes* onto the removed node's connections).
|
|
2584
2479
|
|
|
2585
|
-
Parameters:
|
|
2586
|
-
- `` - - The node instance to remove. Must exist within the network's `nodes` list.
|
|
2587
|
-
|
|
2588
2480
|
#### resetDropoutMasks
|
|
2589
2481
|
|
|
2590
2482
|
`() => void`
|
|
@@ -2652,7 +2544,7 @@ Secondary momentum (Lion variant) (was opt_m2).
|
|
|
2652
2544
|
|
|
2653
2545
|
#### selectMutationMethod
|
|
2654
2546
|
|
|
2655
|
-
`(genome: import("
|
|
2547
|
+
`(genome: import("src/architecture/network").default, rawReturnForTest: boolean) => any`
|
|
2656
2548
|
|
|
2657
2549
|
Selects a mutation method for a given genome based on constraints.
|
|
2658
2550
|
|
|
@@ -2662,7 +2554,7 @@ Self-connection list.
|
|
|
2662
2554
|
|
|
2663
2555
|
#### serialize
|
|
2664
2556
|
|
|
2665
|
-
`() => [number[], number[], string[], import("
|
|
2557
|
+
`() => [number[], number[], string[], import("src/architecture/network/network.types").SerializedConnection[], number, number]`
|
|
2666
2558
|
|
|
2667
2559
|
Lightweight tuple serializer delegating to network.serialize.ts
|
|
2668
2560
|
|
|
@@ -2673,9 +2565,6 @@ Lightweight tuple serializer delegating to network.serialize.ts
|
|
|
2673
2565
|
Sets specified properties (e.g., bias, squash function) for all nodes in the network.
|
|
2674
2566
|
Useful for initializing or resetting node properties uniformly.
|
|
2675
2567
|
|
|
2676
|
-
Parameters:
|
|
2677
|
-
- `` - - An object containing the properties and values to set.
|
|
2678
|
-
|
|
2679
2568
|
#### set
|
|
2680
2569
|
|
|
2681
2570
|
`(values: { bias?: number | undefined; squash?: ((x: number, derivate?: boolean | undefined) => number) | undefined; type?: string | undefined; }) => void`
|
|
@@ -2689,10 +2578,6 @@ the configuration is applied recursively to the nodes within that group.
|
|
|
2689
2578
|
Parameters:
|
|
2690
2579
|
- `values` - - An object containing the properties and their values to set.
|
|
2691
2580
|
Example: `{ bias: 0.5, squash: methods.Activation.ReLU }`
|
|
2692
|
-
- `` - - An object containing the properties and their new values. Only provided properties are updated.
|
|
2693
|
-
`bias`: Sets the bias term for all nodes.
|
|
2694
|
-
`squash`: Sets the activation function (squashing function) for all nodes.
|
|
2695
|
-
`type`: Sets the node type (e.g., 'input', 'hidden', 'output') for all nodes.
|
|
2696
2581
|
|
|
2697
2582
|
#### setActivation
|
|
2698
2583
|
|
|
@@ -2768,7 +2653,7 @@ Parameters:
|
|
|
2768
2653
|
|
|
2769
2654
|
#### snapshotRNG
|
|
2770
2655
|
|
|
2771
|
-
`() => import("
|
|
2656
|
+
`() => import("src/architecture/network/network.types").RNGSnapshot`
|
|
2772
2657
|
|
|
2773
2658
|
Snapshot deterministic RNG runtime state.
|
|
2774
2659
|
|
|
@@ -2789,7 +2674,7 @@ Sorts the population in descending order of fitness scores.
|
|
|
2789
2674
|
|
|
2790
2675
|
#### spawnFromParent
|
|
2791
2676
|
|
|
2792
|
-
`(parent: import("
|
|
2677
|
+
`(parent: import("src/architecture/network").default, mutateCount: number) => import("src/architecture/network").default`
|
|
2793
2678
|
|
|
2794
2679
|
Spawn a new genome derived from a single parent while preserving Neat bookkeeping.
|
|
2795
2680
|
|
|
@@ -2819,10 +2704,6 @@ Calculates the average error over the dataset using a specified cost function.
|
|
|
2819
2704
|
Uses `noTraceActivate` for efficiency as gradients are not needed.
|
|
2820
2705
|
Handles dropout scaling if dropout was used during training.
|
|
2821
2706
|
|
|
2822
|
-
Parameters:
|
|
2823
|
-
- `` - - The test dataset, an array of objects with `input` and `output` arrays.
|
|
2824
|
-
- `` - - The cost function to evaluate the error. Defaults to Mean Squared Error.
|
|
2825
|
-
|
|
2826
2707
|
Returns: An object containing the calculated average error over the dataset and the time taken for the test in milliseconds.
|
|
2827
2708
|
|
|
2828
2709
|
#### testForceOverflow
|
|
@@ -2881,7 +2762,7 @@ Returns: Object with node indices, weight, gain, gater index (if any), innovatio
|
|
|
2881
2762
|
|
|
2882
2763
|
#### toONNX
|
|
2883
2764
|
|
|
2884
|
-
`() => import("
|
|
2765
|
+
`() => import("src/architecture/network/onnx/network.onnx.utils.types").OnnxModel`
|
|
2885
2766
|
|
|
2886
2767
|
Exports the network to ONNX format (JSON object, minimal MLP support).
|
|
2887
2768
|
Only standard feedforward architectures and standard activations are supported.
|
|
@@ -2908,18 +2789,15 @@ Determines behavior (e.g., input nodes don't have biases modified typically, out
|
|
|
2908
2789
|
|
|
2909
2790
|
#### ungate
|
|
2910
2791
|
|
|
2911
|
-
`(connection: import("
|
|
2792
|
+
`(connection: import("src/architecture/connection").default) => void`
|
|
2912
2793
|
|
|
2913
2794
|
Removes the gate from a specified connection.
|
|
2914
2795
|
The connection will no longer be modulated by its gater node.
|
|
2915
2796
|
Removes the connection from the network's `gates` list.
|
|
2916
2797
|
|
|
2917
|
-
Parameters:
|
|
2918
|
-
- `` - - The connection object to ungate.
|
|
2919
|
-
|
|
2920
2798
|
#### ungate
|
|
2921
2799
|
|
|
2922
|
-
`(connections: import("
|
|
2800
|
+
`(connections: import("src/architecture/connection").default | import("src/architecture/connection").default[]) => void`
|
|
2923
2801
|
|
|
2924
2802
|
Removes this node's gating control over the specified connection(s).
|
|
2925
2803
|
Resets the connection's gain to 1 and removes it from the `connections.gated` list.
|