@reicek/neataptic-ts 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (272) hide show
  1. package/.github/ISSUE_TEMPLATE/bug_report.md +33 -0
  2. package/.github/ISSUE_TEMPLATE/feature_request.md +27 -0
  3. package/.github/PULL_REQUEST_TEMPLATE.md +28 -0
  4. package/.github/workflows/ci.yml +41 -0
  5. package/.github/workflows/deploy-pages.yml +29 -0
  6. package/.github/workflows/manual_release_pipeline.yml +62 -0
  7. package/.github/workflows/publish.yml +85 -0
  8. package/.github/workflows/release_dispatch.yml +38 -0
  9. package/.travis.yml +5 -0
  10. package/CONTRIBUTING.md +92 -0
  11. package/LICENSE +24 -0
  12. package/ONNX_EXPORT.md +87 -0
  13. package/README.md +1173 -0
  14. package/RELEASE.md +54 -0
  15. package/dist-docs/package.json +1 -0
  16. package/dist-docs/scripts/generate-docs.d.ts +2 -0
  17. package/dist-docs/scripts/generate-docs.d.ts.map +1 -0
  18. package/dist-docs/scripts/generate-docs.js +536 -0
  19. package/dist-docs/scripts/generate-docs.js.map +1 -0
  20. package/dist-docs/scripts/render-docs-html.d.ts +2 -0
  21. package/dist-docs/scripts/render-docs-html.d.ts.map +1 -0
  22. package/dist-docs/scripts/render-docs-html.js +148 -0
  23. package/dist-docs/scripts/render-docs-html.js.map +1 -0
  24. package/docs/FOLDERS.md +14 -0
  25. package/docs/README.md +1173 -0
  26. package/docs/architecture/README.md +1391 -0
  27. package/docs/architecture/index.html +938 -0
  28. package/docs/architecture/network/README.md +1210 -0
  29. package/docs/architecture/network/index.html +908 -0
  30. package/docs/assets/ascii-maze.bundle.js +16542 -0
  31. package/docs/assets/ascii-maze.bundle.js.map +7 -0
  32. package/docs/index.html +1419 -0
  33. package/docs/methods/README.md +670 -0
  34. package/docs/methods/index.html +477 -0
  35. package/docs/multithreading/README.md +274 -0
  36. package/docs/multithreading/index.html +215 -0
  37. package/docs/multithreading/workers/README.md +23 -0
  38. package/docs/multithreading/workers/browser/README.md +39 -0
  39. package/docs/multithreading/workers/browser/index.html +70 -0
  40. package/docs/multithreading/workers/index.html +57 -0
  41. package/docs/multithreading/workers/node/README.md +33 -0
  42. package/docs/multithreading/workers/node/index.html +66 -0
  43. package/docs/neat/README.md +1284 -0
  44. package/docs/neat/index.html +906 -0
  45. package/docs/src/README.md +2659 -0
  46. package/docs/src/index.html +1579 -0
  47. package/jest.config.ts +32 -0
  48. package/package.json +99 -0
  49. package/plans/HyperMorphoNEAT.md +293 -0
  50. package/plans/ONNX_EXPORT_PLAN.md +46 -0
  51. package/scripts/generate-docs.ts +486 -0
  52. package/scripts/render-docs-html.ts +138 -0
  53. package/scripts/types.d.ts +2 -0
  54. package/src/README.md +2659 -0
  55. package/src/architecture/README.md +1391 -0
  56. package/src/architecture/activationArrayPool.ts +135 -0
  57. package/src/architecture/architect.ts +635 -0
  58. package/src/architecture/connection.ts +148 -0
  59. package/src/architecture/group.ts +406 -0
  60. package/src/architecture/layer.ts +804 -0
  61. package/src/architecture/network/README.md +1210 -0
  62. package/src/architecture/network/network.activate.ts +223 -0
  63. package/src/architecture/network/network.connect.ts +157 -0
  64. package/src/architecture/network/network.deterministic.ts +167 -0
  65. package/src/architecture/network/network.evolve.ts +426 -0
  66. package/src/architecture/network/network.gating.ts +186 -0
  67. package/src/architecture/network/network.genetic.ts +247 -0
  68. package/src/architecture/network/network.mutate.ts +624 -0
  69. package/src/architecture/network/network.onnx.ts +463 -0
  70. package/src/architecture/network/network.prune.ts +216 -0
  71. package/src/architecture/network/network.remove.ts +96 -0
  72. package/src/architecture/network/network.serialize.ts +309 -0
  73. package/src/architecture/network/network.slab.ts +262 -0
  74. package/src/architecture/network/network.standalone.ts +246 -0
  75. package/src/architecture/network/network.stats.ts +59 -0
  76. package/src/architecture/network/network.topology.ts +86 -0
  77. package/src/architecture/network/network.training.ts +1278 -0
  78. package/src/architecture/network.ts +1302 -0
  79. package/src/architecture/node.ts +1288 -0
  80. package/src/architecture/onnx.ts +3 -0
  81. package/src/config.ts +83 -0
  82. package/src/methods/README.md +670 -0
  83. package/src/methods/activation.ts +372 -0
  84. package/src/methods/connection.ts +31 -0
  85. package/src/methods/cost.ts +347 -0
  86. package/src/methods/crossover.ts +63 -0
  87. package/src/methods/gating.ts +43 -0
  88. package/src/methods/methods.ts +8 -0
  89. package/src/methods/mutation.ts +300 -0
  90. package/src/methods/rate.ts +257 -0
  91. package/src/methods/selection.ts +65 -0
  92. package/src/multithreading/README.md +274 -0
  93. package/src/multithreading/multi.ts +339 -0
  94. package/src/multithreading/workers/README.md +23 -0
  95. package/src/multithreading/workers/browser/README.md +39 -0
  96. package/src/multithreading/workers/browser/testworker.ts +99 -0
  97. package/src/multithreading/workers/node/README.md +33 -0
  98. package/src/multithreading/workers/node/testworker.ts +72 -0
  99. package/src/multithreading/workers/node/worker.ts +70 -0
  100. package/src/multithreading/workers/workers.ts +22 -0
  101. package/src/neat/README.md +1284 -0
  102. package/src/neat/neat.adaptive.ts +544 -0
  103. package/src/neat/neat.compat.ts +164 -0
  104. package/src/neat/neat.constants.ts +20 -0
  105. package/src/neat/neat.diversity.ts +217 -0
  106. package/src/neat/neat.evaluate.ts +328 -0
  107. package/src/neat/neat.evolve.ts +1026 -0
  108. package/src/neat/neat.export.ts +249 -0
  109. package/src/neat/neat.helpers.ts +235 -0
  110. package/src/neat/neat.lineage.ts +220 -0
  111. package/src/neat/neat.multiobjective.ts +260 -0
  112. package/src/neat/neat.mutation.ts +718 -0
  113. package/src/neat/neat.objectives.ts +157 -0
  114. package/src/neat/neat.pruning.ts +190 -0
  115. package/src/neat/neat.selection.ts +269 -0
  116. package/src/neat/neat.speciation.ts +460 -0
  117. package/src/neat/neat.species.ts +151 -0
  118. package/src/neat/neat.telemetry.exports.ts +469 -0
  119. package/src/neat/neat.telemetry.ts +933 -0
  120. package/src/neat/neat.types.ts +275 -0
  121. package/src/neat.ts +1042 -0
  122. package/src/neataptic.ts +10 -0
  123. package/test/architecture/activationArrayPool.capacity.test.ts +19 -0
  124. package/test/architecture/activationArrayPool.test.ts +46 -0
  125. package/test/architecture/connection.test.ts +290 -0
  126. package/test/architecture/group.test.ts +950 -0
  127. package/test/architecture/layer.test.ts +1535 -0
  128. package/test/architecture/network.pruning.test.ts +65 -0
  129. package/test/architecture/node.test.ts +1602 -0
  130. package/test/examples/asciiMaze/asciiMaze.e2e.test.ts +499 -0
  131. package/test/examples/asciiMaze/asciiMaze.ts +41 -0
  132. package/test/examples/asciiMaze/browser-entry.ts +164 -0
  133. package/test/examples/asciiMaze/browserLogger.ts +221 -0
  134. package/test/examples/asciiMaze/browserTerminalUtility.ts +48 -0
  135. package/test/examples/asciiMaze/colors.ts +119 -0
  136. package/test/examples/asciiMaze/dashboardManager.ts +968 -0
  137. package/test/examples/asciiMaze/evolutionEngine.ts +1248 -0
  138. package/test/examples/asciiMaze/fitness.ts +136 -0
  139. package/test/examples/asciiMaze/index.html +128 -0
  140. package/test/examples/asciiMaze/index.ts +26 -0
  141. package/test/examples/asciiMaze/interfaces.ts +235 -0
  142. package/test/examples/asciiMaze/mazeMovement.ts +996 -0
  143. package/test/examples/asciiMaze/mazeUtils.ts +278 -0
  144. package/test/examples/asciiMaze/mazeVision.ts +402 -0
  145. package/test/examples/asciiMaze/mazeVisualization.ts +585 -0
  146. package/test/examples/asciiMaze/mazes.ts +245 -0
  147. package/test/examples/asciiMaze/networkRefinement.ts +76 -0
  148. package/test/examples/asciiMaze/networkVisualization.ts +901 -0
  149. package/test/examples/asciiMaze/terminalUtility.ts +73 -0
  150. package/test/methods/activation.test.ts +1142 -0
  151. package/test/methods/connection.test.ts +146 -0
  152. package/test/methods/cost.test.ts +1123 -0
  153. package/test/methods/crossover.test.ts +202 -0
  154. package/test/methods/gating.test.ts +144 -0
  155. package/test/methods/mutation.test.ts +451 -0
  156. package/test/methods/optimizers.advanced.test.ts +80 -0
  157. package/test/methods/optimizers.behavior.test.ts +105 -0
  158. package/test/methods/optimizers.formula.test.ts +89 -0
  159. package/test/methods/rate.cosineWarmRestarts.test.ts +44 -0
  160. package/test/methods/rate.linearWarmupDecay.test.ts +41 -0
  161. package/test/methods/rate.reduceOnPlateau.test.ts +45 -0
  162. package/test/methods/rate.test.ts +684 -0
  163. package/test/methods/selection.test.ts +245 -0
  164. package/test/multithreading/activations.functions.test.ts +54 -0
  165. package/test/multithreading/multi.test.ts +290 -0
  166. package/test/multithreading/worker.node.process.test.ts +39 -0
  167. package/test/multithreading/workers.coverage.test.ts +36 -0
  168. package/test/multithreading/workers.dynamic.import.test.ts +8 -0
  169. package/test/neat/neat.adaptive.complexityBudget.test.ts +34 -0
  170. package/test/neat/neat.adaptive.criterion.complexity.test.ts +50 -0
  171. package/test/neat/neat.adaptive.mutation.strategy.test.ts +37 -0
  172. package/test/neat/neat.adaptive.operator.decay.test.ts +31 -0
  173. package/test/neat/neat.adaptive.phasedComplexity.test.ts +25 -0
  174. package/test/neat/neat.adaptive.pruning.test.ts +25 -0
  175. package/test/neat/neat.adaptive.targetSpecies.test.ts +43 -0
  176. package/test/neat/neat.additional.coverage.test.ts +126 -0
  177. package/test/neat/neat.advanced.enhancements.test.ts +85 -0
  178. package/test/neat/neat.advanced.test.ts +589 -0
  179. package/test/neat/neat.diversity.autocompat.test.ts +47 -0
  180. package/test/neat/neat.diversity.metrics.test.ts +21 -0
  181. package/test/neat/neat.diversity.stats.test.ts +44 -0
  182. package/test/neat/neat.enhancements.test.ts +79 -0
  183. package/test/neat/neat.entropy.ancestorAdaptive.test.ts +133 -0
  184. package/test/neat/neat.entropy.compat.csv.test.ts +108 -0
  185. package/test/neat/neat.evolution.pruning.test.ts +39 -0
  186. package/test/neat/neat.fastmode.autotune.test.ts +42 -0
  187. package/test/neat/neat.innovation.test.ts +134 -0
  188. package/test/neat/neat.lineage.antibreeding.test.ts +35 -0
  189. package/test/neat/neat.lineage.entropy.test.ts +56 -0
  190. package/test/neat/neat.lineage.inbreeding.test.ts +49 -0
  191. package/test/neat/neat.lineage.pressure.test.ts +29 -0
  192. package/test/neat/neat.multiobjective.adaptive.test.ts +57 -0
  193. package/test/neat/neat.multiobjective.dynamic.schedule.test.ts +46 -0
  194. package/test/neat/neat.multiobjective.dynamic.test.ts +31 -0
  195. package/test/neat/neat.multiobjective.fastsort.delegation.test.ts +51 -0
  196. package/test/neat/neat.multiobjective.prune.test.ts +39 -0
  197. package/test/neat/neat.multiobjective.test.ts +21 -0
  198. package/test/neat/neat.mutation.undefined.pool.test.ts +24 -0
  199. package/test/neat/neat.objective.events.test.ts +26 -0
  200. package/test/neat/neat.objective.importance.test.ts +21 -0
  201. package/test/neat/neat.objective.lifetimes.test.ts +33 -0
  202. package/test/neat/neat.offspring.allocation.test.ts +22 -0
  203. package/test/neat/neat.operator.bandit.test.ts +17 -0
  204. package/test/neat/neat.operator.phases.test.ts +38 -0
  205. package/test/neat/neat.pruneInactive.behavior.test.ts +54 -0
  206. package/test/neat/neat.reenable.adaptation.test.ts +18 -0
  207. package/test/neat/neat.rng.state.test.ts +22 -0
  208. package/test/neat/neat.spawn.add.test.ts +123 -0
  209. package/test/neat/neat.speciation.test.ts +96 -0
  210. package/test/neat/neat.species.allocation.telemetry.test.ts +26 -0
  211. package/test/neat/neat.species.history.csv.test.ts +24 -0
  212. package/test/neat/neat.telemetry.advanced.test.ts +226 -0
  213. package/test/neat/neat.telemetry.csv.lineage.test.ts +19 -0
  214. package/test/neat/neat.telemetry.parity.test.ts +42 -0
  215. package/test/neat/neat.telemetry.stream.test.ts +19 -0
  216. package/test/neat/neat.telemetry.test.ts +16 -0
  217. package/test/neat/neat.test.ts +422 -0
  218. package/test/neat/neat.utilities.test.ts +44 -0
  219. package/test/network/__suppress_console.ts +9 -0
  220. package/test/network/acyclic.topoorder.test.ts +17 -0
  221. package/test/network/checkpoint.metricshook.test.ts +36 -0
  222. package/test/network/error.handling.test.ts +581 -0
  223. package/test/network/evolution.test.ts +285 -0
  224. package/test/network/genetic.test.ts +208 -0
  225. package/test/network/learning.capability.test.ts +244 -0
  226. package/test/network/mutation.effects.test.ts +492 -0
  227. package/test/network/network.activate.test.ts +115 -0
  228. package/test/network/network.activateBatch.test.ts +30 -0
  229. package/test/network/network.deterministic.test.ts +64 -0
  230. package/test/network/network.evolve.branches.test.ts +75 -0
  231. package/test/network/network.evolve.multithread.branches.test.ts +83 -0
  232. package/test/network/network.evolve.test.ts +100 -0
  233. package/test/network/network.gating.removal.test.ts +93 -0
  234. package/test/network/network.mutate.additional.test.ts +145 -0
  235. package/test/network/network.mutate.edgecases.test.ts +101 -0
  236. package/test/network/network.mutate.test.ts +101 -0
  237. package/test/network/network.prune.earlyexit.test.ts +38 -0
  238. package/test/network/network.remove.errors.test.ts +45 -0
  239. package/test/network/network.slab.fallbacks.test.ts +22 -0
  240. package/test/network/network.stats.test.ts +45 -0
  241. package/test/network/network.training.advanced.test.ts +149 -0
  242. package/test/network/network.training.basic.test.ts +228 -0
  243. package/test/network/network.training.helpers.test.ts +183 -0
  244. package/test/network/onnx.export.test.ts +310 -0
  245. package/test/network/onnx.import.test.ts +129 -0
  246. package/test/network/pruning.topology.test.ts +282 -0
  247. package/test/network/regularization.determinism.test.ts +83 -0
  248. package/test/network/regularization.dropconnect.test.ts +17 -0
  249. package/test/network/regularization.dropconnect.validation.test.ts +18 -0
  250. package/test/network/regularization.stochasticdepth.test.ts +27 -0
  251. package/test/network/regularization.test.ts +843 -0
  252. package/test/network/regularization.weightnoise.test.ts +30 -0
  253. package/test/network/setupTests.ts +2 -0
  254. package/test/network/standalone.test.ts +332 -0
  255. package/test/network/structure.serialization.test.ts +660 -0
  256. package/test/training/training.determinism.mixed-precision.test.ts +134 -0
  257. package/test/training/training.earlystopping.test.ts +91 -0
  258. package/test/training/training.edge-cases.test.ts +91 -0
  259. package/test/training/training.extensions.test.ts +47 -0
  260. package/test/training/training.gradient.features.test.ts +110 -0
  261. package/test/training/training.gradient.refinements.test.ts +170 -0
  262. package/test/training/training.gradient.separate-bias.test.ts +41 -0
  263. package/test/training/training.optimizer.test.ts +48 -0
  264. package/test/training/training.plateau.smoothing.test.ts +58 -0
  265. package/test/training/training.smoothing.types.test.ts +174 -0
  266. package/test/training/training.train.options.coverage.test.ts +52 -0
  267. package/test/utils/console-helper.ts +76 -0
  268. package/test/utils/jest-setup.ts +60 -0
  269. package/test/utils/test-helpers.ts +175 -0
  270. package/tsconfig.docs.json +12 -0
  271. package/tsconfig.json +21 -0
  272. package/webpack.config.js +49 -0
