@reicek/neataptic-ts 0.1.5 → 0.1.6
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/ISSUE_TEMPLATE/bug_report.md +2 -0
- package/.github/ISSUE_TEMPLATE/feature_request.md +1 -0
- package/.github/PULL_REQUEST_TEMPLATE.md +8 -2
- package/.github/workflows/ci.yml +21 -21
- package/.github/workflows/manual_release_pipeline.yml +25 -25
- package/.github/workflows/publish.yml +1 -2
- package/.github/workflows/release_dispatch.yml +20 -20
- package/CONTRIBUTING.md +12 -0
- package/ONNX_EXPORT.md +5 -1
- package/README.md +608 -356
- package/RELEASE.md +2 -0
- package/dist-docs/scripts/render-docs-html.js +38 -11
- package/dist-docs/scripts/render-docs-html.js.map +1 -1
- package/docs/README.md +608 -356
- package/docs/architecture/index.html +1 -1
- package/docs/architecture/network/index.html +1 -1
- package/docs/assets/ascii-maze.bundle.js +1 -1
- package/docs/assets/ascii-maze.bundle.js.map +2 -2
- package/docs/examples/asciiMaze/index.html +128 -0
- package/docs/index.html +273 -266
- package/docs/methods/index.html +1 -1
- package/docs/multithreading/index.html +1 -1
- package/docs/multithreading/workers/browser/index.html +1 -1
- package/docs/multithreading/workers/index.html +1 -1
- package/docs/multithreading/workers/node/index.html +1 -1
- package/docs/neat/index.html +1 -1
- package/docs/src/index.html +1 -1
- package/jest.config.ts +6 -9
- package/package.json +3 -2
- package/plans/HyperMorphoNEAT.md +8 -1
- package/plans/ONNX_EXPORT_PLAN.md +7 -0
- package/scripts/copy-examples.cjs +31 -0
- package/scripts/render-docs-html.ts +81 -19
- package/src/architecture/layer.ts +4 -4
- package/src/methods/cost.ts +6 -6
- package/test/examples/asciiMaze/terminalUtility.ts +1 -4
|
@@ -11,6 +11,7 @@ A clear and concise description of what the bug is.
|
|
|
11
11
|
|
|
12
12
|
**To Reproduce**
|
|
13
13
|
Steps to reproduce the behavior:
|
|
14
|
+
|
|
14
15
|
1. Go to '...'
|
|
15
16
|
2. Run '...'
|
|
16
17
|
3. See error
|
|
@@ -22,6 +23,7 @@ What you expected to happen.
|
|
|
22
23
|
Please include a small snippet or a link to a minimal repo/example that reproduces the issue.
|
|
23
24
|
|
|
24
25
|
**Environment (please complete the following information):**
|
|
26
|
+
|
|
25
27
|
- OS: (e.g. Windows 10 / macOS / Linux)
|
|
26
28
|
- Node version: (e.g. v16.20.0)
|
|
27
29
|
- NeatapticTS commit / tag:
|
|
@@ -19,6 +19,7 @@ Provide a short code snippet or example of how the new API/feature would be used
|
|
|
19
19
|
Describe alternatives you've considered and why they are insufficient.
|
|
20
20
|
|
|
21
21
|
**Acceptance criteria**
|
|
22
|
+
|
|
22
23
|
- [ ] Clear behavior described
|
|
23
24
|
- [ ] Backwards-compatibility considerations noted
|
|
24
25
|
- [ ] Tests or examples to demonstrate the new feature
|
|
@@ -1,19 +1,24 @@
|
|
|
1
1
|
<!-- Brief title: keep under 60 chars -->
|
|
2
2
|
|
|
3
3
|
## Summary
|
|
4
|
+
|
|
4
5
|
<!-- One-line summary of the change -->
|
|
5
6
|
|
|
6
7
|
## Related issue
|
|
8
|
+
|
|
7
9
|
<!-- Link to the issue number this PR addresses, if any -->
|
|
8
10
|
|
|
9
11
|
## What I changed
|
|
10
|
-
|
|
11
|
-
-
|
|
12
|
+
|
|
13
|
+
-
|
|
14
|
+
-
|
|
12
15
|
|
|
13
16
|
## Why this is needed
|
|
17
|
+
|
|
14
18
|
<!-- Short motivation / user-visible impact -->
|
|
15
19
|
|
|
16
20
|
## Checklist
|
|
21
|
+
|
|
17
22
|
- [ ] I have read the CONTRIBUTING guide
|
|
18
23
|
- [ ] The change is covered by tests (new or updated) and `npm test` passes
|
|
19
24
|
- [ ] I regenerated docs where applicable (`npm run docs`) and committed generated README changes if API/JSDoc changed
|
|
@@ -21,6 +26,7 @@
|
|
|
21
26
|
- [ ] I added/update examples if applicable
|
|
22
27
|
|
|
23
28
|
## Testing notes
|
|
29
|
+
|
|
24
30
|
<!-- How to reproduce / run the tests for this change -->
|
|
25
31
|
|
|
26
32
|
## Screenshots (optional)
|
package/.github/workflows/ci.yml
CHANGED
|
@@ -2,32 +2,32 @@ name: CI
|
|
|
2
2
|
|
|
3
3
|
on:
|
|
4
4
|
push:
|
|
5
|
-
branches: [
|
|
5
|
+
branches: [develop]
|
|
6
6
|
pull_request:
|
|
7
|
-
branches: [
|
|
7
|
+
branches: [develop]
|
|
8
8
|
|
|
9
9
|
jobs:
|
|
10
10
|
build-test:
|
|
11
11
|
runs-on: ubuntu-latest
|
|
12
12
|
|
|
13
13
|
steps:
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
14
|
+
- uses: actions/checkout@v4
|
|
15
|
+
- name: Use Node.js
|
|
16
|
+
uses: actions/setup-node@v4
|
|
17
|
+
with:
|
|
18
|
+
node-version: '20'
|
|
19
|
+
- name: Install dependencies
|
|
20
|
+
run: npm ci
|
|
21
|
+
- name: Run tests
|
|
22
|
+
run: npm test
|
|
23
|
+
- name: Check for coverage file
|
|
24
|
+
id: cov
|
|
25
|
+
run: |
|
|
26
|
+
if [ -f coverage/lcov.info ]; then
|
|
27
|
+
echo "found=true" >> $GITHUB_OUTPUT
|
|
28
|
+
else
|
|
29
|
+
echo "found=false" >> $GITHUB_OUTPUT
|
|
30
|
+
fi
|
|
31
31
|
|
|
32
|
-
|
|
33
|
-
|
|
32
|
+
- name: Build
|
|
33
|
+
run: npm run build
|
|
@@ -24,31 +24,31 @@ jobs:
|
|
|
24
24
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
25
25
|
|
|
26
26
|
steps:
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
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: '20'
|
|
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
52
|
|
|
53
53
|
publish:
|
|
54
54
|
needs: release
|
|
@@ -124,7 +124,7 @@ jobs:
|
|
|
124
124
|
echo "masked ~/.npmrc:";
|
|
125
125
|
if [ -f ~/.npmrc ]; then sed -E 's/(:_authToken=).*/\1***REDACTED***/' ~/.npmrc || true; else echo "no ~/.npmrc"; fi
|
|
126
126
|
|
|
127
|
-
- name:
|
|
127
|
+
- name: 'Guard npm auth'
|
|
128
128
|
if: ${{ env.LOOP_SKIP == 'false' && env.RUN_PUBLISH == 'true' }}
|
|
129
129
|
run: |
|
|
130
130
|
set -e
|
|
@@ -200,7 +200,6 @@ jobs:
|
|
|
200
200
|
draft: false
|
|
201
201
|
prerelease: false
|
|
202
202
|
|
|
203
|
-
|
|
204
203
|
- name: Summary
|
|
205
204
|
run: |
|
|
206
205
|
echo "Publish workflow completed. LOOP_SKIP=${{ env.LOOP_SKIP }}"
|
|
@@ -12,27 +12,27 @@ jobs:
|
|
|
12
12
|
bump-and-release:
|
|
13
13
|
runs-on: ubuntu-latest
|
|
14
14
|
steps:
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
15
|
+
- uses: actions/checkout@v4
|
|
16
|
+
with:
|
|
17
|
+
fetch-depth: 0
|
|
18
18
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
19
|
+
- name: Setup Node
|
|
20
|
+
uses: actions/setup-node@v4
|
|
21
|
+
with:
|
|
22
|
+
node-version: '20'
|
|
23
23
|
|
|
24
|
-
|
|
25
|
-
|
|
24
|
+
- name: Install deps
|
|
25
|
+
run: npm ci
|
|
26
26
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
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
36
|
|
|
37
|
-
|
|
38
|
-
|
|
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/CONTRIBUTING.md
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
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
4
|
|
|
5
5
|
### Quick checklist
|
|
6
|
+
|
|
6
7
|
- Fork the repo and open a branch for your work
|
|
7
8
|
- Run `npm install`
|
|
8
9
|
- Make code or docs changes
|
|
@@ -12,6 +13,7 @@ Thank you for helping improve NeatapticTS — this project is educational and co
|
|
|
12
13
|
---
|
|
13
14
|
|
|
14
15
|
### Setup (local)
|
|
16
|
+
|
|
15
17
|
1. Fork this repository and clone your fork.
|
|
16
18
|
2. Install dependencies:
|
|
17
19
|
|
|
@@ -22,6 +24,7 @@ npm install
|
|
|
22
24
|
---
|
|
23
25
|
|
|
24
26
|
### Running tests and docs
|
|
27
|
+
|
|
25
28
|
- Run unit tests:
|
|
26
29
|
|
|
27
30
|
```powershell
|
|
@@ -37,6 +40,7 @@ npm run docs
|
|
|
37
40
|
---
|
|
38
41
|
|
|
39
42
|
### Code style and quality
|
|
43
|
+
|
|
40
44
|
- Keep changes small and focused. Prefer many small PRs over one large PR.
|
|
41
45
|
- Follow TypeScript types and avoid `any` unless necessary; include type updates where relevant.
|
|
42
46
|
- Add or update tests for behavioral changes. Tests live in `test/` and run with `npm test`.
|
|
@@ -44,13 +48,16 @@ npm run docs
|
|
|
44
48
|
---
|
|
45
49
|
|
|
46
50
|
### Documentation
|
|
51
|
+
|
|
47
52
|
- Update JSDoc comments in the `src/` files when changing public APIs.
|
|
48
53
|
- Run `npm run docs` to regenerate per-folder `README.md` files (these are mirrored into `src/*/README.md` and the `docs/` site).
|
|
49
54
|
|
|
50
55
|
---
|
|
51
56
|
|
|
52
57
|
### Reporting bugs
|
|
58
|
+
|
|
53
59
|
Open an issue with the following minimal information:
|
|
60
|
+
|
|
54
61
|
- Repro steps or a small example
|
|
55
62
|
- Error/log output and Node version (or browser/OS when applicable)
|
|
56
63
|
- The expected vs actual behavior
|
|
@@ -60,6 +67,7 @@ If possible, include a small runnable snippet that reproduces the problem.
|
|
|
60
67
|
---
|
|
61
68
|
|
|
62
69
|
### Submitting a pull request
|
|
70
|
+
|
|
63
71
|
1. Create a descriptive branch name (e.g. `fix/activation-pool-bug` or `feat/multiobjective-telemetry`).
|
|
64
72
|
2. Open an issue first for non-trivial changes and note the issue number in your PR.
|
|
65
73
|
3. Ensure tests pass and run `npm run docs` if you changed JSDoc or public APIs.
|
|
@@ -72,21 +80,25 @@ If possible, include a small runnable snippet that reproduces the problem.
|
|
|
72
80
|
---
|
|
73
81
|
|
|
74
82
|
### Review and CI
|
|
83
|
+
|
|
75
84
|
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
85
|
|
|
77
86
|
---
|
|
78
87
|
|
|
79
88
|
### Attribution & license
|
|
89
|
+
|
|
80
90
|
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
91
|
|
|
82
92
|
---
|
|
83
93
|
|
|
84
94
|
### Code of conduct
|
|
95
|
+
|
|
85
96
|
We follow a community-friendly code of conduct. Be respectful in discussions and PR reviews.
|
|
86
97
|
|
|
87
98
|
---
|
|
88
99
|
|
|
89
100
|
### Need help?
|
|
101
|
+
|
|
90
102
|
Open an issue describing what you'd like to change and we can advise on implementation approach and scope.
|
|
91
103
|
|
|
92
104
|
Thank you for contributing!
|
package/ONNX_EXPORT.md
CHANGED
|
@@ -35,7 +35,7 @@ network.train([
|
|
|
35
35
|
{ input: [0, 0], output: [0] },
|
|
36
36
|
{ input: [0, 1], output: [1] },
|
|
37
37
|
{ input: [1, 0], output: [1] },
|
|
38
|
-
{ input: [1, 1], output: [0] }
|
|
38
|
+
{ input: [1, 1], output: [0] },
|
|
39
39
|
]);
|
|
40
40
|
|
|
41
41
|
// Export to ONNX format
|
|
@@ -55,16 +55,19 @@ const onnxJson = JSON.stringify(onnxModel);
|
|
|
55
55
|
## Example Network Structures
|
|
56
56
|
|
|
57
57
|
### Simple MLP (input → output)
|
|
58
|
+
|
|
58
59
|
```
|
|
59
60
|
Input Layer (2 nodes) → Output Layer (1 node)
|
|
60
61
|
```
|
|
61
62
|
|
|
62
63
|
### Single Hidden Layer MLP
|
|
64
|
+
|
|
63
65
|
```
|
|
64
66
|
Input Layer (2 nodes) → Hidden Layer (3 nodes) → Output Layer (1 node)
|
|
65
67
|
```
|
|
66
68
|
|
|
67
69
|
### Multi-Hidden Layer MLP
|
|
70
|
+
|
|
68
71
|
```
|
|
69
72
|
Input Layer (2 nodes) → Hidden Layer 1 (4 nodes) → Hidden Layer 2 (3 nodes) → Output Layer (1 node)
|
|
70
73
|
```
|
|
@@ -81,6 +84,7 @@ The exported ONNX model includes:
|
|
|
81
84
|
## Future Enhancements
|
|
82
85
|
|
|
83
86
|
Future versions may support:
|
|
87
|
+
|
|
84
88
|
- Skip connections
|
|
85
89
|
- Recurrent connections
|
|
86
90
|
- Custom activation functions
|