@iyulab/u-numflow 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 +84 -8
- package/node/u_numflow.cjs +405 -1
- package/node/u_numflow.d.cts +103 -0
- package/node/u_numflow_bg.wasm +0 -0
- package/package.json +1 -1
- package/u_numflow.d.ts +103 -0
- package/u_numflow.js +1 -1
- package/u_numflow_bg.js +396 -1
- package/u_numflow_bg.wasm +0 -0
package/node/u_numflow.d.cts
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
/* tslint:disable */
|
|
2
2
|
/* eslint-disable */
|
|
3
|
+
/**
|
|
4
|
+
* A distribution named by `kind`, with its parameters.
|
|
5
|
+
*/
|
|
6
|
+
export type DistributionSpec = { kind: "uniform"; min: number; max: number } | { kind: "triangular"; min: number; mode: number; max: number } | { kind: "pert"; min: number; mode: number; max: number; lambda?: number } | { kind: "normal"; mu: number; sigma: number } | { kind: "lognormal"; mu: number; sigma: number } | { kind: "weibull"; shape: number; scale: number } | { kind: "exponential"; rate: number } | { kind: "gamma"; shape: number; rate: number } | { kind: "beta"; alpha: number; beta: number } | { kind: "chi_squared"; k: number };
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Mean and variance of a distribution.
|
|
10
|
+
*/
|
|
11
|
+
export interface MomentsDto {
|
|
12
|
+
mean: number;
|
|
13
|
+
variance: number;
|
|
14
|
+
}
|
|
15
|
+
|
|
3
16
|
/**
|
|
4
17
|
* Output of [`estimate_lambda`]: `{ lambda, at_bound }`.
|
|
5
18
|
*/
|
|
@@ -38,6 +51,49 @@ export function chi_squared_cdf(x: number, k: number): number;
|
|
|
38
51
|
*/
|
|
39
52
|
export function chi_squared_quantile(p: number, k: number): number;
|
|
40
53
|
|
|
54
|
+
/**
|
|
55
|
+
* `P(X ≤ x)` for the distribution `{ kind, ...parameters }`.
|
|
56
|
+
*
|
|
57
|
+
* # Errors
|
|
58
|
+
* As every `distribution` argument: `malformed_input` for a value that is
|
|
59
|
+
* not such an object, `unknown_option` for an unknown `kind` (with
|
|
60
|
+
* `expected`), `value_not_finite` for a NaN or infinite parameter,
|
|
61
|
+
* `parameter_out_of_range` for a parameter that must be `> 0`, and
|
|
62
|
+
* `invalid_option` for parameters out of order (`min < max`,
|
|
63
|
+
* `min ≤ mode ≤ max`). `x` NaN throws `value_not_finite`.
|
|
64
|
+
*/
|
|
65
|
+
export function distribution_cdf(distribution: DistributionSpec, x: number): number;
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* Mean and variance of `distribution` — also the way to check a
|
|
69
|
+
* specification before using it.
|
|
70
|
+
*
|
|
71
|
+
* # Errors
|
|
72
|
+
* As [`distribution_cdf`] for `distribution`.
|
|
73
|
+
*/
|
|
74
|
+
export function distribution_moments(distribution: DistributionSpec): MomentsDto;
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* The `x` with `P(X ≤ x) = p`.
|
|
78
|
+
*
|
|
79
|
+
* # Errors
|
|
80
|
+
* As [`distribution_cdf`] for `distribution`; `p` outside `(0, 1)` throws
|
|
81
|
+
* `parameter_out_of_range`.
|
|
82
|
+
*/
|
|
83
|
+
export function distribution_quantile(distribution: DistributionSpec, p: number): number;
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* `n` random variates, reproducible from `seed`: the same `(distribution, n,
|
|
87
|
+
* seed)` always returns the same values. Uniforms are drawn from the open
|
|
88
|
+
* interval (0, 1), so no variate is infinite.
|
|
89
|
+
*
|
|
90
|
+
* # Errors
|
|
91
|
+
* As [`distribution_cdf`] for `distribution`; `n` not a whole number in
|
|
92
|
+
* `[0, 2³² − 1]` or `seed` not a whole number in `[0, 2⁵³]` throws
|
|
93
|
+
* `parameter_out_of_range`.
|
|
94
|
+
*/
|
|
95
|
+
export function distribution_sample(distribution: DistributionSpec, n: number, seed: number): Float64Array;
|
|
96
|
+
|
|
41
97
|
/**
|
|
42
98
|
* Estimate the optimal Box-Cox lambda via profile maximum likelihood.
|
|
43
99
|
*
|
|
@@ -70,6 +126,53 @@ export function f_distribution_cdf(x: number, df1: number, df2: number): number;
|
|
|
70
126
|
*/
|
|
71
127
|
export function f_distribution_quantile(p: number, df1: number, df2: number): number;
|
|
72
128
|
|
|
129
|
+
/**
|
|
130
|
+
* Points in `a` but not in `b`, in normal form — e.g. a reporting window
|
|
131
|
+
* minus down-time is up-time.
|
|
132
|
+
*
|
|
133
|
+
* # Errors
|
|
134
|
+
* As [`interval_normalize`], naming `a` or `b`.
|
|
135
|
+
*/
|
|
136
|
+
export function interval_difference(a: [number, number][], b: [number, number][]): [number, number][];
|
|
137
|
+
|
|
138
|
+
/**
|
|
139
|
+
* Points in both `a` and `b`, in normal form. Clipping to a window is
|
|
140
|
+
* `interval_intersection(a, [[from, to]])`.
|
|
141
|
+
*
|
|
142
|
+
* # Errors
|
|
143
|
+
* As [`interval_normalize`], naming `a` or `b`.
|
|
144
|
+
*/
|
|
145
|
+
export function interval_intersection(a: [number, number][], b: [number, number][]): [number, number][];
|
|
146
|
+
|
|
147
|
+
/**
|
|
148
|
+
* Total length of the union of `intervals`: each point counts once, however
|
|
149
|
+
* many rows cover it.
|
|
150
|
+
*
|
|
151
|
+
* # Errors
|
|
152
|
+
* As [`interval_normalize`].
|
|
153
|
+
*/
|
|
154
|
+
export function interval_measure(intervals: [number, number][]): number;
|
|
155
|
+
|
|
156
|
+
/**
|
|
157
|
+
* The union of `intervals` (each `[start, end]`, half-open) in normal form:
|
|
158
|
+
* sorted, disjoint, touching pieces merged, empty ones dropped.
|
|
159
|
+
*
|
|
160
|
+
* # Errors
|
|
161
|
+
* Throws `malformed_input` for a row that is not two numbers (`parameter` is
|
|
162
|
+
* the row's path, e.g. `intervals[2]`), `value_not_finite` for a NaN or
|
|
163
|
+
* ±Infinity bound, and `reversed_interval` (`parameter`, `index`) for a row
|
|
164
|
+
* with start > end — reversed rows are refused, not swapped.
|
|
165
|
+
*/
|
|
166
|
+
export function interval_normalize(intervals: [number, number][]): [number, number][];
|
|
167
|
+
|
|
168
|
+
/**
|
|
169
|
+
* Points in `a` or `b`, in normal form.
|
|
170
|
+
*
|
|
171
|
+
* # Errors
|
|
172
|
+
* As [`interval_normalize`], naming `a` or `b`.
|
|
173
|
+
*/
|
|
174
|
+
export function interval_union(a: [number, number][], b: [number, number][]): [number, number][];
|
|
175
|
+
|
|
73
176
|
/**
|
|
74
177
|
* Standard normal quantile Φ⁻¹(p): the `z` with `P(Z ≤ z) = p`.
|
|
75
178
|
*
|
package/node/u_numflow_bg.wasm
CHANGED
|
Binary file
|
package/package.json
CHANGED
package/u_numflow.d.ts
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
/* tslint:disable */
|
|
2
2
|
/* eslint-disable */
|
|
3
|
+
/**
|
|
4
|
+
* A distribution named by `kind`, with its parameters.
|
|
5
|
+
*/
|
|
6
|
+
export type DistributionSpec = { kind: "uniform"; min: number; max: number } | { kind: "triangular"; min: number; mode: number; max: number } | { kind: "pert"; min: number; mode: number; max: number; lambda?: number } | { kind: "normal"; mu: number; sigma: number } | { kind: "lognormal"; mu: number; sigma: number } | { kind: "weibull"; shape: number; scale: number } | { kind: "exponential"; rate: number } | { kind: "gamma"; shape: number; rate: number } | { kind: "beta"; alpha: number; beta: number } | { kind: "chi_squared"; k: number };
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Mean and variance of a distribution.
|
|
10
|
+
*/
|
|
11
|
+
export interface MomentsDto {
|
|
12
|
+
mean: number;
|
|
13
|
+
variance: number;
|
|
14
|
+
}
|
|
15
|
+
|
|
3
16
|
/**
|
|
4
17
|
* Output of [`estimate_lambda`]: `{ lambda, at_bound }`.
|
|
5
18
|
*/
|
|
@@ -38,6 +51,49 @@ export function chi_squared_cdf(x: number, k: number): number;
|
|
|
38
51
|
*/
|
|
39
52
|
export function chi_squared_quantile(p: number, k: number): number;
|
|
40
53
|
|
|
54
|
+
/**
|
|
55
|
+
* `P(X ≤ x)` for the distribution `{ kind, ...parameters }`.
|
|
56
|
+
*
|
|
57
|
+
* # Errors
|
|
58
|
+
* As every `distribution` argument: `malformed_input` for a value that is
|
|
59
|
+
* not such an object, `unknown_option` for an unknown `kind` (with
|
|
60
|
+
* `expected`), `value_not_finite` for a NaN or infinite parameter,
|
|
61
|
+
* `parameter_out_of_range` for a parameter that must be `> 0`, and
|
|
62
|
+
* `invalid_option` for parameters out of order (`min < max`,
|
|
63
|
+
* `min ≤ mode ≤ max`). `x` NaN throws `value_not_finite`.
|
|
64
|
+
*/
|
|
65
|
+
export function distribution_cdf(distribution: DistributionSpec, x: number): number;
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* Mean and variance of `distribution` — also the way to check a
|
|
69
|
+
* specification before using it.
|
|
70
|
+
*
|
|
71
|
+
* # Errors
|
|
72
|
+
* As [`distribution_cdf`] for `distribution`.
|
|
73
|
+
*/
|
|
74
|
+
export function distribution_moments(distribution: DistributionSpec): MomentsDto;
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* The `x` with `P(X ≤ x) = p`.
|
|
78
|
+
*
|
|
79
|
+
* # Errors
|
|
80
|
+
* As [`distribution_cdf`] for `distribution`; `p` outside `(0, 1)` throws
|
|
81
|
+
* `parameter_out_of_range`.
|
|
82
|
+
*/
|
|
83
|
+
export function distribution_quantile(distribution: DistributionSpec, p: number): number;
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* `n` random variates, reproducible from `seed`: the same `(distribution, n,
|
|
87
|
+
* seed)` always returns the same values. Uniforms are drawn from the open
|
|
88
|
+
* interval (0, 1), so no variate is infinite.
|
|
89
|
+
*
|
|
90
|
+
* # Errors
|
|
91
|
+
* As [`distribution_cdf`] for `distribution`; `n` not a whole number in
|
|
92
|
+
* `[0, 2³² − 1]` or `seed` not a whole number in `[0, 2⁵³]` throws
|
|
93
|
+
* `parameter_out_of_range`.
|
|
94
|
+
*/
|
|
95
|
+
export function distribution_sample(distribution: DistributionSpec, n: number, seed: number): Float64Array;
|
|
96
|
+
|
|
41
97
|
/**
|
|
42
98
|
* Estimate the optimal Box-Cox lambda via profile maximum likelihood.
|
|
43
99
|
*
|
|
@@ -70,6 +126,53 @@ export function f_distribution_cdf(x: number, df1: number, df2: number): number;
|
|
|
70
126
|
*/
|
|
71
127
|
export function f_distribution_quantile(p: number, df1: number, df2: number): number;
|
|
72
128
|
|
|
129
|
+
/**
|
|
130
|
+
* Points in `a` but not in `b`, in normal form — e.g. a reporting window
|
|
131
|
+
* minus down-time is up-time.
|
|
132
|
+
*
|
|
133
|
+
* # Errors
|
|
134
|
+
* As [`interval_normalize`], naming `a` or `b`.
|
|
135
|
+
*/
|
|
136
|
+
export function interval_difference(a: [number, number][], b: [number, number][]): [number, number][];
|
|
137
|
+
|
|
138
|
+
/**
|
|
139
|
+
* Points in both `a` and `b`, in normal form. Clipping to a window is
|
|
140
|
+
* `interval_intersection(a, [[from, to]])`.
|
|
141
|
+
*
|
|
142
|
+
* # Errors
|
|
143
|
+
* As [`interval_normalize`], naming `a` or `b`.
|
|
144
|
+
*/
|
|
145
|
+
export function interval_intersection(a: [number, number][], b: [number, number][]): [number, number][];
|
|
146
|
+
|
|
147
|
+
/**
|
|
148
|
+
* Total length of the union of `intervals`: each point counts once, however
|
|
149
|
+
* many rows cover it.
|
|
150
|
+
*
|
|
151
|
+
* # Errors
|
|
152
|
+
* As [`interval_normalize`].
|
|
153
|
+
*/
|
|
154
|
+
export function interval_measure(intervals: [number, number][]): number;
|
|
155
|
+
|
|
156
|
+
/**
|
|
157
|
+
* The union of `intervals` (each `[start, end]`, half-open) in normal form:
|
|
158
|
+
* sorted, disjoint, touching pieces merged, empty ones dropped.
|
|
159
|
+
*
|
|
160
|
+
* # Errors
|
|
161
|
+
* Throws `malformed_input` for a row that is not two numbers (`parameter` is
|
|
162
|
+
* the row's path, e.g. `intervals[2]`), `value_not_finite` for a NaN or
|
|
163
|
+
* ±Infinity bound, and `reversed_interval` (`parameter`, `index`) for a row
|
|
164
|
+
* with start > end — reversed rows are refused, not swapped.
|
|
165
|
+
*/
|
|
166
|
+
export function interval_normalize(intervals: [number, number][]): [number, number][];
|
|
167
|
+
|
|
168
|
+
/**
|
|
169
|
+
* Points in `a` or `b`, in normal form.
|
|
170
|
+
*
|
|
171
|
+
* # Errors
|
|
172
|
+
* As [`interval_normalize`], naming `a` or `b`.
|
|
173
|
+
*/
|
|
174
|
+
export function interval_union(a: [number, number][], b: [number, number][]): [number, number][];
|
|
175
|
+
|
|
73
176
|
/**
|
|
74
177
|
* Standard normal quantile Φ⁻¹(p): the `z` with `P(Z ≤ z) = p`.
|
|
75
178
|
*
|
package/u_numflow.js
CHANGED
|
@@ -5,5 +5,5 @@ import { __wbg_set_wasm } from "./u_numflow_bg.js";
|
|
|
5
5
|
__wbg_set_wasm(wasm);
|
|
6
6
|
wasm.__wbindgen_start();
|
|
7
7
|
export {
|
|
8
|
-
box_cox, chi_squared_cdf, chi_squared_quantile, estimate_lambda, f_distribution_cdf, f_distribution_quantile, inverse_normal_cdf, mean, normal_cdf, normal_sf, rfft, std_dev, t_distribution_cdf, t_distribution_quantile, variance
|
|
8
|
+
box_cox, chi_squared_cdf, chi_squared_quantile, distribution_cdf, distribution_moments, distribution_quantile, distribution_sample, estimate_lambda, f_distribution_cdf, f_distribution_quantile, interval_difference, interval_intersection, interval_measure, interval_normalize, interval_union, inverse_normal_cdf, mean, normal_cdf, normal_sf, rfft, std_dev, t_distribution_cdf, t_distribution_quantile, variance
|
|
9
9
|
} from "./u_numflow_bg.js";
|