@thi.ng/k-means 0.4.8 → 0.5.2

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 (3) hide show
  1. package/CHANGELOG.md +80 -46
  2. package/README.md +1 -1
  3. package/package.json +82 -77
package/CHANGELOG.md CHANGED
@@ -1,79 +1,113 @@
1
1
  # Change Log
2
2
 
3
- All notable changes to this project will be documented in this file.
4
- See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
-
6
- ## [0.4.8](https://github.com/thi-ng/umbrella/compare/@thi.ng/k-means@0.4.7...@thi.ng/k-means@0.4.8) (2021-11-04)
7
-
8
- **Note:** Version bump only for package @thi.ng/k-means
9
-
10
-
11
-
12
-
13
-
14
- ## [0.4.7](https://github.com/thi-ng/umbrella/compare/@thi.ng/k-means@0.4.6...@thi.ng/k-means@0.4.7) (2021-11-03)
15
-
16
- **Note:** Version bump only for package @thi.ng/k-means
17
-
3
+ - **Last updated**: 2021-11-21T17:09:28Z
4
+ - **Generator**: [thi.ng/monopub](https://thi.ng/monopub)
18
5
 
6
+ All notable changes to this project will be documented in this file.
7
+ See [Conventional Commits](https://conventionalcommits.org/) for commit guidelines.
19
8
 
9
+ **Note:** Unlisted _patch_ versions only involve non-code or otherwise excluded changes
10
+ and/or version bumps of transitive dependencies.
20
11
 
12
+ ## [0.5.0](https://github.com/thi-ng/umbrella/tree/@thi.ng/k-means@0.5.0) (2021-11-17)
21
13
 
22
- # [0.4.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/k-means@0.3.6...@thi.ng/k-means@0.4.0) (2021-10-12)
14
+ #### 🚀 Features
23
15
 
16
+ - Using workspaces for local tools ([bf7a404](https://github.com/thi-ng/umbrella/commit/bf7a404))
17
+ Improving the overall build ergonomics
18
+ - introduced a tools workspaces
19
+ - imported it in all needed packages/examples
20
+ - inclusive project root
24
21
 
25
- ### Build System
22
+ #### ♻️ Refactoring
26
23
 
27
- * major update of ALL pkgs (export maps, ESM only) ([0d1d6ea](https://github.com/thi-ng/umbrella/commit/0d1d6ea9fab2a645d6c5f2bf2591459b939c09b6))
24
+ - testrunner to binary ([4ebbbb2](https://github.com/thi-ng/umbrella/commit/4ebbbb2))
25
+ this commit reverts (partly) changes made in:
26
+ ef346d7a8753590dc9094108a3d861a8dbd5dd2c
27
+ overall purpose is better testament ergonomics:
28
+ instead of having to pass NODE_OPTIONS with every invocation
29
+ having a binary to handle this for us.
28
30
 
31
+ ### [0.4.1](https://github.com/thi-ng/umbrella/tree/@thi.ng/k-means@0.4.1) (2021-10-13)
29
32
 
30
- ### BREAKING CHANGES
33
+ #### ♻️ Refactoring
31
34
 
32
- * discontinue CommonJS & UMD versions
35
+ - update imports in all tests/pkgs ([effd591](https://github.com/thi-ng/umbrella/commit/effd591))
36
+ - update imports in all pkgs ([5fa2b6f](https://github.com/thi-ng/umbrella/commit/5fa2b6f))
37
+ - add .js suffix for all relative imports
33
38
 
34
- - only ESM modules will be published from now on
35
- - CJS obsolete due to ESM support in recent versions of node:
36
- - i.e. launch NodeJS via:
37
- - `node --experimental-specifier-resolution=node --experimental-repl-await`
38
- - in the node REPL use `await import(...)` instead of `require()`
39
- - UMD obsolete due to widespread browser support for ESM
39
+ ## [0.4.0](https://github.com/thi-ng/umbrella/tree/@thi.ng/k-means@0.4.0) (2021-10-12)
40
40
 
41
- Also:
42
- - normalize/restructure/reorg all package.json files
43
- - cleanup all build scripts, remove obsolete
44
- - switch from mocha to @thi.ng/testament for all tests
41
+ #### 🛑 Breaking changes
45
42
 
43
+ - major update of ALL pkgs (export maps, ESM only) ([0d1d6ea](https://github.com/thi-ng/umbrella/commit/0d1d6ea))
44
+ - BREAKING CHANGE: discontinue CommonJS & UMD versions
45
+ - only ESM modules will be published from now on
46
+ - CJS obsolete due to ESM support in recent versions of node:
47
+ - i.e. launch NodeJS via:
48
+ - `node --experimental-specifier-resolution=node --experimental-repl-await`
49
+ - in the node REPL use `await import(...)` instead of `require()`
50
+ - UMD obsolete due to widespread browser support for ESM
51
+ Also:
52
+ - normalize/restructure/reorg all package.json files
53
+ - cleanup all build scripts, remove obsolete
54
+ - switch from mocha to [@thi.ng/testament](https://github.com/thi-ng/umbrella/tree/main/packages/testament) for all tests
46
55
 
56
+ #### ♻️ Refactoring
47
57
 
58
+ - update deps & imports in various pkgs ([e1cf29e](https://github.com/thi-ng/umbrella/commit/e1cf29e))
59
+ - largely related to recent updates/restructuring of these packages:
60
+ - api
61
+ - defmulti
62
+ - errors
63
+ - logger
64
+ - update imports ([138571a](https://github.com/thi-ng/umbrella/commit/138571a))
65
+ - update all test stubs ([f2d6d53](https://github.com/thi-ng/umbrella/commit/f2d6d53))
66
+ - update all tests in _all_ pkgs ([8b582bc](https://github.com/thi-ng/umbrella/commit/8b582bc))
67
+ - update all to use [@thi.ng/testament](https://github.com/thi-ng/umbrella/tree/main/packages/testament)
48
68
 
69
+ ## [0.3.0](https://github.com/thi-ng/umbrella/tree/@thi.ng/k-means@0.3.0) (2021-08-04)
49
70
 
71
+ #### 🚀 Features
50
72
 
51
- # [0.3.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/k-means@0.2.5...@thi.ng/k-means@0.3.0) (2021-08-04)
73
+ - auto-correct `k` if needed ([d3c3ffa](https://github.com/thi-ng/umbrella/commit/d3c3ffa))
74
+ - update initKmeanspp() & kmeans() to auto-adjust (reduce) `k` if needed
75
+ - add potential failsafe to bail early in initKmeanspp()
52
76
 
53
- ### Features
77
+ ### [0.2.5](https://github.com/thi-ng/umbrella/tree/@thi.ng/k-means@0.2.5) (2021-08-04)
54
78
 
55
- - **k-means:** auto-correct `k` if needed ([d3c3ffa](https://github.com/thi-ng/umbrella/commit/d3c3ffa768bdebe67843c8094af1fe7a9bc524ed))
79
+ #### 🩹 Bug fixes
56
80
 
57
- ## [0.2.5](https://github.com/thi-ng/umbrella/compare/@thi.ng/k-means@0.2.4...@thi.ng/k-means@0.2.5) (2021-08-04)
81
+ - update initKmeanspp() ([dd0d965](https://github.com/thi-ng/umbrella/commit/dd0d965))
82
+ - use `dist` for argmin() calls
83
+ - use `rnd` for weightedRandom()
58
84
 
59
- ### Bug Fixes
85
+ ## [0.2.0](https://github.com/thi-ng/umbrella/tree/@thi.ng/k-means@0.2.0) (2021-04-20)
60
86
 
61
- - **k-means:** update initKmeanspp() ([dd0d965](https://github.com/thi-ng/umbrella/commit/dd0d9654b1aacce8a4bbbd921f2ce44d0eaa276a))
87
+ #### 🚀 Features
62
88
 
63
- # [0.2.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/k-means@0.1.0...@thi.ng/k-means@0.2.0) (2021-04-20)
89
+ - add meansLatLon centroid strategy, docstrings ([269c11c](https://github.com/thi-ng/umbrella/commit/269c11c))
64
90
 
65
- ### Features
91
+ #### ♻️ Refactoring
66
92
 
67
- - **k-means:** add meansLatLon centroid strategy, docstrings ([269c11c](https://github.com/thi-ng/umbrella/commit/269c11c10907351d98acfb929af5036a23a2e5c3))
93
+ - update initKmeanspp() ([193c054](https://github.com/thi-ng/umbrella/commit/193c054))
94
+ - ensure unique centroids
68
95
 
69
- # 0.1.0 (2021-04-19)
96
+ ## [0.1.0](https://github.com/thi-ng/umbrella/tree/@thi.ng/k-means@0.1.0) (2021-04-19)
70
97
 
71
- ### Bug Fixes
98
+ #### 🚀 Features
72
99
 
73
- - **k-means:** use dist metric in initKmeanspp() ([37bd6c6](https://github.com/thi-ng/umbrella/commit/37bd6c6ae062f903cea05bd6ce9d42e97aa5dbd9))
100
+ - add kmeans++ initialization, update opts ([fcc2dcc](https://github.com/thi-ng/umbrella/commit/fcc2dcc))
101
+ - add `KMeansOpts.initial` to provide initial centroids
102
+ - add initKmeanspp() impl
103
+ - update kmeans() to use improved init step (if needed)
104
+ - add k-medians support ([6bc450b](https://github.com/thi-ng/umbrella/commit/6bc450b))
105
+ - add CentroidStrategy, update KMeansOpts
106
+ - update kmeans() to use strategy impl
107
+ - extract means() & medians() strategies
108
+ - import as new pkg ([a32aaf6](https://github.com/thi-ng/umbrella/commit/a32aaf6))
74
109
 
75
- ### Features
110
+ #### 🩹 Bug fixes
76
111
 
77
- - **k-means:** add k-medians support ([6bc450b](https://github.com/thi-ng/umbrella/commit/6bc450b95e1ed93ab18a9045ce1d4ba324a61eb3))
78
- - **k-means:** add kmeans++ initialization, update opts ([fcc2dcc](https://github.com/thi-ng/umbrella/commit/fcc2dcc9624dc77e99dc69bd54c466ea0d1f3988))
79
- - **k-means:** import as new pkg ([a32aaf6](https://github.com/thi-ng/umbrella/commit/a32aaf63b703993adfb61766e36f9817aae1ed62))
112
+ - use dist metric in initKmeanspp() ([37bd6c6](https://github.com/thi-ng/umbrella/commit/37bd6c6))
113
+ - update to use user-provided distance metric
package/README.md CHANGED
@@ -51,7 +51,7 @@ node --experimental-repl-await
51
51
  > const kMeans = await import("@thi.ng/k-means");
52
52
  ```
53
53
 
54
- Package sizes (gzipped, pre-treeshake): ESM: 987 bytes
54
+ Package sizes (gzipped, pre-treeshake): ESM: 988 bytes
55
55
 
56
56
  ## Dependencies
57
57
 
package/package.json CHANGED
@@ -1,81 +1,86 @@
1
1
  {
2
- "name": "@thi.ng/k-means",
3
- "version": "0.4.8",
4
- "description": "Configurable k-means & k-medians (with k-means++ initialization) for n-D vectors",
5
- "type": "module",
6
- "module": "./index.js",
7
- "typings": "./index.d.ts",
8
- "sideEffects": false,
9
- "repository": {
10
- "type": "git",
11
- "url": "https://github.com/thi-ng/umbrella.git"
2
+ "name": "@thi.ng/k-means",
3
+ "version": "0.5.2",
4
+ "description": "Configurable k-means & k-medians (with k-means++ initialization) for n-D vectors",
5
+ "type": "module",
6
+ "module": "./index.js",
7
+ "typings": "./index.d.ts",
8
+ "sideEffects": false,
9
+ "repository": {
10
+ "type": "git",
11
+ "url": "https://github.com/thi-ng/umbrella.git"
12
+ },
13
+ "homepage": "https://github.com/thi-ng/umbrella/tree/master/packages/k-means#readme",
14
+ "funding": [
15
+ {
16
+ "type": "github",
17
+ "url": "https://github.com/sponsors/postspectacular"
12
18
  },
13
- "homepage": "https://github.com/thi-ng/umbrella/tree/master/packages/k-means#readme",
14
- "funding": [
15
- {
16
- "type": "github",
17
- "url": "https://github.com/sponsors/postspectacular"
18
- },
19
- {
20
- "type": "patreon",
21
- "url": "https://patreon.com/thing_umbrella"
22
- }
23
- ],
24
- "author": "Karsten Schmidt <k+npm@thi.ng>",
25
- "license": "Apache-2.0",
26
- "scripts": {
27
- "build": "yarn clean && tsc --declaration",
28
- "clean": "rimraf *.js *.d.ts *.map doc",
29
- "doc": "typedoc --excludePrivate --excludeInternal --out doc src/index.ts",
30
- "doc:ae": "mkdir -p .ae/doc .ae/temp && node_modules/.bin/api-extractor run --local --verbose",
31
- "doc:readme": "yarn doc:stats && ../../scripts/node-esm ../../tools/src/readme.ts",
32
- "doc:stats": "../../scripts/node-esm ../../tools/src/module-stats.ts",
33
- "pub": "yarn build && yarn publish --access public",
34
- "test": "testament test"
19
+ {
20
+ "type": "patreon",
21
+ "url": "https://patreon.com/thing_umbrella"
22
+ }
23
+ ],
24
+ "author": "Karsten Schmidt <k+npm@thi.ng>",
25
+ "license": "Apache-2.0",
26
+ "scripts": {
27
+ "build": "yarn clean && tsc --declaration",
28
+ "clean": "rimraf '*.js' '*.d.ts' '*.map' doc",
29
+ "doc": "typedoc --excludePrivate --excludeInternal --out doc src/index.ts",
30
+ "doc:ae": "mkdir -p .ae/doc .ae/temp && api-extractor run --local --verbose",
31
+ "doc:readme": "yarn doc:stats && tools:readme",
32
+ "doc:stats": "tools:module-stats",
33
+ "pub": "yarn npm publish --access public",
34
+ "test": "testament test"
35
+ },
36
+ "dependencies": {
37
+ "@thi.ng/api": "^8.3.2",
38
+ "@thi.ng/distance": "^2.1.2",
39
+ "@thi.ng/errors": "^2.1.2",
40
+ "@thi.ng/random": "^3.2.2",
41
+ "@thi.ng/vectors": "^7.2.2"
42
+ },
43
+ "devDependencies": {
44
+ "@microsoft/api-extractor": "^7.18.19",
45
+ "@thi.ng/testament": "^0.2.2",
46
+ "rimraf": "^3.0.2",
47
+ "tools": "^0.0.1",
48
+ "typedoc": "^0.22.9",
49
+ "typescript": "^4.5.2"
50
+ },
51
+ "keywords": [
52
+ "cluster",
53
+ "distance",
54
+ "k-medians",
55
+ "k-means",
56
+ "k-means++",
57
+ "nd",
58
+ "typescript"
59
+ ],
60
+ "publishConfig": {
61
+ "access": "public"
62
+ },
63
+ "engines": {
64
+ "node": ">=12.7"
65
+ },
66
+ "files": [
67
+ "*.js",
68
+ "*.d.ts"
69
+ ],
70
+ "exports": {
71
+ ".": {
72
+ "import": "./index.js"
35
73
  },
36
- "dependencies": {
37
- "@thi.ng/api": "^8.1.0",
38
- "@thi.ng/distance": "^2.0.8",
39
- "@thi.ng/errors": "^2.0.6",
40
- "@thi.ng/random": "^3.1.3",
41
- "@thi.ng/vectors": "^7.1.0"
74
+ "./api": {
75
+ "import": "./api.js"
42
76
  },
43
- "devDependencies": {
44
- "@thi.ng/testament": "^0.1.6"
45
- },
46
- "keywords": [
47
- "cluster",
48
- "distance",
49
- "k-medians",
50
- "k-means",
51
- "k-means++",
52
- "nd",
53
- "typescript"
54
- ],
55
- "publishConfig": {
56
- "access": "public"
57
- },
58
- "engines": {
59
- "node": ">=12.7"
60
- },
61
- "files": [
62
- "*.js",
63
- "*.d.ts"
64
- ],
65
- "exports": {
66
- ".": {
67
- "import": "./index.js"
68
- },
69
- "./api": {
70
- "import": "./api.js"
71
- },
72
- "./kmeans": {
73
- "import": "./kmeans.js"
74
- }
75
- },
76
- "thi.ng": {
77
- "status": "beta",
78
- "year": 2021
79
- },
80
- "gitHead": "d6aca4b4edb697613ed6635b1c0b12f0bf27b1f0"
81
- }
77
+ "./kmeans": {
78
+ "import": "./kmeans.js"
79
+ }
80
+ },
81
+ "thi.ng": {
82
+ "status": "beta",
83
+ "year": 2021
84
+ },
85
+ "gitHead": "e8a7c2a40191b391cef182c2978e5a6c85987a87\n"
86
+ }