w-cluster 1.0.12 → 1.0.13

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/README.md CHANGED
@@ -45,10 +45,10 @@ async function testPCA() {
45
45
  let resMat = await WCluster.PCA(mat, { nCompNIPALS: 2 })
46
46
  console.log(resMat)
47
47
  // => [
48
- // [ -22.27637140016484, -4.7649452046492735 ],
49
- // [ -9.12778006150881, 12.303870466192656 ],
50
- // [ 31.31672176507748, 0.2183960452169238 ],
51
- // [ 0.08742969659617117, -7.757321306760306 ]
48
+ // [ -1.704002697669786, 0.43087564048799354 ],
49
+ // [ -0.2509699164590232, -1.1519035967558147 ],
50
+ // [ 1.9913098008410954, 0.23244503334983269 ],
51
+ // [ -0.03633718671228592, 0.48858292291798827 ]
52
52
  // ]
53
53
 
54
54
  let mat2 = [
@@ -63,10 +63,28 @@ async function testPCA() {
63
63
  let resMat2 = await WCluster.PCA(mat2, { nCompNIPALS: 2 })
64
64
  console.log(resMat2)
65
65
  // => [
66
- // [ -22.27637140016484, -4.7649452046492735 ],
67
- // [ -9.12778006150881, 12.303870466192656 ],
68
- // [ 31.31672176507748, 0.2183960452169238 ],
69
- // [ 0.08742969659617117, -7.757321306760306 ]
66
+ // [ -1.704002697669786, 0.43087564048799354 ],
67
+ // [ -0.2509699164590232, -1.1519035967558147 ],
68
+ // [ 1.9913098008410954, 0.23244503334983269 ],
69
+ // [ -0.03633718671228592, 0.48858292291798827 ]
70
+ // ]
71
+
72
+ let mat3 = [
73
+ [11040, 50, 60],
74
+ [13050, 70, 60],
75
+ [15080, 70, 90],
76
+ [17050, 60, 80]
77
+ ]
78
+ console.log('mat3', mat3)
79
+ // => mat [ [ 11040, 50, 60 ], [ 13050, 70, 60 ], [ 15080, 70, 90 ], [ 17050, 60, 80 ] ]
80
+
81
+ let resMat3 = await WCluster.PCA(mat3, { nCompNIPALS: 2 })
82
+ console.log(resMat3)
83
+ // => [
84
+ // [ -1.8599655569892897, 0.4908764271508211 ],
85
+ // [ -0.3950941652793108, -1.0977355294143445 ],
86
+ // [ 1.3430199944041517, -0.17213692267477554 ],
87
+ // [ 0.912039727864449, 0.778996024938299 ]
70
88
  // ]
71
89
 
72
90
  }
@@ -98,27 +116,105 @@ async function testCluster() {
98
116
  // => {
99
117
  // "keys": null,
100
118
  // "ginds": [
101
- // [ 2 ],
102
- // [ 0, 1, 3 ]
119
+ // [ 0, 1, 3 ],
120
+ // [ 2 ]
103
121
  // ],
104
122
  // "gmat": [
105
123
  // [
106
- // [ 31.31672176507748, 0.2183960452169238 ]
124
+ // [ -1.704002697669786, 0.43087564048799354 ],
125
+ // [ -0.2509699164590232, -1.1519035967558147 ],
126
+ // [ -0.03633718671228592, 0.48858292291798827 ]
107
127
  // ],
108
128
  // [
109
- // [ -22.27637140016484, -4.7649452046492735 ],
110
- // [ -9.12778006150881, 12.303870466192656 ],
111
- // [ 0.08742969659617117, -7.757321306760306 ]
129
+ // [ 1.9913098008410954, 0.23244503334983269 ]
112
130
  // ]
113
131
  // ],
114
132
  // "gltdt": [
115
133
  // [
116
- // [ 80, 70, 90 ]
117
- // ],
118
- // [
119
134
  // [ 40, 50, 60 ],
120
135
  // [ 50, 70, 60 ],
121
136
  // [ 50, 60, 80 ]
137
+ // ],
138
+ // [
139
+ // [ 80, 70, 90 ]
140
+ // ]
141
+ // ]
142
+ // }
143
+
144
+ let mat2 = [
145
+ [1040, 50, 60],
146
+ [1050, 70, 60],
147
+ [1080, 70, 90],
148
+ [1050, 60, 80]
149
+ ]
150
+ console.log('mat2', mat2)
151
+ // => mat [ [ 1040, 50, 60 ], [ 1050, 70, 60 ], [ 1080, 70, 90 ], [ 1050, 60, 80 ] ]
152
+
153
+ let resMat2 = await WCluster.cluster(mat2, { mode, kNumber: 2, nCompNIPALS: 2 })
154
+ console.log(JSON.stringify(resMat2, null, 2))
155
+ // => {
156
+ // "keys": null,
157
+ // "ginds": [
158
+ // [ 0, 1, 3 ],
159
+ // [ 2 ]
160
+ // ],
161
+ // "gmat": [
162
+ // [
163
+ // [ -1.704002697669786, 0.43087564048799354 ],
164
+ // [ -0.2509699164590232, -1.1519035967558147 ],
165
+ // [ -0.03633718671228592, 0.48858292291798827 ]
166
+ // ],
167
+ // [
168
+ // [ 1.9913098008410954, 0.23244503334983269 ]
169
+ // ]
170
+ // ],
171
+ // "gltdt": [
172
+ // [
173
+ // [ 1040, 50, 60 ],
174
+ // [ 1050, 70, 60 ],
175
+ // [ 1050, 60, 80 ]
176
+ // ],
177
+ // [
178
+ // [ 1080, 70, 90 ]
179
+ // ]
180
+ // ]
181
+ // }
182
+
183
+ let mat3 = [
184
+ [11040, 50, 60],
185
+ [13050, 70, 60],
186
+ [15080, 70, 90],
187
+ [17050, 60, 80]
188
+ ]
189
+ console.log('mat3', mat3)
190
+ // => mat [ [ 11040, 50, 60 ], [ 13050, 70, 60 ], [ 15080, 70, 90 ], [ 17050, 60, 80 ] ]
191
+
192
+ let resMat3 = await WCluster.cluster(mat3, { mode, kNumber: 2, nCompNIPALS: 2 })
193
+ console.log(JSON.stringify(resMat3, null, 2))
194
+ // => {
195
+ // "keys": null,
196
+ // "ginds": [
197
+ // [ 1, 2, 3 ],
198
+ // [ 0 ]
199
+ // ],
200
+ // "gmat": [
201
+ // [
202
+ // [ -0.3950941652793108, -1.0977355294143445 ],
203
+ // [ 1.3430199944041517, -0.17213692267477554 ],
204
+ // [ 0.912039727864449, 0.778996024938299 ]
205
+ // ],
206
+ // [
207
+ // [ -1.8599655569892897, 0.4908764271508211 ]
208
+ // ]
209
+ // ],
210
+ // "gltdt": [
211
+ // [
212
+ // [ 13050, 70, 60 ],
213
+ // [ 15080, 70, 90 ],
214
+ // [ 17050, 60, 80 ]
215
+ // ],
216
+ // [
217
+ // [ 11040, 50, 60 ]
122
218
  // ]
123
219
  // ]
124
220
  // }
@@ -142,27 +238,27 @@ async function testCluster() {
142
238
  // => {
143
239
  // "keys": [ "a", "b", "c" ],
144
240
  // "ginds": [
145
- // [ 2 ],
146
- // [ 0, 1, 3 ]
241
+ // [ 0, 1, 3 ],
242
+ // [ 2 ]
147
243
  // ],
148
244
  // "gmat": [
149
245
  // [
150
- // [ 31.31672176507748, 0.2183960452169238 ]
246
+ // [ -1.704002697669786, 0.43087564048799354 ],
247
+ // [ -0.2509699164590232, -1.1519035967558147 ],
248
+ // [ -0.03633718671228592, 0.48858292291798827 ]
151
249
  // ],
152
250
  // [
153
- // [ -22.27637140016484, -4.7649452046492735 ],
154
- // [ -9.12778006150881, 12.303870466192656 ],
155
- // [ 0.08742969659617117, -7.757321306760306 ]
251
+ // [ 1.9913098008410954, 0.23244503334983269 ]
156
252
  // ]
157
253
  // ],
158
254
  // "gltdt": [
159
255
  // [
160
- // { "name": "Paul", "a": 80, "b": 70, "c": 90 }
161
- // ],
162
- // [
163
256
  // { "name": "Cameron", "a": 40, "b": 50, "c": 60 },
164
257
  // { "name": "Buckley", "a": 50, "b": 70, "c": 60 },
165
258
  // { "name": "Fawcett", "a": 50, "b": 60, "c": 80 }
259
+ // ],
260
+ // [
261
+ // { "name": "Paul", "a": 80, "b": 70, "c": 90 }
166
262
  // ]
167
263
  // ]
168
264
  // }
@@ -182,9 +278,9 @@ testCluster()
182
278
  ```alias
183
279
 
184
280
  <!-- for basic -->
185
- <script src="https://cdn.jsdelivr.net/npm/w-cluster@1.0.12/dist/w-cluster.umd.js"></script>
281
+ <script src="https://cdn.jsdelivr.net/npm/w-cluster@1.0.13/dist/w-cluster.umd.js"></script>
186
282
 
187
283
  <!-- for web workers -->
188
- <script src="https://cdn.jsdelivr.net/npm/w-cluster@1.0.12/dist/w-cluster.wk.umd.js"></script>
284
+ <script src="https://cdn.jsdelivr.net/npm/w-cluster@1.0.13/dist/w-cluster.wk.umd.js"></script>
189
285
 
190
286
  ```