@@ -0,0 +1,33 @@
1
+ ---
2
+ name: Bug report
3
+ about: Create a bug report to help us improve NeatapticTS
4
+ title: ''
5
+ labels: bug
6
+ assignees: ''
7
+ ---
8
+
9
+ **Describe the bug**
10
+ A clear and concise description of what the bug is.
11
+
12
+ **To Reproduce**
13
+ Steps to reproduce the behavior:
14
+ 1. Go to '...'
15
+ 2. Run '...'
16
+ 3. See error
17
+
18
+ **Expected behavior**
19
+ What you expected to happen.
20
+
21
+ **Minimal repro (code)**
22
+ Please include a small snippet or a link to a minimal repo/example that reproduces the issue.
23
+
24
+ **Environment (please complete the following information):**
25
+ - OS: (e.g. Windows 10 / macOS / Linux)
26
+ - Node version: (e.g. v16.20.0)
27
+ - NeatapticTS commit / tag:
28
+
29
+ **Logs / stack traces**
30
+ If applicable, add logs or stack traces to help diagnosis.
31
+
32
+ **Additional context**
33
+ Add any other context about the problem here.
@@ -0,0 +1,27 @@
1
+ ---
2
+ name: Feature request
3
+ about: Suggest an idea for this project
4
+ title: ''
5
+ labels: enhancement
6
+ assignees: ''
7
+ ---
8
+
9
+ **Is your feature request related to a problem? Please describe.**
10
+ A clear and concise description of the problem the feature would solve.
11
+
12
+ **Describe the solution you'd like**
13
+ A clear and concise description of what you want to happen.
14
+
15
+ **Example usage**
16
+ Provide a short code snippet or example of how the new API/feature would be used.
17
+
18
+ **Alternatives considered**
19
+ Describe alternatives you've considered and why they are insufficient.
20
+
21
+ **Acceptance criteria**
22
+ - [ ] Clear behavior described
23
+ - [ ] Backwards-compatibility considerations noted
24
+ - [ ] Tests or examples to demonstrate the new feature
25
+
26
+ **Additional context**
27
+ Add any other context or screenshots about the feature request here.
@@ -0,0 +1,28 @@
1
+ <!-- Brief title: keep under 60 chars -->
2
+
3
+ ## Summary
4
+ <!-- One-line summary of the change -->
5
+
6
+ ## Related issue
7
+ <!-- Link to the issue number this PR addresses, if any -->
8
+
9
+ ## What I changed
10
+ -
11
+ -
12
+
13
+ ## Why this is needed
14
+ <!-- Short motivation / user-visible impact -->
15
+
16
+ ## Checklist
17
+ - [ ] I have read the CONTRIBUTING guide
18
+ - [ ] The change is covered by tests (new or updated) and `npm test` passes
19
+ - [ ] I regenerated docs where applicable (`npm run docs`) and committed generated README changes if API/JSDoc changed
20
+ - [ ] Relevant files were linted / typechecked
21
+ - [ ] I added/update examples if applicable
22
+
23
+ ## Testing notes
24
+ <!-- How to reproduce / run the tests for this change -->
25
+
26
+ ## Screenshots (optional)
27
+
28
+ <!-- Add short notes for reviewers, and any breaking changes -->
@@ -0,0 +1,41 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ branches: [ main, refactor ]
6
+ pull_request:
7
+ branches: [ main, refactor ]
8
+
9
+ jobs:
10
+ build-test:
11
+ runs-on: ubuntu-latest
12
+ env:
13
+ QLTY_COVERAGE_TOKEN: ${{ secrets.QLTY_COVERAGE_TOKEN }}
14
+
15
+ steps:
16
+ - uses: actions/checkout@v4
17
+ - name: Use Node.js
18
+ uses: actions/setup-node@v4
19
+ with:
20
+ node-version: '18'
21
+ - name: Install dependencies
22
+ run: npm ci
23
+ - name: Run tests
24
+ run: npm test
25
+ - name: Check for coverage file
26
+ id: cov
27
+ run: |
28
+ if [ -f coverage/lcov.info ]; then
29
+ echo "found=true" >> $GITHUB_OUTPUT
30
+ else
31
+ echo "found=false" >> $GITHUB_OUTPUT
32
+ fi
33
+
34
+ - name: Upload coverage to Qlty
35
+ if: ${{ steps.cov.outputs.found == 'true' && env.QLTY_COVERAGE_TOKEN != '' }}
36
+ uses: qltysh/qlty-action/coverage@v2
37
+ with:
38
+ token: ${{ env.QLTY_COVERAGE_TOKEN }}
39
+ files: coverage/lcov.info
40
+ - name: Build
41
+ run: npm run build
@@ -0,0 +1,29 @@
1
+ name: Deploy docs to GitHub Pages
2
+
3
+ on:
4
+ release:
5
+ types: [published]
6
+
7
+ jobs:
8
+ build-and-deploy:
9
+ runs-on: ubuntu-latest
10
+ steps:
11
+ - uses: actions/checkout@v4
12
+
13
+ - name: Use Node.js
14
+ uses: actions/setup-node@v4
15
+ with:
16
+ node-version: '18'
17
+
18
+ - name: Install dependencies
19
+ run: npm ci
20
+
21
+ - name: Build docs
22
+ run: npm run docs
23
+
24
+ - name: Deploy to GitHub Pages
25
+ uses: peaceiris/actions-gh-pages@v4
26
+ with:
27
+ github_token: ${{ secrets.GITHUB_TOKEN }}
28
+ publish_dir: ./docs
29
+ publish_branch: gh-pages
@@ -0,0 +1,62 @@
1
+ name: Manual release pipeline
2
+
3
+ on:
4
+ workflow_dispatch:
5
+ inputs:
6
+ level:
7
+ description: 'Version bump level (patch, minor, major)'
8
+ required: true
9
+ default: 'patch'
10
+ branch:
11
+ description: 'Branch to release from'
12
+ required: true
13
+ default: 'release'
14
+
15
+ jobs:
16
+ release:
17
+ runs-on: ubuntu-latest
18
+ permissions:
19
+ contents: write
20
+ packages: write
21
+ actions: write
22
+ env:
23
+ NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
24
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
25
+
26
+ steps:
27
+ - name: Checkout
28
+ uses: actions/checkout@v4
29
+ with:
30
+ ref: ${{ github.event.inputs.branch }}
31
+ fetch-depth: 0
32
+
33
+ - name: Setup Node
34
+ uses: actions/setup-node@v4
35
+ with:
36
+ node-version: '18'
37
+
38
+ - name: Install dependencies
39
+ run: npm ci
40
+
41
+ - name: Configure git
42
+ run: |
43
+ git config user.name "github-actions[bot]"
44
+ git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
45
+
46
+ - name: Bump version, create tag and push
47
+ run: |
48
+ npm version ${{ github.event.inputs.level }} -m "chore(release): %s [ci skip]"
49
+ git push origin HEAD --follow-tags
50
+ - name: Done
51
+ run: echo "Version bumped and tags pushed. The release workflows will run on tag/release publish."
52
+
53
+ publish:
54
+ needs: release
55
+ uses: ./.github/workflows/publish.yml
56
+ with:
57
+ run_publish: 'true'
58
+ release_tag: ${{ github.ref }}
59
+ secrets:
60
+ QLTY_COVERAGE_TOKEN: ${{ secrets.QLTY_COVERAGE_TOKEN }}
61
+ NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
62
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@@ -0,0 +1,85 @@
1
+ name: Publish packages
2
+
3
+ on:
4
+ release:
5
+ types: [published]
6
+ workflow_dispatch:
7
+ inputs:
8
+ run_publish:
9
+ description: 'Whether to actually publish packages'
10
+ required: false
11
+ default: 'true'
12
+ release_tag:
13
+ description: 'Optional tag to publish (used for metadata only)'
14
+ required: false
15
+ workflow_call:
16
+ inputs:
17
+ run_publish:
18
+ description: 'Whether to actually publish packages'
19
+ required: false
20
+ type: string
21
+ default: 'true'
22
+ release_tag:
23
+ description: 'Optional tag to publish (used for metadata only)'
24
+ required: false
25
+ type: string
26
+
27
+ jobs:
28
+ publish:
29
+ runs-on: ubuntu-latest
30
+ env:
31
+ QLTY_COVERAGE_TOKEN: ${{ secrets.QLTY_COVERAGE_TOKEN }}
32
+ RUN_PUBLISH: ${{ github.event.inputs.run_publish || 'true' }}
33
+ RELEASE_TAG: ${{ github.event.inputs.release_tag || '' }}
34
+ steps:
35
+ - uses: actions/checkout@v4
36
+
37
+ - name: Use Node.js
38
+ uses: actions/setup-node@v4
39
+ with:
40
+ node-version: '18'
41
+ registry-url: 'https://registry.npmjs.org'
42
+
43
+ - name: Install dependencies
44
+ run: npm ci
45
+
46
+ - name: Build
47
+ run: npm run build
48
+
49
+ - name: Publish to npm
50
+ if: ${{ env.RUN_PUBLISH == 'true' }}
51
+ env:
52
+ NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
53
+ run: |
54
+ echo "Publishing to npm..."
55
+ npm publish --access public
56
+
57
+ - name: Publish to GitHub Packages
58
+ uses: actions/setup-node@v4
59
+ with:
60
+ node-version: '18'
61
+ registry-url: 'https://npm.pkg.github.com/'
62
+
63
+ - name: Publish to GitHub Packages (scoped)
64
+ if: ${{ env.RUN_PUBLISH == 'true' }}
65
+ env:
66
+ NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
67
+ run: |
68
+ echo "Publishing to GitHub Packages..."
69
+ npm publish --registry https://npm.pkg.github.com/
70
+
71
+ - name: Check for coverage file
72
+ id: cov
73
+ run: |
74
+ if [ -f coverage/lcov.info ]; then
75
+ echo "found=true" >> $GITHUB_OUTPUT
76
+ else
77
+ echo "found=false" >> $GITHUB_OUTPUT
78
+ fi
79
+
80
+ - name: Upload coverage to Qlty (release)
81
+ if: ${{ steps.cov.outputs.found == 'true' && env.QLTY_COVERAGE_TOKEN != '' }}
82
+ uses: qltysh/qlty-action/coverage@v2
83
+ with:
84
+ token: ${{ env.QLTY_COVERAGE_TOKEN }}
85
+ files: coverage/lcov.info
@@ -0,0 +1,38 @@
1
+ name: Manual release
2
+
3
+ on:
4
+ workflow_dispatch:
5
+ inputs:
6
+ level:
7
+ description: 'Version bump level (patch, minor, major)'
8
+ required: true
9
+ default: 'patch'
10
+
11
+ jobs:
12
+ bump-and-release:
13
+ runs-on: ubuntu-latest
14
+ steps:
15
+ - uses: actions/checkout@v4
16
+ with:
17
+ fetch-depth: 0
18
+
19
+ - name: Setup Node
20
+ uses: actions/setup-node@v4
21
+ with:
22
+ node-version: '18'
23
+
24
+ - name: Install deps
25
+ run: npm ci
26
+
27
+ - name: Bump version and push
28
+ env:
29
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
30
+ run: |
31
+ set -e
32
+ git config user.name "github-actions[bot]"
33
+ git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
34
+ npm version ${{ github.event.inputs.level }} -m "chore(release): %s [ci skip]"
35
+ git push origin --follow-tags
36
+
37
+ - name: Create GitHub Release (done by tag push)
38
+ run: echo "Tag pushed; release workflows will be triggered by the tag/release event."
package/.travis.yml ADDED
@@ -0,0 +1,5 @@
1
+ language: node_js
2
+ script: 'npm run test:src'
3
+ node_js:
4
+ - 'node'
5
+ - '7.6'
@@ -0,0 +1,92 @@
1
+ ## Contributing to NeatapticTS
2
+
3
+ Thank you for helping improve NeatapticTS — this project is educational and community-focused, and contributions that improve clarity, examples, tests, or API ergonomics are especially welcome.
4
+
5
+ ### Quick checklist
6
+ - Fork the repo and open a branch for your work
7
+ - Run `npm install`
8
+ - Make code or docs changes
9
+ - Run tests and `npm run docs` if you changed JSDoc
10
+ - Open a pull request that links an issue (recommended)
11
+
12
+ ---
13
+
14
+ ### Setup (local)
15
+ 1. Fork this repository and clone your fork.
16
+ 2. Install dependencies:
17
+
18
+ ```powershell
19
+ npm install
20
+ ```
21
+
22
+ ---
23
+
24
+ ### Running tests and docs
25
+ - Run unit tests:
26
+
27
+ ```powershell
28
+ npm test
29
+ ```
30
+
31
+ - Generate the documentation and mirrored `src` READMEs (run this if you changed JSDoc comments):
32
+
33
+ ```powershell
34
+ npm run docs
35
+ ```
36
+
37
+ ---
38
+
39
+ ### Code style and quality
40
+ - Keep changes small and focused. Prefer many small PRs over one large PR.
41
+ - Follow TypeScript types and avoid `any` unless necessary; include type updates where relevant.
42
+ - Add or update tests for behavioral changes. Tests live in `test/` and run with `npm test`.
43
+
44
+ ---
45
+
46
+ ### Documentation
47
+ - Update JSDoc comments in the `src/` files when changing public APIs.
48
+ - Run `npm run docs` to regenerate per-folder `README.md` files (these are mirrored into `src/*/README.md` and the `docs/` site).
49
+
50
+ ---
51
+
52
+ ### Reporting bugs
53
+ Open an issue with the following minimal information:
54
+ - Repro steps or a small example
55
+ - Error/log output and Node version (or browser/OS when applicable)
56
+ - The expected vs actual behavior
57
+
58
+ If possible, include a small runnable snippet that reproduces the problem.
59
+
60
+ ---
61
+
62
+ ### Submitting a pull request
63
+ 1. Create a descriptive branch name (e.g. `fix/activation-pool-bug` or `feat/multiobjective-telemetry`).
64
+ 2. Open an issue first for non-trivial changes and note the issue number in your PR.
65
+ 3. Ensure tests pass and run `npm run docs` if you changed JSDoc or public APIs.
66
+ 4. In your PR description include:
67
+ - A short summary of the change
68
+ - The motivation and any user-visible API changes
69
+ - Links to related issues
70
+ - Test and docs status (e.g., `tests: pass`, `docs regenerated`)
71
+
72
+ ---
73
+
74
+ ### Review and CI
75
+ The project runs tests and basic checks on PRs. Address review comments promptly. Small style or linter failures are typically fixed during the PR review.
76
+
77
+ ---
78
+
79
+ ### Attribution & license
80
+ This project is released under the MIT License. Core ideas and portions of code are derived from the original Neataptic (Thomas Wagenaar) and Synaptic (Juan Cazala). See `LICENSE` for details.
81
+
82
+ ---
83
+
84
+ ### Code of conduct
85
+ We follow a community-friendly code of conduct. Be respectful in discussions and PR reviews.
86
+
87
+ ---
88
+
89
+ ### Need help?
90
+ Open an issue describing what you'd like to change and we can advise on implementation approach and scope.
91
+
92
+ Thank you for contributing!
package/LICENSE ADDED
@@ -0,0 +1,24 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2024 Cesar Anton <reicek@gmail.com>
4
+ Copyright (c) 2017 Thomas Wagenaar <wagenaartje@protonmail.com>
5
+ Copyright (c) 2017 Juan Cazala (parts used from Synaptic)
6
+
7
+
8
+ Permission is hereby granted, free of charge, to any person obtaining a copy
9
+ of this software and associated documentation files (the "Software"), to deal
10
+ in the Software without restriction, including without limitation the rights
11
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12
+ copies of the Software, and to permit persons to whom the Software is
13
+ furnished to do so, subject to the following conditions:
14
+
15
+ The above copyright notice and this permission notice shall be included in
16
+ all copies or substantial portions of the Software.
17
+
18
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24
+ THE SOFTWARE
package/ONNX_EXPORT.md ADDED
@@ -0,0 +1,87 @@
1
+ # ONNX Export in NeatapticTS
2
+
3
+ NeatapticTS supports exporting trained neural networks to the ONNX (Open Neural Network Exchange) format, which enables interoperability with other machine learning frameworks and tools.
4
+
5
+ ## Supported Network Types
6
+
7
+ ONNX export in NeatapticTS supports:
8
+
9
+ - **Strictly Layered, Fully Connected MLPs**:
10
+ - Simple MLPs (input → output)
11
+ - Single hidden layer MLPs (input → hidden → output)
12
+ - Multi-hidden layer MLPs (input → hidden₁ → hidden₂ → ... → output)
13
+
14
+ Each layer must be fully connected to the next layer, with no skip or recurrent connections.
15
+
16
+ ## Supported Activation Functions
17
+
18
+ The following activation functions are mapped to their ONNX equivalents:
19
+
20
+ - `Tanh`
21
+ - `Sigmoid` (or `Logistic`)
22
+ - `ReLU`
23
+ - `Identity` (or any unknown function)
24
+
25
+ Unsupported activation functions will be mapped to `Identity` with a warning.
26
+
27
+ ## Usage Example
28
+
29
+ ```typescript
30
+ import { Architect } from 'neataptic';
31
+
32
+ // Create and train a network
33
+ const network = new Architect.Perceptron(2, 3, 1);
34
+ network.train([
35
+ { input: [0, 0], output: [0] },
36
+ { input: [0, 1], output: [1] },
37
+ { input: [1, 0], output: [1] },
38
+ { input: [1, 1], output: [0] }
39
+ ]);
40
+
41
+ // Export to ONNX format
42
+ const onnxModel = network.toONNX();
43
+
44
+ // Convert to JSON string for saving or transmitting
45
+ const onnxJson = JSON.stringify(onnxModel);
46
+ ```
47
+
48
+ ## Limitations
49
+
50
+ - The export functionality only supports strictly layered, fully connected MLPs.
51
+ - Networks with skip connections, recurrent connections, or non-MLP topologies are not supported.
52
+ - LSTM, GRU, and other advanced architectures are not supported.
53
+ - All nodes in the same layer must use the same activation function (enforced).
54
+
55
+ ## Example Network Structures
56
+
57
+ ### Simple MLP (input → output)
58
+ ```
59
+ Input Layer (2 nodes) → Output Layer (1 node)
60
+ ```
61
+
62
+ ### Single Hidden Layer MLP
63
+ ```
64
+ Input Layer (2 nodes) → Hidden Layer (3 nodes) → Output Layer (1 node)
65
+ ```
66
+
67
+ ### Multi-Hidden Layer MLP
68
+ ```
69
+ Input Layer (2 nodes) → Hidden Layer 1 (4 nodes) → Hidden Layer 2 (3 nodes) → Output Layer (1 node)
70
+ ```
71
+
72
+ ## ONNX Model Structure
73
+
74
+ The exported ONNX model includes:
75
+
76
+ - Input and output tensor definitions with batch dimension
77
+ - Weight and bias initializers for each layer
78
+ - MatMul, Add, and Activation nodes for the computation graph
79
+ - Producer information and ONNX version metadata
80
+
81
+ ## Future Enhancements
82
+
83
+ Future versions may support:
84
+ - Skip connections
85
+ - Recurrent connections
86
+ - Custom activation functions
87
+ - LSTM and GRU cell types