fastlowess-wasm 1.3.0 → 3.0.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 +154 -104
- package/fastlowess_wasm.d.ts +159 -75
- package/fastlowess_wasm.js +230 -142
- package/fastlowess_wasm_bg.wasm +0 -0
- package/package.json +1 -1
package/fastlowess_wasm.d.ts
CHANGED
|
@@ -1,6 +1,108 @@
|
|
|
1
1
|
/* tslint:disable */
|
|
2
2
|
/* eslint-disable */
|
|
3
3
|
|
|
4
|
+
/** Configuration options for LOWESS smoothing. */
|
|
5
|
+
export interface SmoothOptions {
|
|
6
|
+
/** Smoothing fraction (0 < fraction <= 1). Default: 0.67. */
|
|
7
|
+
fraction?: number;
|
|
8
|
+
/** Number of robustness iterations. Default: 3. */
|
|
9
|
+
iterations?: number;
|
|
10
|
+
/** Delta for interpolation speedup. Default: auto. Set to 0 to disable. */
|
|
11
|
+
delta?: number;
|
|
12
|
+
/** Kernel function ("tricube", "epanechnikov", "gaussian", "uniform", "biweight", "triangle", "cosine"). Default: "tricube". */
|
|
13
|
+
weight_function?: string;
|
|
14
|
+
/** Robustness method ("bisquare", "huber", "talwar"). Default: "bisquare". */
|
|
15
|
+
robustness_method?: string;
|
|
16
|
+
/** Fallback when all weights are zero ("use_local_mean", "return_original", "return_none"). Default: "use_local_mean". */
|
|
17
|
+
zero_weight_fallback?: string;
|
|
18
|
+
/** Boundary handling ("extend", "reflect", "zero", "noboundary"). Default: "extend". */
|
|
19
|
+
boundary_policy?: string;
|
|
20
|
+
/** Scaling method ("mad", "mar", "mean"). Default: "mad". */
|
|
21
|
+
scaling_method?: string;
|
|
22
|
+
/** Auto-convergence tolerance. Disabled when absent. */
|
|
23
|
+
auto_converge?: number;
|
|
24
|
+
/** Include residuals in result. Default: false. */
|
|
25
|
+
return_residuals?: boolean;
|
|
26
|
+
/** Include robustness weights in result. Default: false. */
|
|
27
|
+
return_robustness_weights?: boolean;
|
|
28
|
+
/** Compute diagnostics (RMSE, MAE, R², etc.). Default: false. */
|
|
29
|
+
return_diagnostics?: boolean;
|
|
30
|
+
/** Include standard errors in result. Default: false. */
|
|
31
|
+
return_se?: boolean;
|
|
32
|
+
/** Confidence interval level (e.g. 0.95). Disabled when absent. */
|
|
33
|
+
confidence_intervals?: number;
|
|
34
|
+
/** Prediction interval level (e.g. 0.95). Disabled when absent. */
|
|
35
|
+
prediction_intervals?: number;
|
|
36
|
+
/** Enable parallel execution. Default: true. */
|
|
37
|
+
parallel?: boolean;
|
|
38
|
+
/** Fractions to test for cross-validation. CV disabled when absent. */
|
|
39
|
+
cv_fractions?: number[];
|
|
40
|
+
/** CV method ("kfold" or "loocv"). Default: "kfold". */
|
|
41
|
+
cv_method?: string;
|
|
42
|
+
/** Number of folds for k-fold CV. Default: 5. */
|
|
43
|
+
cv_k?: number;
|
|
44
|
+
/** Random seed for CV fold assignment. */
|
|
45
|
+
cv_seed?: number;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/** Configuration options for streaming LOWESS. */
|
|
49
|
+
export interface StreamingOptions {
|
|
50
|
+
/** Size of each processing chunk. Default: 5000. */
|
|
51
|
+
chunk_size?: number;
|
|
52
|
+
/** Overlap between adjacent chunks. Default: 500. */
|
|
53
|
+
overlap?: number;
|
|
54
|
+
/** Strategy for merging chunks (\"average\", \"weighted_average\", \"take_first\", \"take_last\"). Default: \"weighted_average\". */
|
|
55
|
+
merge_strategy?: string;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/** Configuration options for online LOWESS. */
|
|
59
|
+
export interface OnlineOptions {
|
|
60
|
+
/** Maximum number of points to retain in the sliding window. Default: 100. */
|
|
61
|
+
window_capacity?: number;
|
|
62
|
+
/** Minimum points required before smoothing starts. Default: 2. */
|
|
63
|
+
min_points?: number;
|
|
64
|
+
/** Update strategy ("full" or "incremental"). Default: "full". */
|
|
65
|
+
update_mode?: string;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/** Batch LOWESS smoother. */
|
|
69
|
+
export class Lowess {
|
|
70
|
+
free(): void;
|
|
71
|
+
constructor(options?: SmoothOptions);
|
|
72
|
+
/** Fit the model to data and return smoothed values. */
|
|
73
|
+
fit(x: Float64Array, y: Float64Array, customWeights?: Float64Array): LowessResult;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/** Streaming LOWESS smoother for large datasets. */
|
|
77
|
+
export class StreamingLowess {
|
|
78
|
+
free(): void;
|
|
79
|
+
constructor(options?: SmoothOptions, streamingOpts?: StreamingOptions);
|
|
80
|
+
/** Process a chunk of data. */
|
|
81
|
+
process_chunk(x: Float64Array, y: Float64Array): LowessResult;
|
|
82
|
+
/** Finalize the stream and return remaining data. */
|
|
83
|
+
finalize(): LowessResult;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
/** Online LOWESS smoother for real-time data. */
|
|
87
|
+
export class OnlineLowess {
|
|
88
|
+
free(): void;
|
|
89
|
+
constructor(options?: SmoothOptions, onlineOpts?: OnlineOptions);
|
|
90
|
+
/** Add a single point and get the smoothed output (or null if not enough points yet). */
|
|
91
|
+
add_point(x: number, y: number): OnlineOutput | null;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
/** Result from a single online update step. */
|
|
95
|
+
export class OnlineOutput {
|
|
96
|
+
free(): void;
|
|
97
|
+
get y(): number;
|
|
98
|
+
get standard_error(): number | undefined;
|
|
99
|
+
get residual(): number | undefined;
|
|
100
|
+
get robustness_weight(): number | undefined;
|
|
101
|
+
get iterations_used(): number | undefined;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
|
|
4
106
|
export class Diagnostics {
|
|
5
107
|
private constructor();
|
|
6
108
|
free(): void;
|
|
@@ -9,72 +111,46 @@ export class Diagnostics {
|
|
|
9
111
|
set aic(value: number | null | undefined);
|
|
10
112
|
get aicc(): number | undefined;
|
|
11
113
|
set aicc(value: number | null | undefined);
|
|
12
|
-
get
|
|
13
|
-
set
|
|
114
|
+
get effective_df(): number | undefined;
|
|
115
|
+
set effective_df(value: number | null | undefined);
|
|
14
116
|
mae: number;
|
|
15
|
-
|
|
16
|
-
|
|
117
|
+
r_squared: number;
|
|
118
|
+
residual_sd: number;
|
|
17
119
|
rmse: number;
|
|
18
120
|
}
|
|
19
121
|
|
|
20
|
-
export class
|
|
122
|
+
export class LowessResult {
|
|
21
123
|
private constructor();
|
|
22
124
|
free(): void;
|
|
23
125
|
[Symbol.dispose](): void;
|
|
24
|
-
readonly
|
|
25
|
-
readonly
|
|
26
|
-
readonly
|
|
126
|
+
readonly confidence_lower: Float64Array | undefined;
|
|
127
|
+
readonly confidence_upper: Float64Array | undefined;
|
|
128
|
+
readonly cv_scores: Float64Array | undefined;
|
|
27
129
|
readonly diagnostics: Diagnostics | undefined;
|
|
28
|
-
readonly
|
|
29
|
-
readonly
|
|
30
|
-
readonly
|
|
31
|
-
readonly
|
|
130
|
+
readonly fraction_used: number;
|
|
131
|
+
readonly iterations_used: number | undefined;
|
|
132
|
+
readonly prediction_lower: Float64Array | undefined;
|
|
133
|
+
readonly prediction_upper: Float64Array | undefined;
|
|
32
134
|
readonly residuals: Float64Array | undefined;
|
|
33
|
-
readonly
|
|
34
|
-
readonly
|
|
135
|
+
readonly robustness_weights: Float64Array | undefined;
|
|
136
|
+
readonly standard_errors: Float64Array | undefined;
|
|
35
137
|
readonly x: Float64Array;
|
|
36
138
|
readonly y: Float64Array;
|
|
37
139
|
}
|
|
38
140
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
*/
|
|
42
|
-
export class OnlineLowessWasm {
|
|
43
|
-
free(): void;
|
|
44
|
-
[Symbol.dispose](): void;
|
|
45
|
-
/**
|
|
46
|
-
* Create a new online smoother.
|
|
47
|
-
*/
|
|
48
|
-
constructor(options: any, online_opts: any);
|
|
49
|
-
update(x: number, y: number): number | undefined;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
/**
|
|
53
|
-
* Streaming LOWESS smoother.
|
|
54
|
-
*/
|
|
55
|
-
export class StreamingLowessWasm {
|
|
141
|
+
export class OnlineOutput {
|
|
142
|
+
private constructor();
|
|
56
143
|
free(): void;
|
|
57
144
|
[Symbol.dispose](): void;
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
processChunk(x: Float64Array, y: Float64Array): LowessResultWasm;
|
|
145
|
+
readonly iterations_used: number | undefined;
|
|
146
|
+
readonly residual: number | undefined;
|
|
147
|
+
readonly robustness_weight: number | undefined;
|
|
148
|
+
readonly standard_error: number | undefined;
|
|
149
|
+
readonly y: number;
|
|
64
150
|
}
|
|
65
151
|
|
|
66
152
|
export function init_panic_hook(): void;
|
|
67
153
|
|
|
68
|
-
/**
|
|
69
|
-
* Fit the LOWESS model to data.
|
|
70
|
-
*
|
|
71
|
-
* @param {Float64Array} x - X coordinates.
|
|
72
|
-
* @param {Float64Array} y - Y coordinates.
|
|
73
|
-
* @param {any} [options] - Configuration object.
|
|
74
|
-
* @returns {LowessResultWasm} The result of the smoothing.
|
|
75
|
-
*/
|
|
76
|
-
export function smooth(x: Float64Array, y: Float64Array, options: any): LowessResultWasm;
|
|
77
|
-
|
|
78
154
|
export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
|
|
79
155
|
|
|
80
156
|
export interface InitOutput {
|
|
@@ -82,41 +158,49 @@ export interface InitOutput {
|
|
|
82
158
|
readonly __wbg_diagnostics_free: (a: number, b: number) => void;
|
|
83
159
|
readonly __wbg_get_diagnostics_aic: (a: number) => [number, number];
|
|
84
160
|
readonly __wbg_get_diagnostics_aicc: (a: number) => [number, number];
|
|
85
|
-
readonly
|
|
161
|
+
readonly __wbg_get_diagnostics_effective_df: (a: number) => [number, number];
|
|
86
162
|
readonly __wbg_get_diagnostics_mae: (a: number) => number;
|
|
87
|
-
readonly
|
|
88
|
-
readonly
|
|
163
|
+
readonly __wbg_get_diagnostics_r_squared: (a: number) => number;
|
|
164
|
+
readonly __wbg_get_diagnostics_residual_sd: (a: number) => number;
|
|
89
165
|
readonly __wbg_get_diagnostics_rmse: (a: number) => number;
|
|
90
|
-
readonly
|
|
91
|
-
readonly
|
|
166
|
+
readonly __wbg_lowess_free: (a: number, b: number) => void;
|
|
167
|
+
readonly __wbg_lowessresult_free: (a: number, b: number) => void;
|
|
168
|
+
readonly __wbg_onlinelowess_free: (a: number, b: number) => void;
|
|
169
|
+
readonly __wbg_onlineoutput_free: (a: number, b: number) => void;
|
|
92
170
|
readonly __wbg_set_diagnostics_aic: (a: number, b: number, c: number) => void;
|
|
93
171
|
readonly __wbg_set_diagnostics_aicc: (a: number, b: number, c: number) => void;
|
|
94
|
-
readonly
|
|
172
|
+
readonly __wbg_set_diagnostics_effective_df: (a: number, b: number, c: number) => void;
|
|
95
173
|
readonly __wbg_set_diagnostics_mae: (a: number, b: number) => void;
|
|
96
|
-
readonly
|
|
97
|
-
readonly
|
|
174
|
+
readonly __wbg_set_diagnostics_r_squared: (a: number, b: number) => void;
|
|
175
|
+
readonly __wbg_set_diagnostics_residual_sd: (a: number, b: number) => void;
|
|
98
176
|
readonly __wbg_set_diagnostics_rmse: (a: number, b: number) => void;
|
|
99
|
-
readonly
|
|
100
|
-
readonly
|
|
101
|
-
readonly
|
|
102
|
-
readonly
|
|
103
|
-
readonly
|
|
104
|
-
readonly
|
|
105
|
-
readonly
|
|
106
|
-
readonly
|
|
107
|
-
readonly
|
|
108
|
-
readonly
|
|
109
|
-
readonly
|
|
110
|
-
readonly
|
|
111
|
-
readonly
|
|
112
|
-
readonly
|
|
113
|
-
readonly
|
|
114
|
-
readonly
|
|
115
|
-
readonly
|
|
116
|
-
readonly
|
|
117
|
-
readonly
|
|
118
|
-
readonly
|
|
177
|
+
readonly __wbg_streaminglowess_free: (a: number, b: number) => void;
|
|
178
|
+
readonly lowess_fit: (a: number, b: any, c: any, d: number, e: number) => [number, number, number];
|
|
179
|
+
readonly lowessresult_confidence_lower: (a: number) => any;
|
|
180
|
+
readonly lowessresult_confidence_upper: (a: number) => any;
|
|
181
|
+
readonly lowessresult_cv_scores: (a: number) => any;
|
|
182
|
+
readonly lowessresult_diagnostics: (a: number) => number;
|
|
183
|
+
readonly lowessresult_fraction_used: (a: number) => number;
|
|
184
|
+
readonly lowessresult_iterations_used: (a: number) => number;
|
|
185
|
+
readonly lowessresult_prediction_lower: (a: number) => any;
|
|
186
|
+
readonly lowessresult_prediction_upper: (a: number) => any;
|
|
187
|
+
readonly lowessresult_residuals: (a: number) => any;
|
|
188
|
+
readonly lowessresult_robustness_weights: (a: number) => any;
|
|
189
|
+
readonly lowessresult_standard_errors: (a: number) => any;
|
|
190
|
+
readonly lowessresult_x: (a: number) => any;
|
|
191
|
+
readonly lowessresult_y: (a: number) => any;
|
|
192
|
+
readonly onlinelowess_add_point: (a: number, b: number, c: number) => [number, number, number];
|
|
193
|
+
readonly onlinelowess_new: (a: any, b: any) => [number, number, number];
|
|
194
|
+
readonly onlineoutput_iterations_used: (a: number) => number;
|
|
195
|
+
readonly onlineoutput_residual: (a: number) => [number, number];
|
|
196
|
+
readonly onlineoutput_robustness_weight: (a: number) => [number, number];
|
|
197
|
+
readonly onlineoutput_standard_error: (a: number) => [number, number];
|
|
198
|
+
readonly onlineoutput_y: (a: number) => number;
|
|
199
|
+
readonly streaminglowess_finalize: (a: number) => [number, number, number];
|
|
200
|
+
readonly streaminglowess_new: (a: any, b: any) => [number, number, number];
|
|
201
|
+
readonly streaminglowess_process_chunk: (a: number, b: any, c: any) => [number, number, number];
|
|
119
202
|
readonly init_panic_hook: () => void;
|
|
203
|
+
readonly lowess_new: (a: any) => number;
|
|
120
204
|
readonly __wbindgen_malloc: (a: number, b: number) => number;
|
|
121
205
|
readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
|
|
122
206
|
readonly __wbindgen_exn_store: (a: number) => void;
|