├── .github
└── workflows
│ ├── documentationjs.yml
│ ├── lactame.yml
│ ├── nodejs.yml
│ └── release.yml
├── .gitignore
├── .npmrc
├── .prettierrc.json
├── CHANGELOG.md
├── CODE_OF_CONDUCT.md
├── CONTRIBUTING.md
├── LICENSE
├── README.md
├── babel.config.json
├── bower.json
├── eslint.config.mjs
├── examples
├── array.js
├── fcnnls.js
├── leafDataset
│ ├── README.md
│ ├── knn.js
│ ├── leaf.csv
│ ├── logreg.js
│ ├── naive-bayes.js
│ ├── package.json
│ └── svm.js
└── sg.js
├── package.json
├── rollup.config.mjs
└── src
├── __tests__
└── index.test.js
└── index.js
/.github/workflows/documentationjs.yml:
--------------------------------------------------------------------------------
1 | name: Deploy documentation.js on GitHub pages
2 |
3 | on:
4 | workflow_dispatch:
5 | release:
6 | types: [published]
7 |
8 | jobs:
9 | deploy:
10 | runs-on: ubuntu-latest
11 | steps:
12 | - uses: actions/checkout@v2
13 | - name: Build documentation
14 | uses: zakodium/documentationjs-action@v1
15 | - name: Deploy to GitHub pages
16 | uses: JamesIves/github-pages-deploy-action@releases/v4
17 | with:
18 | token: ${{ secrets.BOT_TOKEN }}
19 | branch: gh-pages
20 | folder: docs
21 | clean: true
22 |
--------------------------------------------------------------------------------
/.github/workflows/lactame.yml:
--------------------------------------------------------------------------------
1 | name: Deploy build on lactame.com
2 |
3 | on:
4 | workflow_dispatch:
5 | release:
6 | types: [published]
7 |
8 | env:
9 | NODE_VERSION: 14.x
10 |
11 | jobs:
12 | deploy:
13 | runs-on: ubuntu-latest
14 | steps:
15 | - uses: actions/checkout@v2
16 | - name: Get package name
17 | run: echo "PACKAGE_NAME=$(jq .name package.json | tr -d '"')" >> $GITHUB_ENV
18 | - uses: actions/setup-node@v2
19 | with:
20 | node-version: ${{ env.NODE_VERSION }}
21 | - name: Install dependencies
22 | run: npm install
23 | - name: Build project
24 | run: npm run build
25 | - name: Deploy to lactame.com
26 | uses: zakodium/lactame-action@v1
27 | with:
28 | token: ${{ secrets.LACTAME_TOKEN }}
29 | name: ${{ env.PACKAGE_NAME }}
30 | folder: dist
31 |
--------------------------------------------------------------------------------
/.github/workflows/nodejs.yml:
--------------------------------------------------------------------------------
1 | name: Node.js CI
2 |
3 | on:
4 | push:
5 | branches:
6 | - main
7 | pull_request:
8 |
9 | jobs:
10 | nodejs:
11 | # Documentation: https://github.com/zakodium/workflows#nodejs-ci
12 | uses: zakodium/workflows/.github/workflows/nodejs.yml@nodejs-v1
13 | with:
14 | test-setup-command: 'npm run build && node dist/ml.js && node dist/ml.min.js'
15 |
--------------------------------------------------------------------------------
/.github/workflows/release.yml:
--------------------------------------------------------------------------------
1 | name: Release
2 |
3 | on:
4 | push:
5 | branches:
6 | - main
7 |
8 | jobs:
9 | release:
10 | # Documentation: https://github.com/zakodium/workflows#release
11 | uses: zakodium/workflows/.github/workflows/release.yml@release-v1
12 | with:
13 | npm: true
14 | secrets:
15 | github-token: ${{ secrets.BOT_TOKEN }}
16 | npm-token: ${{ secrets.NPM_BOT_TOKEN }}
17 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | .idea
2 | node_modules
3 | lib
4 |
5 | .eslintcache
6 | dist
7 | coverage
--------------------------------------------------------------------------------
/.npmrc:
--------------------------------------------------------------------------------
1 | package-lock=false
2 |
--------------------------------------------------------------------------------
/.prettierrc.json:
--------------------------------------------------------------------------------
1 | {
2 | "arrowParens": "always",
3 | "semi": true,
4 | "singleQuote": true,
5 | "tabWidth": 2,
6 | "trailingComma": "all"
7 | }
8 |
--------------------------------------------------------------------------------
/CHANGELOG.md:
--------------------------------------------------------------------------------
1 | # Changelog
2 |
3 | ## [8.0.0](https://github.com/mljs/ml/compare/v7.0.0...v8.0.0) (2024-10-21)
4 |
5 |
6 | ### ⚠ BREAKING CHANGES
7 |
8 | * update dependencies ([#186](https://github.com/mljs/ml/issues/186))
9 |
10 | ### Features
11 |
12 | * update dependencies ([#186](https://github.com/mljs/ml/issues/186)) ([9cf0471](https://github.com/mljs/ml/commit/9cf0471c1c2787b136f6e1ad537fee20abc02a39))
13 |
14 |
15 | ### Bug Fixes
16 |
17 | * rename rollup to rollup.config.mjs ([c63c278](https://github.com/mljs/ml/commit/c63c2784f84c4909081ae0a2bf2e6b17619f75dd))
18 |
19 | ## [7.0.0](https://github.com/mljs/ml/compare/v5.3.0...v7.0.0) (2024-02-02)
20 |
21 |
22 | ### ⚠ BREAKING CHANGES
23 |
24 | * update dependencies
25 | * update dependencies
26 | * remove support for Node.js 12
27 | * remove num-sort package exportation
28 | * update all dependencies
29 | * Remove dist from git
30 |
31 | ### release-as
32 |
33 | * 7.0.0 ([27176ee](https://github.com/mljs/ml/commit/27176ee3eefa493144d76296ec3401c2c84fe190))
34 |
35 |
36 | ### Features
37 |
38 | * add lactame.com action release ([2547a9a](https://github.com/mljs/ml/commit/2547a9a1760582612e3c5a012f5ff977655a3f6c))
39 | * Remove dist from git ([90392a5](https://github.com/mljs/ml/commit/90392a5dec7e1d75cf73398cdfffc0e91765302f))
40 | * remove num-sort package exportation ([4b8c47b](https://github.com/mljs/ml/commit/4b8c47b25a903dd06d664afd84d3738bdcbc26ae))
41 | * update all dependencies ([114d814](https://github.com/mljs/ml/commit/114d81448d47eca961223f2c2f38da297466c238))
42 | * update and improve GSD ([7222a2c](https://github.com/mljs/ml/commit/7222a2c797dfff0ae1b4777dbbd09c3c41488187))
43 | * update dependencies ([8adb8f1](https://github.com/mljs/ml/commit/8adb8f1ddb4842b32afe92a28a354408034889a3))
44 |
45 |
46 | ### Bug Fixes
47 |
48 | * add missing ml-array-sum package ([d471033](https://github.com/mljs/ml/commit/d471033dc121a50313a2ab8ae0cccdb61f26c113))
49 | * correct link to lactame.com to v6.0.0 ([65e9ca0](https://github.com/mljs/ml/commit/65e9ca0629dfc6b64ea1b17e8c11273e97fa0656))
50 | * update dependencies to fix nGMCA ([9b040d0](https://github.com/mljs/ml/commit/9b040d0fa66baca16f3c8fb2ebb2a74eb39f5b46))
51 |
52 |
53 | ### Documentation
54 |
55 | * update Array.seqentialFill Link ([#167](https://github.com/mljs/ml/issues/167)) ([46bb1ec](https://github.com/mljs/ml/commit/46bb1ec2150e496f67ca617acb2da2e2894dbfdc))
56 |
57 |
58 | ### Miscellaneous Chores
59 |
60 | * remove support for Node.js 12 ([88c0717](https://github.com/mljs/ml/commit/88c0717ffb4e5ee0b3cc0401bd7f38fb96c3eade))
61 | * update dependencies ([88c0717](https://github.com/mljs/ml/commit/88c0717ffb4e5ee0b3cc0401bd7f38fb96c3eade))
62 |
63 | ## [6.0.0](https://github.com/mljs/ml/compare/v5.3.0...v6.0.0) (2021-06-10)
64 |
65 |
66 | ### ⚠ BREAKING CHANGES
67 |
68 | * remove num-sort package exportation
69 | * update all dependencies
70 | * Remove dist from git
71 |
72 | ### Features
73 |
74 | * Remove dist from git ([90392a5](https://github.com/mljs/ml/commit/90392a5dec7e1d75cf73398cdfffc0e91765302f))
75 | * remove num-sort package exportation ([4b8c47b](https://github.com/mljs/ml/commit/4b8c47b25a903dd06d664afd84d3738bdcbc26ae))
76 | * update all dependencies ([114d814](https://github.com/mljs/ml/commit/114d81448d47eca961223f2c2f38da297466c238))
77 | * update and improve GSD ([7222a2c](https://github.com/mljs/ml/commit/7222a2c797dfff0ae1b4777dbbd09c3c41488187))
78 |
79 |
80 | ### Bug Fixes
81 |
82 | * add missing ml-array-sum package ([d471033](https://github.com/mljs/ml/commit/d471033dc121a50313a2ab8ae0cccdb61f26c113))
83 | * correct link to lactame.com to v6.0.0 ([65e9ca0](https://github.com/mljs/ml/commit/65e9ca0629dfc6b64ea1b17e8c11273e97fa0656))
84 | * update dependencies to fix nGMCA ([9b040d0](https://github.com/mljs/ml/commit/9b040d0fa66baca16f3c8fb2ebb2a74eb39f5b46))
85 |
86 |
87 | # [3.5.0](https://github.com/mljs/ml/compare/v3.4.0...v3.5.0) (2018-08-16)
88 |
89 |
90 | ### Bug Fixes
91 |
92 | * **package:** update ml-xsadd to version 2.0.0 ([#108](https://github.com/mljs/ml/issues/108)) ([01c5e25](https://github.com/mljs/ml/commit/01c5e25))
93 | * require ml-random correctly ([4d64b91](https://github.com/mljs/ml/commit/4d64b91))
94 | * require xsadd correctly ([facfaea](https://github.com/mljs/ml/commit/facfaea))
95 |
96 |
97 |
98 |
99 | # [3.4.0](https://github.com/mljs/ml/compare/v3.3.0...v3.4.0) (2018-08-02)
100 |
101 |
102 |
103 |
104 | # [3.3.0](https://github.com/mljs/ml/compare/v3.2.0...v3.3.0) (2018-07-29)
105 |
106 |
107 | ### Bug Fixes
108 |
109 | * DecisionTreeRegression import typo ([#97](https://github.com/mljs/ml/issues/97)) ([c5df0da](https://github.com/mljs/ml/commit/c5df0da))
110 | * **package:** update ml-kmeans to version 4.0.0 ([#101](https://github.com/mljs/ml/issues/101)) ([57c4a90](https://github.com/mljs/ml/commit/57c4a90))
111 | * **readme:** fix link to ml-random ([3a4b5c3](https://github.com/mljs/ml/commit/3a4b5c3))
112 |
113 |
114 | ### Features
115 |
116 | * ML.Random ([6e44339](https://github.com/mljs/ml/commit/6e44339))
117 |
118 |
119 |
120 |
121 | # [3.2.0](https://github.com/mljs/ml/compare/v3.1.0...v3.2.0) (2018-02-21)
122 |
123 |
124 | ### Features
125 |
126 | * add random forest regression and classification ([#94](https://github.com/mljs/ml/issues/94)) ([11688e3](https://github.com/mljs/ml/commit/11688e3))
127 |
128 |
129 |
130 |
131 | # [3.1.0](https://github.com/mljs/ml/compare/v3.0.0...v3.1.0) (2018-02-17)
132 |
133 |
134 | ### Features
135 |
136 | * add ml-cart to the package ([#93](https://github.com/mljs/ml/issues/93)) ([001fc12](https://github.com/mljs/ml/commit/001fc12))
137 |
138 |
139 |
140 |
141 | # [3.0.0](https://github.com/mljs/ml/compare/v2.2.0...v3.0.0) (2018-02-17)
142 |
143 |
144 | ### Bug Fixes
145 |
146 | * **package:** update ml-matrix to version 5.0.0 ([#76](https://github.com/mljs/ml/issues/76)) ([185d1c3](https://github.com/mljs/ml/commit/185d1c3))
147 | * **package:** update ml-naivebayes to version 3.0.0 ([3f312dc](https://github.com/mljs/ml/commit/3f312dc))
148 | * **package:** update ml-pls to version 1.0.0 ([7cf908a](https://github.com/mljs/ml/commit/7cf908a))
149 |
150 |
151 |
152 |
153 | # [2.2.0](https://github.com/mljs/ml/compare/v2.1.1...v2.2.0) (2017-07-14)
154 |
155 |
156 | ### Features
157 |
158 | * add ml-confusion-matrix ([4af2e50](https://github.com/mljs/ml/commit/4af2e50))
159 |
160 |
161 |
162 |
163 | ## [2.1.1](https://github.com/mljs/ml/compare/v2.1.0...v2.1.1) (2017-06-29)
164 |
165 |
166 |
167 |
168 | # [2.1.0](https://github.com/mljs/ml/compare/v2.0.0...v2.1.0) (2017-06-23)
169 |
170 |
171 |
172 |
173 | # [2.0.0](https://github.com/mljs/ml/compare/v1.4.0...v2.0.0) (2017-02-10)
174 |
175 |
176 | ### Bug Fixes
177 |
178 | * **package:** update ml-fnn to version 3.0.0 ([#59](https://github.com/mljs/ml/issues/59)) ([e7dc062](https://github.com/mljs/ml/commit/e7dc062))
179 |
180 |
181 |
182 |
183 | # [1.4.0](https://github.com/mljs/ml/compare/v1.3.1...v1.4.0) (2016-09-23)
184 |
185 |
186 |
187 |
188 | ## [1.3.1](https://github.com/mljs/ml/compare/v1.3.0...v1.3.1) (2016-09-05)
189 |
190 |
191 |
192 |
193 | # [1.3.0](https://github.com/mljs/ml/compare/v1.2.1...v1.3.0) (2016-09-05)
194 |
195 |
196 | ### Features
197 |
198 | * **binary-search:** add v1.1.0 of binary search algorithm ([2a6d349](https://github.com/mljs/ml/commit/2a6d349))
199 |
200 |
201 |
202 |
203 | ## [1.2.1](https://github.com/mljs/ml/compare/v1.2.0...v1.2.1) (2016-08-16)
204 |
205 |
206 |
207 |
208 | # [1.2.0](https://github.com/mljs/ml/compare/v1.1.1...v1.2.0) (2016-08-11)
209 |
210 |
211 | ### Bug Fixes
212 |
213 | * **ml-stat:** new access route for array and matrix ([3094e35](https://github.com/mljs/ml/commit/3094e35))
214 |
215 |
216 | ### Features
217 |
218 | * add optimization package ([ceb5319](https://github.com/mljs/ml/commit/ceb5319))
219 |
220 |
221 |
222 |
223 | ## [1.1.1](https://github.com/mljs/ml/compare/v1.1.0...v1.1.1) (2016-08-03)
224 |
225 |
226 |
227 |
228 | # [1.1.0](https://github.com/mljs/ml/compare/v1.0.0...v1.1.0) (2016-08-03)
229 |
230 |
231 |
232 |
233 | # [1.0.0](https://github.com/mljs/ml/compare/v0.13.7...v1.0.0) (2016-06-22)
234 |
235 |
236 |
237 |
238 | ## [0.13.7](https://github.com/mljs/ml/compare/v0.13.6...v0.13.7) (2016-06-16)
239 |
240 |
241 |
242 |
243 | ## [0.13.6](https://github.com/mljs/ml/compare/v0.13.4...v0.13.6) (2016-06-15)
244 |
245 |
246 |
247 |
248 | ## [0.13.4](https://github.com/mljs/ml/compare/v0.13.3...v0.13.4) (2016-06-13)
249 |
250 |
251 |
252 |
253 | ## [0.13.3](https://github.com/mljs/ml/compare/v0.13.2...v0.13.3) (2016-06-13)
254 |
255 |
256 |
257 |
258 | ## [0.13.2](https://github.com/mljs/ml/compare/v0.13.1...v0.13.2) (2016-06-10)
259 |
260 |
261 |
262 |
263 | # [0.13.0](https://github.com/mljs/ml/compare/v0.12.0...v0.13.0) (2016-06-10)
264 |
265 |
266 |
267 |
268 | # [0.12.0](https://github.com/mljs/ml/compare/v0.11.2...v0.12.0) (2016-06-09)
269 |
270 |
271 |
272 |
273 | ## [0.11.2](https://github.com/mljs/ml/compare/v0.11.1...v0.11.2) (2016-06-02)
274 |
275 |
276 |
277 |
278 | ## [0.11.1](https://github.com/mljs/ml/compare/v0.11.0...v0.11.1) (2016-05-31)
279 |
280 |
281 |
282 |
283 | # [0.11.0](https://github.com/mljs/ml/compare/v0.10.1...v0.11.0) (2016-05-31)
284 |
285 |
286 |
287 |
288 | ## [0.10.1](https://github.com/mljs/ml/compare/v0.10.0...v0.10.1) (2016-05-30)
289 |
290 |
291 |
292 |
293 | # [0.10.0](https://github.com/mljs/ml/compare/v0.9.1...v0.10.0) (2016-05-26)
294 |
295 |
296 |
297 |
298 | ## [0.9.1](https://github.com/mljs/ml/compare/v0.9.0...v0.9.1) (2016-05-23)
299 |
300 |
301 |
302 |
303 | # [0.9.0](https://github.com/mljs/ml/compare/v0.8.2...v0.9.0) (2016-05-19)
304 |
305 |
306 |
307 |
308 | ## [0.8.2](https://github.com/mljs/ml/compare/v0.8.1...v0.8.2) (2016-05-14)
309 |
310 |
311 |
312 |
313 | ## [0.8.1](https://github.com/mljs/ml/compare/v0.8.0...v0.8.1) (2015-11-19)
314 |
315 |
316 |
317 |
318 | # [0.8.0](https://github.com/mljs/ml/compare/v0.7.0...v0.8.0) (2015-09-15)
319 |
320 |
321 |
322 |
323 | # [0.7.0](https://github.com/mljs/ml/compare/v0.6.2...v0.7.0) (2015-09-07)
324 |
325 |
326 |
327 |
328 | ## [0.6.2](https://github.com/mljs/ml/compare/v0.6.1...v0.6.2) (2015-09-02)
329 |
330 |
331 |
332 |
333 | ## [0.6.1](https://github.com/mljs/ml/compare/v0.6.0...v0.6.1) (2015-09-01)
334 |
335 |
336 |
337 |
338 | # [0.6.0](https://github.com/mljs/ml/compare/v0.5.1...v0.6.0) (2015-08-20)
339 |
340 |
341 |
342 |
343 | ## [0.5.1](https://github.com/mljs/ml/compare/v0.5.0...v0.5.1) (2015-08-20)
344 |
345 |
346 |
347 |
348 | # [0.5.0](https://github.com/mljs/ml/compare/v0.4.1...v0.5.0) (2015-08-20)
349 |
350 |
351 |
352 |
353 | ## [0.4.1](https://github.com/mljs/ml/compare/v0.4.0...v0.4.1) (2015-08-05)
354 |
355 |
356 |
357 |
358 | # [0.4.0](https://github.com/mljs/ml/compare/v0.3.10...v0.4.0) (2015-07-24)
359 |
360 |
361 |
362 |
363 | ## [0.3.10](https://github.com/mljs/ml/compare/v0.3.9...v0.3.10) (2015-07-08)
364 |
365 |
366 |
367 |
368 | ## [0.3.8](https://github.com/mljs/ml/compare/v0.3.7...v0.3.8) (2015-07-07)
369 |
370 |
371 |
372 |
373 | ## [0.3.7](https://github.com/mljs/ml/compare/v0.3.6...v0.3.7) (2015-07-03)
374 |
375 |
376 |
377 |
378 | ## [0.3.6](https://github.com/mljs/ml/compare/v0.3.5...v0.3.6) (2015-07-01)
379 |
380 |
381 |
382 |
383 | ## [0.3.5](https://github.com/mljs/ml/compare/v0.3.4...v0.3.5) (2015-06-30)
384 |
385 |
386 |
387 |
388 | ## [0.3.4](https://github.com/mljs/ml/compare/v0.3.3...v0.3.4) (2015-06-29)
389 |
390 |
391 |
392 |
393 | ## [0.3.3](https://github.com/mljs/ml/compare/v0.3.1...v0.3.3) (2015-06-23)
394 |
395 |
396 |
397 |
398 | ## [0.3.1](https://github.com/mljs/ml/compare/v0.3.0...v0.3.1) (2015-06-17)
399 |
400 |
401 |
402 |
403 | # [0.3.0](https://github.com/mljs/ml/compare/v0.2.3...v0.3.0) (2015-06-17)
404 |
405 |
406 |
407 |
408 | ## [0.2.3](https://github.com/mljs/ml/compare/v0.2.2...v0.2.3) (2015-04-24)
409 |
410 |
411 |
412 |
413 | ## [0.2.2](https://github.com/mljs/ml/compare/v0.2.1...v0.2.2) (2015-03-16)
414 |
415 |
416 |
417 |
418 | ## [0.2.1](https://github.com/mljs/ml/compare/v0.2.0...v0.2.1) (2015-02-02)
419 |
420 |
421 |
422 |
423 | # [0.2.0](https://github.com/mljs/ml/compare/v0.1.4...v0.2.0) (2015-01-27)
424 |
425 |
426 |
427 |
428 | ## [0.1.4](https://github.com/mljs/ml/compare/v0.1.3...v0.1.4) (2014-12-09)
429 |
430 |
431 |
432 |
433 | ## [0.1.3](https://github.com/mljs/ml/compare/v0.1.2...v0.1.3) (2014-12-09)
434 |
435 |
436 |
437 |
438 | ## [0.1.2](https://github.com/mljs/ml/compare/v0.1.1...v0.1.2) (2014-12-03)
439 |
440 |
441 |
442 |
443 | ## [0.1.1](https://github.com/mljs/ml/compare/v0.1.0...v0.1.1) (2014-12-01)
444 |
445 |
446 |
447 |
448 | # [0.1.0](https://github.com/mljs/ml/compare/v0.0.5...v0.1.0) (2014-11-18)
449 |
450 |
451 |
452 |
453 | ## [0.0.5](https://github.com/mljs/ml/compare/v0.0.4...v0.0.5) (2014-10-28)
454 |
455 |
456 |
457 |
458 | ## [0.0.4](https://github.com/mljs/ml/compare/v0.0.3...v0.0.4) (2014-10-28)
459 |
460 |
461 |
462 |
463 | ## [0.0.3](https://github.com/mljs/ml/compare/v0.0.2...v0.0.3) (2014-10-28)
464 |
465 |
466 |
467 |
468 | ## [0.0.2](https://github.com/mljs/ml/compare/v0.0.1...v0.0.2) (2014-10-28)
469 |
470 |
471 |
472 |
473 | ## 0.0.1 (2014-10-28)
474 |
--------------------------------------------------------------------------------
/CODE_OF_CONDUCT.md:
--------------------------------------------------------------------------------
1 | # Contributor Covenant Code of Conduct
2 |
3 | ## Our Pledge
4 |
5 | In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation.
6 |
7 | ## Our Standards
8 |
9 | Examples of behavior that contributes to creating a positive environment include:
10 |
11 | * Using welcoming and inclusive language
12 | * Being respectful of differing viewpoints and experiences
13 | * Gracefully accepting constructive criticism
14 | * Focusing on what is best for the community
15 | * Showing empathy towards other community members
16 |
17 | Examples of unacceptable behavior by participants include:
18 |
19 | * The use of sexualized language or imagery and unwelcome sexual attention or advances
20 | * Trolling, insulting/derogatory comments, and personal or political attacks
21 | * Public or private harassment
22 | * Publishing others' private information, such as a physical or electronic address, without explicit permission
23 | * Other conduct which could reasonably be considered inappropriate in a professional setting
24 |
25 | ## Our Responsibilities
26 |
27 | Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior.
28 |
29 | Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful.
30 |
31 | ## Scope
32 |
33 | This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers.
34 |
35 | ## Enforcement
36 |
37 | Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at admin@cheminfo.org. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately.
38 |
39 | Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership.
40 |
41 | ## Attribution
42 |
43 | This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [http://contributor-covenant.org/version/1/4][version]
44 |
45 | [homepage]: http://contributor-covenant.org
46 | [version]: http://contributor-covenant.org/version/1/4/
47 |
--------------------------------------------------------------------------------
/CONTRIBUTING.md:
--------------------------------------------------------------------------------
1 | # Contributing to mljs
2 |
3 | This document explains the general guidelines for the development of JavaScript APIs
4 | for the machine learning algorithms.
5 |
6 | * [General rules](#general-rules)
7 | * [Standalone functions](#standalone-functions)
8 | * [Predictors](#predictors)
9 | * [Commit Guidelines](#commit-guidelines)
10 | * [Issues and Bugs](#issues-and-bugs)
11 |
12 | ## General rules
13 |
14 | ### Use camelCase
15 |
16 | For consistency and because it is by far the most common style in JavaScript.
17 | Exception: class names must start with a capital letter.
18 |
19 | #### Good
20 |
21 | * xSquared
22 | * kernelType
23 | * maybeToPrecision
24 |
25 | #### Bad
26 |
27 | * x_squared
28 | * KernelType
29 | * maybe_To$precision
30 |
31 | ### Use understandable names
32 |
33 | The API is the point of contact with the outside world. People who use it should understand what an
34 | option or a function does without looking at the documentation.
35 |
36 | #### Good
37 |
38 | * alpha, beta, gamma, ...
39 | * kernel, xSquared, numerator
40 |
41 | #### Bad
42 |
43 | * a, b, c
44 | * k, x2, num
45 |
46 | ## Standalone functions
47 |
48 | Functions that take some input and directly return the result should always have the following signature:
49 |
50 | ```js
51 | function myFunction(param1, param2, ..., paramN, options = {}) { ... }
52 | ```
53 |
54 | The `param1` to `paramN` arguments are reserved for __mandatory__ parameters. Anything else goes in an `options` object.
55 | The call should not fail if `options` is undefined.
56 |
57 | To handle default options, use default parameters and object destructuring:
58 |
59 | ```js
60 | function myFunction(options = {}) {
61 | const {
62 | option1 = 'value1',
63 | option2 = 'value2'
64 | } = options;
65 | ...
66 | }
67 | ```
68 |
69 | ## Predictors
70 |
71 | Predictors are classes which implement the following interface:
72 |
73 | ### new Predictor([options])
74 |
75 | Creates the predictor. The constructor can take parameters or options to initialize the algorithm.
76 | Alternatively, if the predictor has no training phase, it can be instantiated like so: `new Predictor(features[[, labels], options])`
77 |
78 | ### predictor.train(features[[, labels], options])
79 | If the predictor has a training phase, it is executed here.
80 |
81 | ### predictor.predict(features)
82 |
83 | This method runs the prediction for a new set of observations.
84 |
85 | ### predictor.score()
86 |
87 | This method is optional.
88 | It should return a value that represents the quality of a predictor.
89 |
90 | ### predictor.toJSON()
91 |
92 | This method should return plain JavaScript Object that enables to reload the current predictor
93 | and that can be serialized to a JSON string using `JSON.stringify`
94 |
95 | ### Predictor.load(json)
96 |
97 | This static method should return a new predictor instance that is ready to make predictions. The `json`
98 | parameter is the object returned by an earlier call of `toJSON`.
99 |
100 | ## Commit Guidelines
101 |
102 | The rules are based on the [AngularJS commit guidelines](https://github.com/angular/angular.js/blob/main/CONTRIBUTING.md#commit). This leads to **more readable messages** that are easy to follow when looking through the **project history**.
103 |
104 | ### Commit Message Format
105 | Each commit message consists of a **header**, a **body** and a **footer**. The header has a special
106 | format that includes a **type**, a **scope** and a **subject**:
107 |
108 | ```
109 | ():
110 |
111 |
112 |
113 |