w-cluster 1.0.13 → 1.0.15
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/.eslintrc.js +17 -17
- package/README.md +2 -2
- package/babel.config.js +1 -0
- package/docs/WCluster.mjs.html +5 -2
- package/docs/examples/ex-PCA.html +1 -1
- package/docs/examples/ex-cluster-webworker.html +1 -1
- package/docs/examples/ex-cluster.html +1 -1
- package/docs/global.html +93 -76
- package/docs/index.html +5 -2
- package/docs/scripts/collapse.js +19 -0
- package/docs/scripts/commonNav.js +28 -0
- package/docs/scripts/search.js +16 -0
- package/docs/styles/jsdoc.css +13 -2
- package/docs/styles/prettify.css +1 -0
- package/package.json +5 -5
- package/dist/w-cluster.umd.js +0 -7
- package/dist/w-cluster.umd.js.map +0 -1
- package/dist/w-cluster.wk.umd.js +0 -1
package/docs/global.html
CHANGED
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
<link type="text/css" rel="stylesheet" href="styles/prettify.css">
|
|
15
15
|
<link type="text/css" rel="stylesheet" href="styles/jsdoc.css">
|
|
16
16
|
<script src="scripts/nav.js" defer></script>
|
|
17
|
+
|
|
17
18
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
18
19
|
</head>
|
|
19
20
|
<body>
|
|
@@ -27,7 +28,9 @@
|
|
|
27
28
|
|
|
28
29
|
<nav >
|
|
29
30
|
|
|
30
|
-
|
|
31
|
+
|
|
32
|
+
<h2><a href="index.html">Home</a></h2><h3>Global</h3><ul><li><a href="global.html#PCA">PCA</a></li><li><a href="global.html#WCluster">WCluster</a></li><li><a href="global.html#cluster">cluster</a></li></ul>
|
|
33
|
+
|
|
31
34
|
</nav>
|
|
32
35
|
|
|
33
36
|
<div id="main">
|
|
@@ -46,6 +49,8 @@
|
|
|
46
49
|
|
|
47
50
|
<h2>
|
|
48
51
|
|
|
52
|
+
|
|
53
|
+
|
|
49
54
|
</h2>
|
|
50
55
|
|
|
51
56
|
|
|
@@ -58,6 +63,7 @@
|
|
|
58
63
|
|
|
59
64
|
|
|
60
65
|
<dl class="details">
|
|
66
|
+
|
|
61
67
|
|
|
62
68
|
|
|
63
69
|
|
|
@@ -126,6 +132,10 @@
|
|
|
126
132
|
|
|
127
133
|
|
|
128
134
|
<dl class="details">
|
|
135
|
+
|
|
136
|
+
<dt class="tag-description">Description:</dt>
|
|
137
|
+
<dd class="tag-description"><ul class="dummy"><li><p>數據主成份分析與分群</p></li></ul></dd>
|
|
138
|
+
|
|
129
139
|
|
|
130
140
|
|
|
131
141
|
<dt class="tag-source">Source:</dt>
|
|
@@ -179,7 +189,7 @@
|
|
|
179
189
|
|
|
180
190
|
|
|
181
191
|
|
|
182
|
-
<h5>Example</h5>
|
|
192
|
+
<h5 class="h5-examples">Example</h5>
|
|
183
193
|
|
|
184
194
|
<pre class="prettyprint"><code>async function testPCA() {
|
|
185
195
|
let mat = [
|
|
186
196
|
[40, 50, 60],
|
|
187
197
|
[50, 70, 60],
|
|
188
198
|
[80, 70, 90],
|
|
189
199
|
[50, 60, 80]
|
|
190
200
|
]
|
|
191
201
|
console.log('mat', mat)
|
|
192
202
|
// => mat [ [ 40, 50, 60 ], [ 50, 70, 60 ], [ 80, 70, 90 ], [ 50, 60, 80 ] ]
|
|
193
203
|
let resMat = await WCluster.PCA(mat, { nCompNIPALS: 2 })
|
|
194
204
|
console.log(resMat)
|
|
195
205
|
// => [
|
|
196
206
|
// [ -1.704002697669786, 0.43087564048799354 ],
|
|
197
207
|
// [ -0.2509699164590232, -1.1519035967558147 ],
|
|
198
208
|
// [ 1.9913098008410954, 0.23244503334983269 ],
|
|
199
209
|
// [ -0.03633718671228592, 0.48858292291798827 ]
|
|
200
210
|
// ]
|
|
201
211
|
let mat2 = [
|
|
202
212
|
[1040, 50, 60],
|
|
203
213
|
[1050, 70, 60],
|
|
204
214
|
[1080, 70, 90],
|
|
205
215
|
[1050, 60, 80]
|
|
206
216
|
]
|
|
207
217
|
console.log('mat2', mat2)
|
|
208
218
|
// => mat [ [ 1040, 50, 60 ], [ 1050, 70, 60 ], [ 1080, 70, 90 ], [ 1050, 60, 80 ] ]
|
|
209
219
|
let resMat2 = await WCluster.PCA(mat2, { nCompNIPALS: 2 })
|
|
210
220
|
console.log(resMat2)
|
|
211
221
|
// => [
|
|
212
222
|
// [ -1.704002697669786, 0.43087564048799354 ],
|
|
213
223
|
// [ -0.2509699164590232, -1.1519035967558147 ],
|
|
214
224
|
// [ 1.9913098008410954, 0.23244503334983269 ],
|
|
215
225
|
// [ -0.03633718671228592, 0.48858292291798827 ]
|
|
216
226
|
// ]
|
|
217
227
|
let mat3 = [
|
|
218
228
|
[11040, 50, 60],
|
|
219
229
|
[13050, 70, 60],
|
|
220
230
|
[15080, 70, 90],
|
|
221
231
|
[17050, 60, 80]
|
|
222
232
|
]
|
|
223
233
|
console.log('mat3', mat3)
|
|
224
234
|
// => mat [ [ 11040, 50, 60 ], [ 13050, 70, 60 ], [ 15080, 70, 90 ], [ 17050, 60, 80 ] ]
|
|
225
235
|
let resMat3 = await WCluster.PCA(mat3, { nCompNIPALS: 2 })
|
|
226
236
|
console.log(resMat3)
|
|
227
237
|
// => [
|
|
228
238
|
// [ -1.8599655569892897, 0.4908764271508211 ],
|
|
229
239
|
// [ -0.3950941652793108, -1.0977355294143445 ],
|
|
230
240
|
// [ 1.3430199944041517, -0.17213692267477554 ],
|
|
231
241
|
// [ 0.912039727864449, 0.778996024938299 ]
|
|
232
242
|
// ]
|
|
233
243
|
.catch((err) => {
|
|
234
244
|
console.log(err)
|
|
235
245
|
})
|
|
236
246
|
let mode = 'k-medoids'
|
|
237
247
|
let mat = [
|
|
238
248
|
[40, 50, 60],
|
|
239
249
|
[50, 70, 60],
|
|
240
250
|
[80, 70, 90],
|
|
241
251
|
[50, 60, 80]
|
|
242
252
|
]
|
|
243
253
|
console.log('mat', mat)
|
|
244
254
|
// => mat [ [ 40, 50, 60 ], [ 50, 70, 60 ], [ 80, 70, 90 ], [ 50, 60, 80 ] ]
|
|
245
255
|
let resMat = await WCluster.cluster(mat, { mode, kNumber: 2, nCompNIPALS: 2 })
|
|
246
256
|
console.log(JSON.stringify(resMat, null, 2))
|
|
247
257
|
// => {
|
|
248
258
|
// "keys": null,
|
|
249
259
|
// "ginds": [
|
|
250
260
|
// [ 0, 1, 3 ],
|
|
251
261
|
// [ 2 ]
|
|
252
262
|
// ],
|
|
253
263
|
// "gmat": [
|
|
254
264
|
// [
|
|
255
265
|
// [ -1.704002697669786, 0.43087564048799354 ],
|
|
256
266
|
// [ -0.2509699164590232, -1.1519035967558147 ],
|
|
257
267
|
// [ -0.03633718671228592, 0.48858292291798827 ]
|
|
258
268
|
// ],
|
|
259
269
|
// [
|
|
260
270
|
// [ 1.9913098008410954, 0.23244503334983269 ]
|
|
261
271
|
// ]
|
|
262
272
|
// ],
|
|
263
273
|
// "gltdt": [
|
|
264
274
|
// [
|
|
265
275
|
// [ 40, 50, 60 ],
|
|
266
276
|
// [ 50, 70, 60 ],
|
|
267
277
|
// [ 50, 60, 80 ]
|
|
268
278
|
// ],
|
|
269
279
|
// [
|
|
270
280
|
// [ 80, 70, 90 ]
|
|
271
281
|
// ]
|
|
272
282
|
// ]
|
|
273
283
|
// }
|
|
274
284
|
let mat2 = [
|
|
275
285
|
[1040, 50, 60],
|
|
276
286
|
[1050, 70, 60],
|
|
277
287
|
[1080, 70, 90],
|
|
278
288
|
[1050, 60, 80]
|
|
279
289
|
]
|
|
280
290
|
console.log('mat2', mat2)
|
|
281
291
|
// => mat [ [ 1040, 50, 60 ], [ 1050, 70, 60 ], [ 1080, 70, 90 ], [ 1050, 60, 80 ] ]
|
|
282
292
|
let resMat2 = await WCluster.cluster(mat2, { mode, kNumber: 2, nCompNIPALS: 2 })
|
|
283
293
|
console.log(JSON.stringify(resMat2, null, 2))
|
|
284
294
|
// => {
|
|
285
295
|
// "keys": null,
|
|
286
296
|
// "ginds": [
|
|
287
297
|
// [ 0, 1, 3 ],
|
|
288
298
|
// [ 2 ]
|
|
289
299
|
// ],
|
|
290
300
|
// "gmat": [
|
|
291
301
|
// [
|
|
292
302
|
// [ -1.704002697669786, 0.43087564048799354 ],
|
|
293
303
|
// [ -0.2509699164590232, -1.1519035967558147 ],
|
|
294
304
|
// [ -0.03633718671228592, 0.48858292291798827 ]
|
|
295
305
|
// ],
|
|
296
306
|
// [
|
|
297
307
|
// [ 1.9913098008410954, 0.23244503334983269 ]
|
|
298
308
|
// ]
|
|
299
309
|
// ],
|
|
300
310
|
// "gltdt": [
|
|
301
311
|
// [
|
|
302
312
|
// [ 1040, 50, 60 ],
|
|
303
313
|
// [ 1050, 70, 60 ],
|
|
304
314
|
// [ 1050, 60, 80 ]
|
|
305
315
|
// ],
|
|
306
316
|
// [
|
|
307
317
|
// [ 1080, 70, 90 ]
|
|
308
318
|
// ]
|
|
309
319
|
// ]
|
|
310
320
|
// }
|
|
311
321
|
let mat3 = [
|
|
312
322
|
[11040, 50, 60],
|
|
313
323
|
[13050, 70, 60],
|
|
314
324
|
[15080, 70, 90],
|
|
315
325
|
[17050, 60, 80]
|
|
316
326
|
]
|
|
317
327
|
console.log('mat3', mat3)
|
|
318
328
|
// => mat [ [ 11040, 50, 60 ], [ 13050, 70, 60 ], [ 15080, 70, 90 ], [ 17050, 60, 80 ] ]
|
|
319
329
|
let resMat3 = await WCluster.cluster(mat3, { mode, kNumber: 2, nCompNIPALS: 2 })
|
|
320
330
|
console.log(JSON.stringify(resMat3, null, 2))
|
|
321
331
|
// => {
|
|
322
332
|
// "keys": null,
|
|
323
333
|
// "ginds": [
|
|
324
334
|
// [ 1, 2, 3 ],
|
|
325
335
|
// [ 0 ]
|
|
326
336
|
// ],
|
|
327
337
|
// "gmat": [
|
|
328
338
|
// [
|
|
329
339
|
// [ -0.3950941652793108, -1.0977355294143445 ],
|
|
330
340
|
// [ 1.3430199944041517, -0.17213692267477554 ],
|
|
331
341
|
// [ 0.912039727864449, 0.778996024938299 ]
|
|
332
342
|
// ],
|
|
333
343
|
// [
|
|
334
344
|
// [ -1.8599655569892897, 0.4908764271508211 ]
|
|
335
345
|
// ]
|
|
336
346
|
// ],
|
|
337
347
|
// "gltdt": [
|
|
338
348
|
// [
|
|
339
349
|
// [ 13050, 70, 60 ],
|
|
340
350
|
// [ 15080, 70, 90 ],
|
|
341
351
|
// [ 17050, 60, 80 ]
|
|
342
352
|
// ],
|
|
343
353
|
// [
|
|
344
354
|
// [ 11040, 50, 60 ]
|
|
345
355
|
// ]
|
|
346
356
|
// ]
|
|
347
357
|
// }
|
|
348
358
|
let ltdt = [
|
|
349
359
|
{ name: 'Cameron', a: 40, b: 50, c: 60 },
|
|
350
360
|
{ name: 'Buckley', a: 50, b: 70, c: 60 },
|
|
351
361
|
{ name: 'Paul', a: 80, b: 70, c: 90 },
|
|
352
362
|
{ name: 'Fawcett', a: 50, b: 60, c: 80 },
|
|
353
363
|
]
|
|
354
364
|
console.log('ltdt', ltdt)
|
|
355
365
|
// => ltdt [
|
|
356
366
|
// { name: 'Cameron', a: 40, b: 50, c: 60 },
|
|
357
367
|
// { name: 'Buckley', a: 50, b: 70, c: 60 },
|
|
358
368
|
// { name: 'Paul', a: 80, b: 70, c: 90 },
|
|
359
369
|
// { name: 'Fawcett', a: 50, b: 60, c: 80 }
|
|
360
370
|
// ]
|
|
361
371
|
let resLtdt = await WCluster.cluster(ltdt, { mode, kNumber: 2, nCompNIPALS: 2 })
|
|
362
372
|
console.log(JSON.stringify(resLtdt, null, 2))
|
|
363
373
|
// => {
|
|
364
374
|
// "keys": [ "a", "b", "c" ],
|
|
365
375
|
// "ginds": [
|
|
366
376
|
// [ 0, 1, 3 ],
|
|
367
377
|
// [ 2 ]
|
|
368
378
|
// ],
|
|
369
379
|
// "gmat": [
|
|
370
380
|
// [
|
|
371
381
|
// [ -1.704002697669786, 0.43087564048799354 ],
|
|
372
382
|
// [ -0.2509699164590232, -1.1519035967558147 ],
|
|
373
383
|
// [ -0.03633718671228592, 0.48858292291798827 ]
|
|
374
384
|
// ],
|
|
375
385
|
// [
|
|
376
386
|
// [ 1.9913098008410954, 0.23244503334983269 ]
|
|
377
387
|
// ]
|
|
378
388
|
// ],
|
|
379
389
|
// "gltdt": [
|
|
380
390
|
// [
|
|
381
391
|
// { "name": "Cameron", "a": 40, "b": 50, "c": 60 },
|
|
382
392
|
// { "name": "Buckley", "a": 50, "b": 70, "c": 60 },
|
|
383
393
|
// { "name": "Fawcett", "a": 50, "b": 60, "c": 80 }
|
|
384
394
|
// ],
|
|
385
395
|
// [
|
|
386
396
|
// { "name": "Paul", "a": 80, "b": 70, "c": 90 }
|
|
387
397
|
// ]
|
|
388
398
|
// ]
|
|
389
399
|
// }
|
|
390
400
|
.catch((err) => {
|
|
391
401
|
console.log(err)
|
|
392
402
|
})</code></pre>
|
|
393
403
|
|
|
@@ -196,7 +206,7 @@
|
|
|
196
206
|
|
|
197
207
|
|
|
198
208
|
|
|
199
|
-
<h4 class="name" id="
|
|
209
|
+
<h4 class="name" id="PCA"><span class="type-signature type-signature-async">(async) </span>PCA<span class="signature">(data, opt<span class="signature-attributes">opt</span>)</span><span class="type-signature"> → {Promise}</span></h4>
|
|
200
210
|
|
|
201
211
|
|
|
202
212
|
|
|
@@ -204,11 +214,15 @@
|
|
|
204
214
|
|
|
205
215
|
|
|
206
216
|
<dl class="details">
|
|
217
|
+
|
|
218
|
+
<dt class="tag-description">Description:</dt>
|
|
219
|
+
<dd class="tag-description"><ul class="dummy"><li><p>數據主成分分析(Principal Component Analysis, PCA)</p></li></ul></dd>
|
|
220
|
+
|
|
207
221
|
|
|
208
222
|
|
|
209
223
|
<dt class="tag-source">Source:</dt>
|
|
210
224
|
<dd class="tag-source"><ul class="dummy"><li>
|
|
211
|
-
<a href="WCluster.mjs.html">WCluster.mjs</a>, <a href="WCluster.mjs.html#
|
|
225
|
+
<a href="WCluster.mjs.html">WCluster.mjs</a>, <a href="WCluster.mjs.html#line15">line 15</a>
|
|
212
226
|
</li></ul></dd>
|
|
213
227
|
|
|
214
228
|
|
|
@@ -247,26 +261,20 @@
|
|
|
247
261
|
|
|
248
262
|
|
|
249
263
|
|
|
250
|
-
<div class="description usertext">
|
|
251
|
-
<p>針對數據陣列做分群</p>
|
|
252
|
-
</div>
|
|
253
264
|
|
|
254
265
|
|
|
255
266
|
|
|
256
267
|
|
|
257
268
|
|
|
258
269
|
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
<h5>Example</h5>
|
|
270
|
+
<h5 class="h5-examples">Example</h5>
|
|
263
271
|
|
|
264
272
|
<pre class="prettyprint"><code></code></pre>
|
|
265
273
|
|
|
266
274
|
|
|
267
275
|
|
|
268
276
|
|
|
269
|
-
<h5>Parameters:</h5>
|
|
277
|
+
<h5 class="h5-parameters">Parameters:</h5>
|
|
270
278
|
|
|
271
279
|
|
|
272
280
|
<table class="params">
|
|
@@ -304,6 +312,7 @@
|
|
|
304
312
|
<span class="param-type">Array</span>
|
|
305
313
|
|
|
306
314
|
|
|
315
|
+
|
|
307
316
|
|
|
308
317
|
</td>
|
|
309
318
|
|
|
@@ -323,7 +332,7 @@
|
|
|
323
332
|
</td>
|
|
324
333
|
|
|
325
334
|
|
|
326
|
-
<td class="description last"><p
|
|
335
|
+
<td class="description last"><p>輸入數據陣列</p></td>
|
|
327
336
|
</tr>
|
|
328
337
|
|
|
329
338
|
|
|
@@ -339,6 +348,7 @@
|
|
|
339
348
|
<span class="param-type">Object</span>
|
|
340
349
|
|
|
341
350
|
|
|
351
|
+
|
|
342
352
|
|
|
343
353
|
</td>
|
|
344
354
|
|
|
@@ -392,13 +402,14 @@
|
|
|
392
402
|
|
|
393
403
|
<tr>
|
|
394
404
|
|
|
395
|
-
<td class="name"><code>
|
|
405
|
+
<td class="name"><code>scale</code></td>
|
|
396
406
|
|
|
397
407
|
|
|
398
408
|
<td class="type">
|
|
399
409
|
|
|
400
410
|
|
|
401
|
-
<span class="param-type">
|
|
411
|
+
<span class="param-type">Boolean</span>
|
|
412
|
+
|
|
402
413
|
|
|
403
414
|
|
|
404
415
|
|
|
@@ -419,12 +430,12 @@
|
|
|
419
430
|
|
|
420
431
|
<td class="default">
|
|
421
432
|
|
|
422
|
-
<code>
|
|
433
|
+
<code>true</code>
|
|
423
434
|
|
|
424
435
|
</td>
|
|
425
436
|
|
|
426
437
|
|
|
427
|
-
<td class="description last"><p
|
|
438
|
+
<td class="description last"><p>輸入是否對數據正規化布林值,預設true</p></td>
|
|
428
439
|
</tr>
|
|
429
440
|
|
|
430
441
|
|
|
@@ -440,6 +451,7 @@
|
|
|
440
451
|
<span class="param-type">Number</span>
|
|
441
452
|
|
|
442
453
|
|
|
454
|
+
|
|
443
455
|
|
|
444
456
|
</td>
|
|
445
457
|
|
|
@@ -467,45 +479,6 @@
|
|
|
467
479
|
</tr>
|
|
468
480
|
|
|
469
481
|
|
|
470
|
-
|
|
471
|
-
<tr>
|
|
472
|
-
|
|
473
|
-
<td class="name"><code>mode</code></td>
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
<td class="type">
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
<span class="param-type">String</span>
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
</td>
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
<td class="attributes">
|
|
487
|
-
|
|
488
|
-
<optional><br>
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
</td>
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
<td class="default">
|
|
499
|
-
|
|
500
|
-
<code>'k-medoids'</code>
|
|
501
|
-
|
|
502
|
-
</td>
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
<td class="description last"><p>輸入分群方法字串,可為'k-means'、'k-medoids',k-means受初始隨機群中心影響較大,預設'k-medoids'</p></td>
|
|
506
|
-
</tr>
|
|
507
|
-
|
|
508
|
-
|
|
509
482
|
</tbody>
|
|
510
483
|
</table>
|
|
511
484
|
|
|
@@ -531,11 +504,11 @@
|
|
|
531
504
|
|
|
532
505
|
|
|
533
506
|
|
|
534
|
-
<h5>Returns:</h5>
|
|
507
|
+
<h5 class="h5-returns">Returns:</h5>
|
|
535
508
|
|
|
536
509
|
|
|
537
510
|
<div class="param-desc">
|
|
538
|
-
<p>回傳Promise,resolve
|
|
511
|
+
<p>回傳Promise,resolve回傳指定維數數值的陣列,reject回傳錯誤訊息</p>
|
|
539
512
|
</div>
|
|
540
513
|
|
|
541
514
|
|
|
@@ -549,6 +522,7 @@
|
|
|
549
522
|
<span class="param-type">Promise</span>
|
|
550
523
|
|
|
551
524
|
|
|
525
|
+
|
|
552
526
|
</dd>
|
|
553
527
|
</dl>
|
|
554
528
|
|
|
@@ -561,7 +535,7 @@
|
|
|
561
535
|
|
|
562
536
|
|
|
563
537
|
|
|
564
|
-
<h4 class="name" id="
|
|
538
|
+
<h4 class="name" id="cluster"><span class="type-signature type-signature-async">(async) </span>cluster<span class="signature">(data, opt<span class="signature-attributes">opt</span>)</span><span class="type-signature"> → {Promise}</span></h4>
|
|
565
539
|
|
|
566
540
|
|
|
567
541
|
|
|
@@ -569,11 +543,15 @@
|
|
|
569
543
|
|
|
570
544
|
|
|
571
545
|
<dl class="details">
|
|
546
|
+
|
|
547
|
+
<dt class="tag-description">Description:</dt>
|
|
548
|
+
<dd class="tag-description"><ul class="dummy"><li><p>針對數據陣列做分群</p></li></ul></dd>
|
|
549
|
+
|
|
572
550
|
|
|
573
551
|
|
|
574
552
|
<dt class="tag-source">Source:</dt>
|
|
575
553
|
<dd class="tag-source"><ul class="dummy"><li>
|
|
576
|
-
<a href="WCluster.mjs.html">WCluster.mjs</a>, <a href="WCluster.mjs.html#
|
|
554
|
+
<a href="WCluster.mjs.html">WCluster.mjs</a>, <a href="WCluster.mjs.html#line31">line 31</a>
|
|
577
555
|
</li></ul></dd>
|
|
578
556
|
|
|
579
557
|
|
|
@@ -612,26 +590,20 @@
|
|
|
612
590
|
|
|
613
591
|
|
|
614
592
|
|
|
615
|
-
<div class="description usertext">
|
|
616
|
-
<p>數據主成分分析(Principal Component Analysis, PCA)</p>
|
|
617
|
-
</div>
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
593
|
|
|
622
594
|
|
|
623
595
|
|
|
624
596
|
|
|
625
597
|
|
|
626
598
|
|
|
627
|
-
<h5>Example</h5>
|
|
599
|
+
<h5 class="h5-examples">Example</h5>
|
|
628
600
|
|
|
629
601
|
<pre class="prettyprint"><code></code></pre>
|
|
630
602
|
|
|
631
603
|
|
|
632
604
|
|
|
633
605
|
|
|
634
|
-
<h5>Parameters:</h5>
|
|
606
|
+
<h5 class="h5-parameters">Parameters:</h5>
|
|
635
607
|
|
|
636
608
|
|
|
637
609
|
<table class="params">
|
|
@@ -669,6 +641,7 @@
|
|
|
669
641
|
<span class="param-type">Array</span>
|
|
670
642
|
|
|
671
643
|
|
|
644
|
+
|
|
672
645
|
|
|
673
646
|
</td>
|
|
674
647
|
|
|
@@ -688,7 +661,7 @@
|
|
|
688
661
|
</td>
|
|
689
662
|
|
|
690
663
|
|
|
691
|
-
<td class="description last"><p
|
|
664
|
+
<td class="description last"><p>輸入數據陣列,可輸入純數據陣列(mat)或物件陣列(ltdt)</p></td>
|
|
692
665
|
</tr>
|
|
693
666
|
|
|
694
667
|
|
|
@@ -704,6 +677,7 @@
|
|
|
704
677
|
<span class="param-type">Object</span>
|
|
705
678
|
|
|
706
679
|
|
|
680
|
+
|
|
707
681
|
|
|
708
682
|
</td>
|
|
709
683
|
|
|
@@ -757,13 +731,14 @@
|
|
|
757
731
|
|
|
758
732
|
<tr>
|
|
759
733
|
|
|
760
|
-
<td class="name"><code>
|
|
734
|
+
<td class="name"><code>kNumber</code></td>
|
|
761
735
|
|
|
762
736
|
|
|
763
737
|
<td class="type">
|
|
764
738
|
|
|
765
739
|
|
|
766
|
-
<span class="param-type">
|
|
740
|
+
<span class="param-type">Number</span>
|
|
741
|
+
|
|
767
742
|
|
|
768
743
|
|
|
769
744
|
|
|
@@ -784,12 +759,12 @@
|
|
|
784
759
|
|
|
785
760
|
<td class="default">
|
|
786
761
|
|
|
787
|
-
<code>
|
|
762
|
+
<code>2</code>
|
|
788
763
|
|
|
789
764
|
</td>
|
|
790
765
|
|
|
791
766
|
|
|
792
|
-
<td class="description last"><p
|
|
767
|
+
<td class="description last"><p>輸入指定分群數整數,不能超過數據的長度,預設2</p></td>
|
|
793
768
|
</tr>
|
|
794
769
|
|
|
795
770
|
|
|
@@ -805,6 +780,7 @@
|
|
|
805
780
|
<span class="param-type">Number</span>
|
|
806
781
|
|
|
807
782
|
|
|
783
|
+
|
|
808
784
|
|
|
809
785
|
</td>
|
|
810
786
|
|
|
@@ -832,6 +808,46 @@
|
|
|
832
808
|
</tr>
|
|
833
809
|
|
|
834
810
|
|
|
811
|
+
|
|
812
|
+
<tr>
|
|
813
|
+
|
|
814
|
+
<td class="name"><code>mode</code></td>
|
|
815
|
+
|
|
816
|
+
|
|
817
|
+
<td class="type">
|
|
818
|
+
|
|
819
|
+
|
|
820
|
+
<span class="param-type">String</span>
|
|
821
|
+
|
|
822
|
+
|
|
823
|
+
|
|
824
|
+
|
|
825
|
+
</td>
|
|
826
|
+
|
|
827
|
+
|
|
828
|
+
<td class="attributes">
|
|
829
|
+
|
|
830
|
+
<optional><br>
|
|
831
|
+
|
|
832
|
+
|
|
833
|
+
|
|
834
|
+
|
|
835
|
+
|
|
836
|
+
</td>
|
|
837
|
+
|
|
838
|
+
|
|
839
|
+
|
|
840
|
+
<td class="default">
|
|
841
|
+
|
|
842
|
+
<code>'k-medoids'</code>
|
|
843
|
+
|
|
844
|
+
</td>
|
|
845
|
+
|
|
846
|
+
|
|
847
|
+
<td class="description last"><p>輸入分群方法字串,可為'k-means'、'k-medoids',k-means受初始隨機群中心影響較大,預設'k-medoids'</p></td>
|
|
848
|
+
</tr>
|
|
849
|
+
|
|
850
|
+
|
|
835
851
|
</tbody>
|
|
836
852
|
</table>
|
|
837
853
|
|
|
@@ -857,11 +873,11 @@
|
|
|
857
873
|
|
|
858
874
|
|
|
859
875
|
|
|
860
|
-
<h5>Returns:</h5>
|
|
876
|
+
<h5 class="h5-returns">Returns:</h5>
|
|
861
877
|
|
|
862
878
|
|
|
863
879
|
<div class="param-desc">
|
|
864
|
-
<p>回傳Promise,resolve
|
|
880
|
+
<p>回傳Promise,resolve回傳分群後結果物件,keys代表分群有使用到的欄位,ginds代表分群後的指標陣列,gltdt代表分群後的物件陣列,gmat代表分群後且經過PCA處理的數據陣列,其內因是降維後的數據,可例如取最左2欄的數據代表x,y來繪製分群後二維分佈圖,reject回傳錯誤訊息</p>
|
|
865
881
|
</div>
|
|
866
882
|
|
|
867
883
|
|
|
@@ -875,6 +891,7 @@
|
|
|
875
891
|
<span class="param-type">Promise</span>
|
|
876
892
|
|
|
877
893
|
|
|
894
|
+
|
|
878
895
|
</dd>
|
|
879
896
|
</dl>
|
|
880
897
|
|
|
@@ -902,7 +919,7 @@
|
|
|
902
919
|
<br class="clear">
|
|
903
920
|
|
|
904
921
|
<footer>
|
|
905
|
-
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc
|
|
922
|
+
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.2</a> on Wed Mar 29 2023 11:09:40 GMT+0800 (台北標準時間) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
|
|
906
923
|
</footer>
|
|
907
924
|
|
|
908
925
|
<script>prettyPrint();</script>
|
package/docs/index.html
CHANGED
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
<link type="text/css" rel="stylesheet" href="styles/prettify.css">
|
|
15
15
|
<link type="text/css" rel="stylesheet" href="styles/jsdoc.css">
|
|
16
16
|
<script src="scripts/nav.js" defer></script>
|
|
17
|
+
|
|
17
18
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
18
19
|
</head>
|
|
19
20
|
<body>
|
|
@@ -27,7 +28,9 @@
|
|
|
27
28
|
|
|
28
29
|
<nav >
|
|
29
30
|
|
|
30
|
-
|
|
31
|
+
|
|
32
|
+
<h2><a href="index.html">Home</a></h2><h3>Global</h3><ul><li><a href="global.html#PCA">PCA</a></li><li><a href="global.html#WCluster">WCluster</a></li><li><a href="global.html#cluster">cluster</a></li></ul>
|
|
33
|
+
|
|
31
34
|
</nav>
|
|
32
35
|
|
|
33
36
|
<div id="main">
|
|
@@ -68,7 +71,7 @@
|
|
|
68
71
|
<br class="clear">
|
|
69
72
|
|
|
70
73
|
<footer>
|
|
71
|
-
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc
|
|
74
|
+
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.2</a> on Wed Mar 29 2023 11:09:40 GMT+0800 (台北標準時間) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
|
|
72
75
|
</footer>
|
|
73
76
|
|
|
74
77
|
<script>prettyPrint();</script>
|