@iyulab/u-insight 0.8.0 → 0.9.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 +13 -0
- package/package.json +1 -1
- package/u_insight.d.ts +54 -2
- package/u_insight.js +1 -1
- package/u_insight_bg.js +78 -2
- package/u_insight_bg.wasm +0 -0
package/README.md
CHANGED
|
@@ -7,6 +7,19 @@
|
|
|
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.0
|
|
11
|
+
|
|
12
|
+
- **Kendall tau-b correlation** added to `CorrelationMethod` (Pearson / Spearman / Kendall)
|
|
13
|
+
- **Outlier fences exposed** on `OutlierResult` — `lower_fence`, `upper_fence`, `center`, `spread`
|
|
14
|
+
- **`detect_outliers_slice(&[f64], method)`** helper for raw-slice input
|
|
15
|
+
- **`vif_analysis()` and `condition_number()`** standalone multicollinearity diagnostics
|
|
16
|
+
- **WASM**: `correlation_matrix` accepts optional `_method` field (`"pearson"` | `"spearman"` | `"kendall"`); new `detect_univariate_outliers`, `vif_diagnostic`, `condition_number_diagnostic`
|
|
17
|
+
- **C#**: `CorrelationMethodKind` enum + `Correlate(data, method)` parameter
|
|
18
|
+
- **BREAKING — Rust**: Non-finite numeric inputs now return `InsightError::DegenerateData` (was `NonNumericColumn`); audit covered 11 call sites
|
|
19
|
+
- **BREAKING — Rust**: `OutlierResult` gained 4 new fields (exhaustive pattern matches must be updated)
|
|
20
|
+
- **BREAKING — FFI**: `insight_correlation` signature gained a `method: u32` parameter (use `INSIGHT_CORR_PEARSON` = 0 to keep prior behaviour)
|
|
21
|
+
- **BREAKING — C#**: `Correlate(...)` now takes an optional `CorrelationMethodKind` parameter (default `Pearson` keeps existing call-sites compiling)
|
|
22
|
+
|
|
10
23
|
## Overview
|
|
11
24
|
|
|
12
25
|
u-insight transforms raw tabular data into actionable statistical insights. It operates in two distinct layers with **opposite assumptions about input data quality**:
|
package/package.json
CHANGED
package/u_insight.d.ts
CHANGED
|
@@ -2,13 +2,33 @@
|
|
|
2
2
|
/* eslint-disable */
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
|
-
*
|
|
5
|
+
* 2-norm condition number of the sample covariance matrix.
|
|
6
6
|
*
|
|
7
7
|
* # Input
|
|
8
8
|
* ```json
|
|
9
|
-
* { "col1": [
|
|
9
|
+
* { "col1": [...], "col2": [...] }
|
|
10
|
+
* ```
|
|
11
|
+
*
|
|
12
|
+
* # Output
|
|
13
|
+
* `{ condition_number, names }`
|
|
14
|
+
*
|
|
15
|
+
* Standard threshold: `cond > 30` indicates multicollinearity (Belsley 1991).
|
|
16
|
+
* Returns `Infinity` for numerically singular input.
|
|
17
|
+
*/
|
|
18
|
+
export function condition_number_diagnostic(data_json: any): any;
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Computes a correlation matrix for a column-major dataset.
|
|
22
|
+
*
|
|
23
|
+
* # Input
|
|
24
|
+
* ```json
|
|
25
|
+
* { "col1": [1.0, 2.0, 3.0], "col2": [4.0, 5.0, 6.0], "_method": "pearson" }
|
|
10
26
|
* ```
|
|
11
27
|
*
|
|
28
|
+
* `_method` ∈ `{"pearson", "spearman", "kendall"}` — optional, defaults
|
|
29
|
+
* to `"pearson"`. Reserved key (prefix `_`) so it never collides with a
|
|
30
|
+
* column name.
|
|
31
|
+
*
|
|
12
32
|
* # Output
|
|
13
33
|
* `{ names, matrix (flattened n×n), n, high_pairs }`
|
|
14
34
|
*/
|
|
@@ -49,6 +69,24 @@ export function dbscan(data_json: any, config_json: any): any;
|
|
|
49
69
|
*/
|
|
50
70
|
export function describe(data_json: any): any;
|
|
51
71
|
|
|
72
|
+
/**
|
|
73
|
+
* Univariate outlier detection on a flat numeric vector.
|
|
74
|
+
*
|
|
75
|
+
* # Input
|
|
76
|
+
* ```json
|
|
77
|
+
* { "data": [1.0, 2.0, 3.0, 100.0], "method": "iqr" }
|
|
78
|
+
* ```
|
|
79
|
+
* `method` ∈ `{"iqr"|"tukey", "zscore"|"three_sigma", "modified_zscore"|"hampel"}`.
|
|
80
|
+
* Optional, defaults to `"iqr"`.
|
|
81
|
+
*
|
|
82
|
+
* # Output
|
|
83
|
+
* `{ method, indices, scores, count, pct, lower_fence, upper_fence, center, spread }`
|
|
84
|
+
*
|
|
85
|
+
* `method` aliases: `tukey` → IQR Tukey fences (k=1.5), `three_sigma` →
|
|
86
|
+
* mean ± 3·σ, `hampel` → robust median ± 3.5·(MAD/0.6745).
|
|
87
|
+
*/
|
|
88
|
+
export function detect_univariate_outliers(data_json: any): any;
|
|
89
|
+
|
|
52
90
|
/**
|
|
53
91
|
* Runs distribution analysis on a 1-D numeric array.
|
|
54
92
|
*
|
|
@@ -182,3 +220,17 @@ export function pca(data_json: any, n_components: number): any;
|
|
|
182
220
|
* `{ target_name, predictor_names, r_squared, adj_r_squared, coefficients, p_values, vif, f_p_value }`
|
|
183
221
|
*/
|
|
184
222
|
export function regression(data_json: any): any;
|
|
223
|
+
|
|
224
|
+
/**
|
|
225
|
+
* Variance Inflation Factor diagnostics for column-major numeric data.
|
|
226
|
+
*
|
|
227
|
+
* # Input
|
|
228
|
+
* ```json
|
|
229
|
+
* { "col1": [...], "col2": [...], "_threshold": 10.0 }
|
|
230
|
+
* ```
|
|
231
|
+
* `_threshold` is optional (default 10.0).
|
|
232
|
+
*
|
|
233
|
+
* # Output
|
|
234
|
+
* `{ vif_per_column, high_vif_columns, threshold, names }`
|
|
235
|
+
*/
|
|
236
|
+
export function vif_diagnostic(data_json: any): any;
|
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
|
-
correlation_matrix, dbscan, describe, distribution_analysis, feature_importance, hierarchical, isolation_forest, kmeans, lof, pca, regression
|
|
8
|
+
condition_number_diagnostic, correlation_matrix, dbscan, describe, detect_univariate_outliers, distribution_analysis, feature_importance, hierarchical, isolation_forest, kmeans, lof, pca, regression, vif_diagnostic
|
|
9
9
|
} from "./u_insight_bg.js";
|
package/u_insight_bg.js
CHANGED
|
@@ -1,11 +1,39 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* 2-norm condition number of the sample covariance matrix.
|
|
3
3
|
*
|
|
4
4
|
* # Input
|
|
5
5
|
* ```json
|
|
6
|
-
* { "col1": [
|
|
6
|
+
* { "col1": [...], "col2": [...] }
|
|
7
|
+
* ```
|
|
8
|
+
*
|
|
9
|
+
* # Output
|
|
10
|
+
* `{ condition_number, names }`
|
|
11
|
+
*
|
|
12
|
+
* Standard threshold: `cond > 30` indicates multicollinearity (Belsley 1991).
|
|
13
|
+
* Returns `Infinity` for numerically singular input.
|
|
14
|
+
* @param {any} data_json
|
|
15
|
+
* @returns {any}
|
|
16
|
+
*/
|
|
17
|
+
export function condition_number_diagnostic(data_json) {
|
|
18
|
+
const ret = wasm.condition_number_diagnostic(data_json);
|
|
19
|
+
if (ret[2]) {
|
|
20
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
21
|
+
}
|
|
22
|
+
return takeFromExternrefTable0(ret[0]);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Computes a correlation matrix for a column-major dataset.
|
|
27
|
+
*
|
|
28
|
+
* # Input
|
|
29
|
+
* ```json
|
|
30
|
+
* { "col1": [1.0, 2.0, 3.0], "col2": [4.0, 5.0, 6.0], "_method": "pearson" }
|
|
7
31
|
* ```
|
|
8
32
|
*
|
|
33
|
+
* `_method` ∈ `{"pearson", "spearman", "kendall"}` — optional, defaults
|
|
34
|
+
* to `"pearson"`. Reserved key (prefix `_`) so it never collides with a
|
|
35
|
+
* column name.
|
|
36
|
+
*
|
|
9
37
|
* # Output
|
|
10
38
|
* `{ names, matrix (flattened n×n), n, high_pairs }`
|
|
11
39
|
* @param {any} data_json
|
|
@@ -71,6 +99,32 @@ export function describe(data_json) {
|
|
|
71
99
|
return takeFromExternrefTable0(ret[0]);
|
|
72
100
|
}
|
|
73
101
|
|
|
102
|
+
/**
|
|
103
|
+
* Univariate outlier detection on a flat numeric vector.
|
|
104
|
+
*
|
|
105
|
+
* # Input
|
|
106
|
+
* ```json
|
|
107
|
+
* { "data": [1.0, 2.0, 3.0, 100.0], "method": "iqr" }
|
|
108
|
+
* ```
|
|
109
|
+
* `method` ∈ `{"iqr"|"tukey", "zscore"|"three_sigma", "modified_zscore"|"hampel"}`.
|
|
110
|
+
* Optional, defaults to `"iqr"`.
|
|
111
|
+
*
|
|
112
|
+
* # Output
|
|
113
|
+
* `{ method, indices, scores, count, pct, lower_fence, upper_fence, center, spread }`
|
|
114
|
+
*
|
|
115
|
+
* `method` aliases: `tukey` → IQR Tukey fences (k=1.5), `three_sigma` →
|
|
116
|
+
* mean ± 3·σ, `hampel` → robust median ± 3.5·(MAD/0.6745).
|
|
117
|
+
* @param {any} data_json
|
|
118
|
+
* @returns {any}
|
|
119
|
+
*/
|
|
120
|
+
export function detect_univariate_outliers(data_json) {
|
|
121
|
+
const ret = wasm.detect_univariate_outliers(data_json);
|
|
122
|
+
if (ret[2]) {
|
|
123
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
124
|
+
}
|
|
125
|
+
return takeFromExternrefTable0(ret[0]);
|
|
126
|
+
}
|
|
127
|
+
|
|
74
128
|
/**
|
|
75
129
|
* Runs distribution analysis on a 1-D numeric array.
|
|
76
130
|
*
|
|
@@ -274,6 +328,28 @@ export function regression(data_json) {
|
|
|
274
328
|
}
|
|
275
329
|
return takeFromExternrefTable0(ret[0]);
|
|
276
330
|
}
|
|
331
|
+
|
|
332
|
+
/**
|
|
333
|
+
* Variance Inflation Factor diagnostics for column-major numeric data.
|
|
334
|
+
*
|
|
335
|
+
* # Input
|
|
336
|
+
* ```json
|
|
337
|
+
* { "col1": [...], "col2": [...], "_threshold": 10.0 }
|
|
338
|
+
* ```
|
|
339
|
+
* `_threshold` is optional (default 10.0).
|
|
340
|
+
*
|
|
341
|
+
* # Output
|
|
342
|
+
* `{ vif_per_column, high_vif_columns, threshold, names }`
|
|
343
|
+
* @param {any} data_json
|
|
344
|
+
* @returns {any}
|
|
345
|
+
*/
|
|
346
|
+
export function vif_diagnostic(data_json) {
|
|
347
|
+
const ret = wasm.vif_diagnostic(data_json);
|
|
348
|
+
if (ret[2]) {
|
|
349
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
350
|
+
}
|
|
351
|
+
return takeFromExternrefTable0(ret[0]);
|
|
352
|
+
}
|
|
277
353
|
export function __wbg_Error_83742b46f01ce22d(arg0, arg1) {
|
|
278
354
|
const ret = Error(getStringFromWasm0(arg0, arg1));
|
|
279
355
|
return ret;
|
package/u_insight_bg.wasm
CHANGED
|
Binary file
|