w-cluster 1.0.9 → 1.0.12
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/.jsdoc +1 -1
- package/LICENSE +1 -1
- package/README.md +53 -42
- package/dist/w-cluster.umd.js +2 -2
- package/dist/w-cluster.umd.js.map +1 -1
- package/dist/w-cluster.wk.umd.js +1 -1
- package/docs/WCluster.mjs.html +66 -56
- package/docs/examples/ex-PCA.html +1 -1
- package/docs/examples/{ex-cluster-webworker-k-medoids.html → ex-cluster-webworker.html} +12 -4
- package/docs/examples/{ex-cluster-k-means.html → ex-cluster.html} +11 -3
- package/docs/global.html +11 -6
- package/docs/index.html +1 -1
- package/examples/{ex-cluster-webworker-k-medoids.html → ex-cluster-webworker.html} +11 -3
- package/examples/{ex-cluster-k-means.html → ex-cluster.html} +10 -2
- package/g-PCA-nodeworker.mjs +22 -5
- package/g-PCA.mjs +22 -5
- package/g-cluster-nodeworker.mjs +20 -28
- package/g-cluster.mjs +20 -29
- package/package.json +3 -8
- package/src/WCluster.mjs +65 -55
- package/src/WClusterCore.mjs +14 -9
- package/src/WClusterMat.mjs +4 -3
- package/src/WPCAMat.mjs +33 -11
- package/test/PCA.test.mjs +4 -4
- package/test/cluster.test.mjs +54 -2
- package/docs/examples/ex-cluster-k-medoids.html +0 -138
- package/examples/ex-cluster-k-medoids.html +0 -138
- package/temp-bzmWVlF38ndGv0ip7atIxG1RSDXI39mk-nw.js +0 -1
package/.jsdoc
CHANGED
package/LICENSE
CHANGED
package/README.md
CHANGED
|
@@ -11,6 +11,15 @@ A tool for data PCA(Principle Component Analysis) and cluster(K-Means & K-Medoid
|
|
|
11
11
|
## Documentation
|
|
12
12
|
To view documentation or get support, visit [docs](https://yuda-lyu.github.io/w-cluster/global.html).
|
|
13
13
|
|
|
14
|
+
## Example
|
|
15
|
+
To view some examples for more understanding, visit examples:
|
|
16
|
+
|
|
17
|
+
> **PCA:** [ex-PCA.html](https://yuda-lyu.github.io/w-cluster/examples/ex-PCA.html) [[source code](https://github.com/yuda-lyu/w-cluster/blob/master/docs/examples/ex-PCA.html)]
|
|
18
|
+
|
|
19
|
+
> **cluster:** [ex-cluster.html](https://yuda-lyu.github.io/w-cluster/examples/ex-cluster.html) [[source code](https://github.com/yuda-lyu/w-cluster/blob/master/docs/examples/ex-cluster.html)]
|
|
20
|
+
|
|
21
|
+
> **cluster with web worker:** [ex-cluster-webworker.html](https://yuda-lyu.github.io/w-cluster/examples/ex-cluster-webworker.html) [[source code](https://github.com/yuda-lyu/w-cluster/blob/master/docs/examples/ex-cluster-webworker.html)] * WebWorkers(from blob) does not support IE11.
|
|
22
|
+
|
|
14
23
|
## Installation
|
|
15
24
|
### Using npm(ES6 module):
|
|
16
25
|
> **Note:** w-cluster is mainly dependent on `ml-pca`, `ml-kmeans` and `k-medoids`.
|
|
@@ -36,10 +45,28 @@ async function testPCA() {
|
|
|
36
45
|
let resMat = await WCluster.PCA(mat, { nCompNIPALS: 2 })
|
|
37
46
|
console.log(resMat)
|
|
38
47
|
// => [
|
|
39
|
-
//
|
|
40
|
-
//
|
|
41
|
-
//
|
|
42
|
-
//
|
|
48
|
+
// [ -22.27637140016484, -4.7649452046492735 ],
|
|
49
|
+
// [ -9.12778006150881, 12.303870466192656 ],
|
|
50
|
+
// [ 31.31672176507748, 0.2183960452169238 ],
|
|
51
|
+
// [ 0.08742969659617117, -7.757321306760306 ]
|
|
52
|
+
// ]
|
|
53
|
+
|
|
54
|
+
let mat2 = [
|
|
55
|
+
[1040, 50, 60],
|
|
56
|
+
[1050, 70, 60],
|
|
57
|
+
[1080, 70, 90],
|
|
58
|
+
[1050, 60, 80]
|
|
59
|
+
]
|
|
60
|
+
console.log('mat2', mat2)
|
|
61
|
+
// => mat [ [ 1040, 50, 60 ], [ 1050, 70, 60 ], [ 1080, 70, 90 ], [ 1050, 60, 80 ] ]
|
|
62
|
+
|
|
63
|
+
let resMat2 = await WCluster.PCA(mat2, { nCompNIPALS: 2 })
|
|
64
|
+
console.log(resMat2)
|
|
65
|
+
// => [
|
|
66
|
+
// [ -22.27637140016484, -4.7649452046492735 ],
|
|
67
|
+
// [ -9.12778006150881, 12.303870466192656 ],
|
|
68
|
+
// [ 31.31672176507748, 0.2183960452169238 ],
|
|
69
|
+
// [ 0.08742969659617117, -7.757321306760306 ]
|
|
43
70
|
// ]
|
|
44
71
|
|
|
45
72
|
}
|
|
@@ -74,24 +101,24 @@ async function testCluster() {
|
|
|
74
101
|
// [ 2 ],
|
|
75
102
|
// [ 0, 1, 3 ]
|
|
76
103
|
// ],
|
|
77
|
-
// "
|
|
104
|
+
// "gmat": [
|
|
78
105
|
// [
|
|
79
|
-
// [
|
|
106
|
+
// [ 31.31672176507748, 0.2183960452169238 ]
|
|
80
107
|
// ],
|
|
81
108
|
// [
|
|
82
|
-
// [
|
|
83
|
-
// [
|
|
84
|
-
// [
|
|
109
|
+
// [ -22.27637140016484, -4.7649452046492735 ],
|
|
110
|
+
// [ -9.12778006150881, 12.303870466192656 ],
|
|
111
|
+
// [ 0.08742969659617117, -7.757321306760306 ]
|
|
85
112
|
// ]
|
|
86
113
|
// ],
|
|
87
|
-
// "
|
|
114
|
+
// "gltdt": [
|
|
88
115
|
// [
|
|
89
|
-
// [
|
|
116
|
+
// [ 80, 70, 90 ]
|
|
90
117
|
// ],
|
|
91
118
|
// [
|
|
92
|
-
// [
|
|
93
|
-
// [ 50
|
|
94
|
-
// [
|
|
119
|
+
// [ 40, 50, 60 ],
|
|
120
|
+
// [ 50, 70, 60 ],
|
|
121
|
+
// [ 50, 60, 80 ]
|
|
95
122
|
// ]
|
|
96
123
|
// ]
|
|
97
124
|
// }
|
|
@@ -118,32 +145,24 @@ async function testCluster() {
|
|
|
118
145
|
// [ 2 ],
|
|
119
146
|
// [ 0, 1, 3 ]
|
|
120
147
|
// ],
|
|
121
|
-
// "
|
|
148
|
+
// "gmat": [
|
|
122
149
|
// [
|
|
123
|
-
//
|
|
124
|
-
// "name": "Paul", "a": 80, "b": 70, "c": 90
|
|
125
|
-
// }
|
|
150
|
+
// [ 31.31672176507748, 0.2183960452169238 ]
|
|
126
151
|
// ],
|
|
127
152
|
// [
|
|
128
|
-
//
|
|
129
|
-
//
|
|
130
|
-
//
|
|
131
|
-
// {
|
|
132
|
-
// "name": "Buckley", "a": 50, "b": 70, "c": 60
|
|
133
|
-
// },
|
|
134
|
-
// {
|
|
135
|
-
// "name": "Fawcett", "a": 50, "b": 60, "c": 80
|
|
136
|
-
// }
|
|
153
|
+
// [ -22.27637140016484, -4.7649452046492735 ],
|
|
154
|
+
// [ -9.12778006150881, 12.303870466192656 ],
|
|
155
|
+
// [ 0.08742969659617117, -7.757321306760306 ]
|
|
137
156
|
// ]
|
|
138
157
|
// ],
|
|
139
|
-
// "
|
|
158
|
+
// "gltdt": [
|
|
140
159
|
// [
|
|
141
|
-
//
|
|
160
|
+
// { "name": "Paul", "a": 80, "b": 70, "c": 90 }
|
|
142
161
|
// ],
|
|
143
162
|
// [
|
|
144
|
-
//
|
|
145
|
-
//
|
|
146
|
-
//
|
|
163
|
+
// { "name": "Cameron", "a": 40, "b": 50, "c": 60 },
|
|
164
|
+
// { "name": "Buckley", "a": 50, "b": 70, "c": 60 },
|
|
165
|
+
// { "name": "Fawcett", "a": 50, "b": 60, "c": 80 }
|
|
147
166
|
// ]
|
|
148
167
|
// ]
|
|
149
168
|
// }
|
|
@@ -163,17 +182,9 @@ testCluster()
|
|
|
163
182
|
```alias
|
|
164
183
|
|
|
165
184
|
<!-- for basic -->
|
|
166
|
-
<script src="https://cdn.jsdelivr.net/npm/w-cluster@1.0.
|
|
185
|
+
<script src="https://cdn.jsdelivr.net/npm/w-cluster@1.0.12/dist/w-cluster.umd.js"></script>
|
|
167
186
|
|
|
168
187
|
<!-- for web workers -->
|
|
169
|
-
<script src="https://cdn.jsdelivr.net/npm/w-cluster@1.0.
|
|
188
|
+
<script src="https://cdn.jsdelivr.net/npm/w-cluster@1.0.12/dist/w-cluster.wk.umd.js"></script>
|
|
170
189
|
|
|
171
190
|
```
|
|
172
|
-
|
|
173
|
-
> **PCA:** [ex-PCA.html](https://yuda-lyu.github.io/w-cluster/examples/ex-PCA.html) [[source code](https://github.com/yuda-lyu/w-cluster/blob/master/docs/examples/ex-PCA.html)]
|
|
174
|
-
|
|
175
|
-
> **cluster for k-means:** [ex-cluster-k-means.html](https://yuda-lyu.github.io/w-cluster/examples/ex-cluster-k-means.html) [[source code](https://github.com/yuda-lyu/w-cluster/blob/master/docs/examples/ex-cluster-k-means.html)]
|
|
176
|
-
|
|
177
|
-
> **cluster for k-medoids:** [ex-cluster-k-medoids.html](https://yuda-lyu.github.io/w-cluster/examples/ex-cluster-k-medoids.html) [[source code](https://github.com/yuda-lyu/w-cluster/blob/master/docs/examples/ex-cluster-k-medoids.html)]
|
|
178
|
-
|
|
179
|
-
> **cluster for k-medoids with web worker:** [ex-cluster-webworker-k-medoids.html](https://yuda-lyu.github.io/w-cluster/examples/ex-cluster-webworker-k-medoids.html) [[source code](https://github.com/yuda-lyu/w-cluster/blob/master/docs/examples/ex-cluster-webworker-k-medoids.html)] * WebWorkers(from blob) does not support IE11.
|