@iyulab/u-insight 0.9.0 → 0.10.0
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 +15 -0
- package/package.json +1 -1
- package/u_insight.d.ts +17 -0
- package/u_insight.js +1 -1
- package/u_insight_bg.js +27 -0
- package/u_insight_bg.wasm +0 -0
package/README.md
CHANGED
|
@@ -7,6 +7,10 @@
|
|
|
7
7
|
|
|
8
8
|
A statistical analysis and data profiling engine in Rust with C FFI bindings.
|
|
9
9
|
|
|
10
|
+
## What's New in 0.9.1
|
|
11
|
+
|
|
12
|
+
- **BREAKING — Rust**: `InsightError::NonNumericColumn` variant removed. The 0.9.0 audit redirected all internal call sites to `DegenerateData`, leaving the variant unused. Removed per `Delete over deprecate` policy. External `match` arms over `InsightError` must drop the corresponding branch.
|
|
13
|
+
|
|
10
14
|
## What's New in 0.9.0
|
|
11
15
|
|
|
12
16
|
- **Kendall tau-b correlation** added to `CorrelationMethod` (Pearson / Spearman / Kendall)
|
|
@@ -299,6 +303,17 @@ K-Means++ clustering on row-major data `[[x,y,...], ...]`.
|
|
|
299
303
|
{ "k": 3, "labels": [0,0,1,1,2,2], "centroids": [[...]], "wcss": 5.2, "iterations": 12, "cluster_sizes": [2,2,2] }
|
|
300
304
|
```
|
|
301
305
|
|
|
306
|
+
#### `silhouette(data, labels, k) -> SilhouetteResult`
|
|
307
|
+
|
|
308
|
+
Silhouette analysis for an existing clustering assignment. Works with any clustering output (`kmeans`, `dbscan`, `hierarchical`, etc.). `data` is row-major `[[x,y,...], ...]`, `labels` is one cluster id per row (each `< k`), `k` is the number of distinct clusters. O(n²) — use sparingly on very large inputs.
|
|
309
|
+
|
|
310
|
+
**Output:**
|
|
311
|
+
```json
|
|
312
|
+
{ "avg": 0.74, "per_sample": [0.81, 0.79, 0.62, ...] }
|
|
313
|
+
```
|
|
314
|
+
|
|
315
|
+
`avg` ranges from -1 (wrong cluster) to +1 (well-separated); singleton-cluster points report 0.0 in `per_sample`.
|
|
316
|
+
|
|
302
317
|
#### `pca(data, n_components) -> PcaResult`
|
|
303
318
|
|
|
304
319
|
Principal Component Analysis on row-major data.
|
package/package.json
CHANGED
package/u_insight.d.ts
CHANGED
|
@@ -221,6 +221,23 @@ export function pca(data_json: any, n_components: number): any;
|
|
|
221
221
|
*/
|
|
222
222
|
export function regression(data_json: any): any;
|
|
223
223
|
|
|
224
|
+
/**
|
|
225
|
+
* Computes silhouette scores for an existing clustering assignment.
|
|
226
|
+
*
|
|
227
|
+
* # Input
|
|
228
|
+
* `data_json`: row-major points `[[x,y,...], ...]`
|
|
229
|
+
* `labels_json`: cluster id per sample `[0, 0, 1, 1, ...]` (each value `< k`)
|
|
230
|
+
* `k`: number of distinct clusters
|
|
231
|
+
*
|
|
232
|
+
* # Output
|
|
233
|
+
* `{ avg, per_sample }` — `avg` is the mean silhouette across samples that
|
|
234
|
+
* had a defined silhouette; `per_sample[i]` is the silhouette of sample `i`
|
|
235
|
+
* (0.0 for singleton-cluster points).
|
|
236
|
+
*
|
|
237
|
+
* O(n²) — use sparingly on very large inputs.
|
|
238
|
+
*/
|
|
239
|
+
export function silhouette(data_json: any, labels_json: any, k: number): any;
|
|
240
|
+
|
|
224
241
|
/**
|
|
225
242
|
* Variance Inflation Factor diagnostics for column-major numeric data.
|
|
226
243
|
*
|
package/u_insight.js
CHANGED
|
@@ -5,5 +5,5 @@ import { __wbg_set_wasm } from "./u_insight_bg.js";
|
|
|
5
5
|
__wbg_set_wasm(wasm);
|
|
6
6
|
wasm.__wbindgen_start();
|
|
7
7
|
export {
|
|
8
|
-
condition_number_diagnostic, correlation_matrix, dbscan, describe, detect_univariate_outliers, distribution_analysis, feature_importance, hierarchical, isolation_forest, kmeans, lof, pca, regression, vif_diagnostic
|
|
8
|
+
condition_number_diagnostic, correlation_matrix, dbscan, describe, detect_univariate_outliers, distribution_analysis, feature_importance, hierarchical, isolation_forest, kmeans, lof, pca, regression, silhouette, vif_diagnostic
|
|
9
9
|
} from "./u_insight_bg.js";
|
package/u_insight_bg.js
CHANGED
|
@@ -329,6 +329,33 @@ export function regression(data_json) {
|
|
|
329
329
|
return takeFromExternrefTable0(ret[0]);
|
|
330
330
|
}
|
|
331
331
|
|
|
332
|
+
/**
|
|
333
|
+
* Computes silhouette scores for an existing clustering assignment.
|
|
334
|
+
*
|
|
335
|
+
* # Input
|
|
336
|
+
* `data_json`: row-major points `[[x,y,...], ...]`
|
|
337
|
+
* `labels_json`: cluster id per sample `[0, 0, 1, 1, ...]` (each value `< k`)
|
|
338
|
+
* `k`: number of distinct clusters
|
|
339
|
+
*
|
|
340
|
+
* # Output
|
|
341
|
+
* `{ avg, per_sample }` — `avg` is the mean silhouette across samples that
|
|
342
|
+
* had a defined silhouette; `per_sample[i]` is the silhouette of sample `i`
|
|
343
|
+
* (0.0 for singleton-cluster points).
|
|
344
|
+
*
|
|
345
|
+
* O(n²) — use sparingly on very large inputs.
|
|
346
|
+
* @param {any} data_json
|
|
347
|
+
* @param {any} labels_json
|
|
348
|
+
* @param {number} k
|
|
349
|
+
* @returns {any}
|
|
350
|
+
*/
|
|
351
|
+
export function silhouette(data_json, labels_json, k) {
|
|
352
|
+
const ret = wasm.silhouette(data_json, labels_json, k);
|
|
353
|
+
if (ret[2]) {
|
|
354
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
355
|
+
}
|
|
356
|
+
return takeFromExternrefTable0(ret[0]);
|
|
357
|
+
}
|
|
358
|
+
|
|
332
359
|
/**
|
|
333
360
|
* Variance Inflation Factor diagnostics for column-major numeric data.
|
|
334
361
|
*
|
package/u_insight_bg.wasm
CHANGED
|
Binary file
|