fastlowess-wasm 3.2.1 → 4.1.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 CHANGED
@@ -12,7 +12,7 @@
12
12
  <em>One LOWESS to Rule Them All</em>
13
13
  </p>
14
14
 
15
- The fastest, most robust, and most feature-complete language-agnostic LOWESS (Locally Weighted Scatterplot Smoothing) implementation for **Rust**, **Python**, **R**, **Julia**, **JavaScript**, **C++**, **Go**, **Java**, and **WebAssembly**.
15
+ The fastest, most robust, and most feature-complete language-agnostic LOWESS (Locally Weighted Scatterplot Smoothing) implementation for **Rust**, **Python**, **R**, **Julia**, **Node.js**, **C++**, **Go**, **Java**, and **WebAssembly**.
16
16
 
17
17
  The `lowess-project` also offers bindings for Rust, Python, R, Julia, Node.js, WebAssembly, C++, Go, and Java — see the [full repository](https://github.com/thisisamirv/lowess-project).
18
18
 
@@ -21,35 +21,153 @@ export interface SmoothOptions {
21
21
  scaling_method?: string;
22
22
  /** Auto-convergence tolerance. Disabled when absent. */
23
23
  auto_converge?: number;
24
- /** Include residuals in result. Default: false. */
24
+ /** Include residuals in result. Ignored by OnlineLowess (`residual` is always included regardless). Default: false. */
25
25
  return_residuals?: boolean;
26
26
  /** Include robustness weights in result. Default: false. */
27
27
  return_robustness_weights?: boolean;
28
- /** Compute diagnostics (RMSE, MAE, R2, etc.). Default: false. */
28
+ /** Include the per-point local fit derivative (slope) in result. Default: false. */
29
+ return_derivative?: boolean;
30
+ /** Compute diagnostics (RMSE, MAE, R2, etc.). Ignored by OnlineLowess (it has no diagnostics field). Default: false. */
29
31
  return_diagnostics?: boolean;
30
- /** Include standard errors in result. Default: false. */
32
+ /** Include standard errors in result. Batch (Lowess) only; ignored by StreamingLowess/OnlineLowess. Default: false. */
31
33
  return_se?: boolean;
32
- /** Confidence interval level (e.g. 0.95). Disabled when absent. */
34
+ /** Return results sorted ascending by x instead of in original input order. Batch (Lowess) only; ignored by StreamingLowess/OnlineLowess. Default: false. */
35
+ return_sorted?: boolean;
36
+ /** Confidence interval level (e.g. 0.95). Batch (Lowess) only; ignored by StreamingLowess/OnlineLowess. Disabled when absent. */
33
37
  confidence_intervals?: number;
34
- /** Prediction interval level (e.g. 0.95). Disabled when absent. */
38
+ /** Prediction interval level (e.g. 0.95). Batch (Lowess) only; ignored by StreamingLowess/OnlineLowess. Disabled when absent. */
35
39
  prediction_intervals?: number;
36
- /** Enable parallel execution. Default: true. */
40
+ /** Enable parallel execution. Ignored by OnlineLowess (it processes one point at a time). Default: true. */
37
41
  parallel?: boolean;
38
- /** Fractions to test for cross-validation. CV disabled when absent. */
42
+ /** Fractions to test for cross-validation. Batch (Lowess) only; ignored by StreamingLowess/OnlineLowess. CV disabled when absent. */
39
43
  cv_fractions?: number[];
40
- /** CV method ("kfold" or "loocv"). Default: "kfold". */
44
+ /** CV method ("kfold" or "loocv"). Batch (Lowess) only; ignored by StreamingLowess/OnlineLowess. Default: "kfold". */
41
45
  cv_method?: string;
42
- /** Number of folds for k-fold CV. Default: 5. */
46
+ /** Number of folds for k-fold CV. Batch (Lowess) only; ignored by StreamingLowess/OnlineLowess. Default: 5. */
43
47
  cv_k?: number;
44
- /** Random seed for CV fold assignment. */
48
+ /** Random seed for CV fold assignment. Batch (Lowess) only; ignored by StreamingLowess/OnlineLowess. */
45
49
  cv_seed?: number;
50
+ /** Policy for non-finite (NaN/Inf) values in input data ("error", "drop"). Default: "error". */
51
+ missing?: string;
52
+ /** Retain the fitted model's training data, enabling `LowessResult.predict()`. Batch (Lowess) only. Default: false. */
53
+ retain_model?: boolean;
54
+ }
55
+
56
+ /** Options for `LowessResult.predict()`. */
57
+ export interface PredictOptions {
58
+ /** Include standard errors in the output. Default: false. */
59
+ return_se?: boolean;
60
+ /** Confidence interval coverage level (e.g. 0.95). Disabled when absent. */
61
+ confidence_level?: number;
62
+ /** Prediction interval coverage level (e.g. 0.95). Disabled when absent. */
63
+ prediction_level?: number;
64
+ /** Include the local fit's derivative (slope) in the output. Default: false. */
65
+ return_derivative?: boolean;
66
+ /** Behavior for query points outside the training range ("clamp", "linear", "error"). Default: "clamp". */
67
+ extrapolation?: string;
68
+ /** Under "linear" extrapolation, the maximum allowed distance beyond the training boundary before `predict()` errors instead of returning an unbounded value. */
69
+ max_extrapolation_distance?: number;
70
+ /** Maximum allowed distance to the farthest point in a query's local window before `predict()` errors, catching in-range-but-sparse query points. */
71
+ max_neighbor_distance?: number;
72
+ }
73
+
74
+ /** Result of `LowessResult.predict()`. */
75
+ export interface PredictOutput {
76
+ /** Predicted y values, one per query point. */
77
+ readonly y: Float64Array;
78
+ /** Standard errors (if requested). */
79
+ readonly standard_errors: Float64Array | undefined;
80
+ /** Lower confidence interval bounds (if requested). */
81
+ readonly confidence_lower: Float64Array | undefined;
82
+ /** Upper confidence interval bounds (if requested). */
83
+ readonly confidence_upper: Float64Array | undefined;
84
+ /** Lower prediction interval bounds (if requested). */
85
+ readonly prediction_lower: Float64Array | undefined;
86
+ /** Upper prediction interval bounds (if requested). */
87
+ readonly prediction_upper: Float64Array | undefined;
88
+ /** Local fit's derivative (slope) at each query point (if requested). */
89
+ readonly derivative: Float64Array | undefined;
90
+ }
91
+
92
+ /** Configuration options for streaming LOWESS smoothing. A subset of `SmoothOptions`: cross-validation and `return_sorted` have no equivalent here. */
93
+ export interface StreamingSmoothOptions {
94
+ /** Smoothing fraction (0 < fraction <= 1). Default: 0.67. */
95
+ fraction?: number;
96
+ /** Number of robustness iterations. Default: 3. */
97
+ iterations?: number;
98
+ /** Delta for interpolation speedup. Default: auto. Set to 0 to disable. */
99
+ delta?: number;
100
+ /** Kernel function ("tricube", "epanechnikov", "gaussian", "uniform", "biweight", "triangle", "cosine"). Default: "tricube". */
101
+ weight_function?: string;
102
+ /** Robustness method ("bisquare", "huber", "talwar"). Default: "bisquare". */
103
+ robustness_method?: string;
104
+ /** Fallback when all weights are zero ("use_local_mean", "return_original", "return_none"). Default: "use_local_mean". */
105
+ zero_weight_fallback?: string;
106
+ /** Boundary handling ("extend", "reflect", "zero", "noboundary"). Default: "extend". */
107
+ boundary_policy?: string;
108
+ /** Scaling method ("mad", "mar", "mean"). Default: "mad". */
109
+ scaling_method?: string;
110
+ /** Auto-convergence tolerance. Disabled when absent. */
111
+ auto_converge?: number;
112
+ /** Include residuals in result. Default: false. */
113
+ return_residuals?: boolean;
114
+ /** Include robustness weights in result. Default: false. */
115
+ return_robustness_weights?: boolean;
116
+ /** Include the per-point local fit derivative (slope) in result. Default: false. */
117
+ return_derivative?: boolean;
118
+ /** Compute diagnostics (RMSE, MAE, R2, etc.). Default: false. */
119
+ return_diagnostics?: boolean;
120
+ /** Compute standard errors. Default: false. */
121
+ return_se?: boolean;
122
+ /** Calculate confidence intervals (e.g., 0.95). Default: undefined. */
123
+ confidence_intervals?: number;
124
+ /** Calculate prediction intervals. Default: undefined. */
125
+ prediction_intervals?: number;
126
+ /** Enable parallel execution. Default: true. */
127
+ parallel?: boolean;
128
+ /** Policy for non-finite (NaN/Inf) values in each chunk ("error", "drop"). Default: "error". */
129
+ missing?: string;
130
+ }
131
+
132
+ /** Configuration options for online LOWESS smoothing. A subset of `SmoothOptions`: diagnostics, residuals, parallel execution, cross-validation, and `return_sorted` have no equivalent here. `return_se`/`confidence_intervals`/`prediction_intervals` require `update_mode = "full"`. */
133
+ export interface OnlineSmoothOptions {
134
+ /** Smoothing fraction (0 < fraction <= 1). Default: 0.67. */
135
+ fraction?: number;
136
+ /** Number of robustness iterations. Requires `update_mode = "full"`. Default: 0. */
137
+ iterations?: number;
138
+ /** Delta for interpolation speedup. Default: auto. Set to 0 to disable. */
139
+ delta?: number;
140
+ /** Kernel function ("tricube", "epanechnikov", "gaussian", "uniform", "biweight", "triangle", "cosine"). Default: "tricube". */
141
+ weight_function?: string;
142
+ /** Robustness method ("bisquare", "huber", "talwar"). Default: "bisquare". */
143
+ robustness_method?: string;
144
+ /** Fallback when all weights are zero ("use_local_mean", "return_original", "return_none"). Default: "use_local_mean". */
145
+ zero_weight_fallback?: string;
146
+ /** Boundary handling ("extend", "reflect", "zero", "noboundary"). Default: "extend". */
147
+ boundary_policy?: string;
148
+ /** Scaling method ("mad", "mar", "mean"). Default: "mad". */
149
+ scaling_method?: string;
150
+ /** Auto-convergence tolerance. Disabled when absent. */
151
+ auto_converge?: number;
152
+ /** Include robustness weights in result. Default: false. */
153
+ return_robustness_weights?: boolean;
154
+ /** Include the latest point's local fit derivative (slope) in result. Default: false. */
155
+ return_derivative?: boolean;
156
+ /** Policy for non-finite (NaN/Inf) `x`/`y` values passed to `add_point` ("error", "drop"). Default: "error". */
157
+ missing?: string;
158
+ /** Compute standard errors. Requires `update_mode = "full"`. Default: false. */
159
+ return_se?: boolean;
160
+ /** Calculate confidence intervals (e.g., 0.95). Requires `update_mode = "full"`. Default: undefined. */
161
+ confidence_intervals?: number;
162
+ /** Calculate prediction intervals. Requires `update_mode = "full"`. Default: undefined. */
163
+ prediction_intervals?: number;
46
164
  }
47
165
 
48
166
  /** Configuration options for streaming LOWESS. */
49
167
  export interface StreamingOptions {
50
168
  /** Size of each processing chunk. Default: 5000. */
51
169
  chunk_size?: number;
52
- /** Overlap between adjacent chunks. Default: 500. */
170
+ /** Overlap between adjacent chunks. Default: chunk_size / 10, min. 1. */
53
171
  overlap?: number;
54
172
  /** Strategy for merging chunks (\"average\", \"weighted_average\", \"take_first\", \"take_last\"). Default: \"weighted_average\". */
55
173
  merge_strategy?: string;
@@ -57,11 +175,11 @@ export interface StreamingOptions {
57
175
 
58
176
  /** Configuration options for online LOWESS. */
59
177
  export interface OnlineOptions {
60
- /** Maximum number of points to retain in the sliding window. Default: 100. */
178
+ /** Maximum number of points to retain in the sliding window. Default: 1000. */
61
179
  window_capacity?: number;
62
180
  /** Minimum points required before smoothing starts. Default: 2. */
63
181
  min_points?: number;
64
- /** Update strategy ("full" or "incremental"). Default: "full". */
182
+ /** Update strategy ("full" or "incremental"). Default: "incremental". */
65
183
  update_mode?: string;
66
184
  }
67
185
 
@@ -76,7 +194,7 @@ export class Lowess {
76
194
  /** Streaming LOWESS smoother for large datasets. */
77
195
  export class StreamingLowess {
78
196
  free(): void;
79
- constructor(options?: SmoothOptions, streamingOpts?: StreamingOptions);
197
+ constructor(options?: StreamingSmoothOptions, streamingOpts?: StreamingOptions);
80
198
  /** Process a chunk of data. */
81
199
  process_chunk(x: Float64Array, y: Float64Array): LowessResult;
82
200
  /** Finalize the stream and return remaining data. */
@@ -86,7 +204,7 @@ export class StreamingLowess {
86
204
  /** Online LOWESS smoother for real-time data. */
87
205
  export class OnlineLowess {
88
206
  free(): void;
89
- constructor(options?: SmoothOptions, onlineOpts?: OnlineOptions);
207
+ constructor(options?: OnlineSmoothOptions, onlineOpts?: OnlineOptions);
90
208
  /** Add a single point and get the smoothed output (or null if not enough points yet). */
91
209
  add_point(x: number, y: number): OnlineOutput | null;
92
210
  }
@@ -99,6 +217,11 @@ export class OnlineOutput {
99
217
  get residual(): number | undefined;
100
218
  get robustness_weight(): number | undefined;
101
219
  get iterations_used(): number | undefined;
220
+ get derivative(): number | undefined;
221
+ get confidence_lower(): number | undefined;
222
+ get confidence_upper(): number | undefined;
223
+ get prediction_lower(): number | undefined;
224
+ get prediction_upper(): number | undefined;
102
225
  }
103
226
 
104
227
 
@@ -126,6 +249,7 @@ export class LowessResult {
126
249
  readonly confidence_lower: Float64Array | undefined;
127
250
  readonly confidence_upper: Float64Array | undefined;
128
251
  readonly cv_scores: Float64Array | undefined;
252
+ readonly derivative: Float64Array | undefined;
129
253
  readonly diagnostics: Diagnostics | undefined;
130
254
  readonly fraction_used: number;
131
255
  readonly iterations_used: number | undefined;
@@ -142,7 +266,12 @@ export class OnlineOutput {
142
266
  private constructor();
143
267
  free(): void;
144
268
  [Symbol.dispose](): void;
269
+ readonly confidence_lower: number | undefined;
270
+ readonly confidence_upper: number | undefined;
271
+ readonly derivative: number | undefined;
145
272
  readonly iterations_used: number | undefined;
273
+ readonly prediction_lower: number | undefined;
274
+ readonly prediction_upper: number | undefined;
146
275
  readonly residual: number | undefined;
147
276
  readonly robustness_weight: number | undefined;
148
277
  readonly standard_error: number | undefined;
@@ -167,6 +296,7 @@ export interface InitOutput {
167
296
  readonly __wbg_lowessresult_free: (a: number, b: number) => void;
168
297
  readonly __wbg_onlinelowess_free: (a: number, b: number) => void;
169
298
  readonly __wbg_onlineoutput_free: (a: number, b: number) => void;
299
+ readonly __wbg_predictoutput_free: (a: number, b: number) => void;
170
300
  readonly __wbg_set_diagnostics_aic: (a: number, b: number, c: number) => void;
171
301
  readonly __wbg_set_diagnostics_aicc: (a: number, b: number, c: number) => void;
172
302
  readonly __wbg_set_diagnostics_effective_df: (a: number, b: number, c: number) => void;
@@ -175,13 +305,17 @@ export interface InitOutput {
175
305
  readonly __wbg_set_diagnostics_residual_sd: (a: number, b: number) => void;
176
306
  readonly __wbg_set_diagnostics_rmse: (a: number, b: number) => void;
177
307
  readonly __wbg_streaminglowess_free: (a: number, b: number) => void;
308
+ readonly init_panic_hook: () => void;
178
309
  readonly lowess_fit: (a: number, b: any, c: any, d: number, e: number) => [number, number, number];
310
+ readonly lowess_new: (a: any) => number;
179
311
  readonly lowessresult_confidence_lower: (a: number) => any;
180
312
  readonly lowessresult_confidence_upper: (a: number) => any;
181
313
  readonly lowessresult_cv_scores: (a: number) => any;
314
+ readonly lowessresult_derivative: (a: number) => any;
182
315
  readonly lowessresult_diagnostics: (a: number) => number;
183
316
  readonly lowessresult_fraction_used: (a: number) => number;
184
317
  readonly lowessresult_iterations_used: (a: number) => number;
318
+ readonly lowessresult_predict: (a: number, b: any, c: any) => [number, number, number];
185
319
  readonly lowessresult_prediction_lower: (a: number) => any;
186
320
  readonly lowessresult_prediction_upper: (a: number) => any;
187
321
  readonly lowessresult_residuals: (a: number) => any;
@@ -191,16 +325,26 @@ export interface InitOutput {
191
325
  readonly lowessresult_y: (a: number) => any;
192
326
  readonly onlinelowess_add_point: (a: number, b: number, c: number) => [number, number, number];
193
327
  readonly onlinelowess_new: (a: any, b: any) => [number, number, number];
328
+ readonly onlineoutput_confidence_lower: (a: number) => [number, number];
329
+ readonly onlineoutput_confidence_upper: (a: number) => [number, number];
330
+ readonly onlineoutput_derivative: (a: number) => [number, number];
194
331
  readonly onlineoutput_iterations_used: (a: number) => number;
332
+ readonly onlineoutput_prediction_lower: (a: number) => [number, number];
333
+ readonly onlineoutput_prediction_upper: (a: number) => [number, number];
195
334
  readonly onlineoutput_residual: (a: number) => [number, number];
196
335
  readonly onlineoutput_robustness_weight: (a: number) => [number, number];
197
336
  readonly onlineoutput_standard_error: (a: number) => [number, number];
198
337
  readonly onlineoutput_y: (a: number) => number;
338
+ readonly predictoutput_confidence_lower: (a: number) => any;
339
+ readonly predictoutput_confidence_upper: (a: number) => any;
340
+ readonly predictoutput_derivative: (a: number) => any;
341
+ readonly predictoutput_prediction_lower: (a: number) => any;
342
+ readonly predictoutput_prediction_upper: (a: number) => any;
343
+ readonly predictoutput_standard_errors: (a: number) => any;
344
+ readonly predictoutput_y: (a: number) => any;
199
345
  readonly streaminglowess_finalize: (a: number) => [number, number, number];
200
346
  readonly streaminglowess_new: (a: any, b: any) => [number, number, number];
201
347
  readonly streaminglowess_process_chunk: (a: number, b: any, c: any) => [number, number, number];
202
- readonly init_panic_hook: () => void;
203
- readonly lowess_new: (a: any) => number;
204
348
  readonly __wbindgen_malloc: (a: number, b: number) => number;
205
349
  readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
206
350
  readonly __wbindgen_exn_store: (a: number) => void;
@@ -189,6 +189,13 @@ export class LowessResult {
189
189
  const ret = wasm.lowessresult_cv_scores(this.__wbg_ptr);
190
190
  return ret;
191
191
  }
192
+ /**
193
+ * @returns {Float64Array | undefined}
194
+ */
195
+ get derivative() {
196
+ const ret = wasm.lowessresult_derivative(this.__wbg_ptr);
197
+ return ret;
198
+ }
192
199
  /**
193
200
  * @returns {Diagnostics | undefined}
194
201
  */
@@ -210,6 +217,21 @@ export class LowessResult {
210
217
  const ret = wasm.lowessresult_iterations_used(this.__wbg_ptr);
211
218
  return ret === Number.MAX_SAFE_INTEGER ? undefined : ret;
212
219
  }
220
+ /**
221
+ * Evaluate the fitted model at out-of-sample query points not in the training set.
222
+ *
223
+ * Requires `retain_model: true` to have been set on the builder before `fit()`.
224
+ * @param {Float64Array} new_x
225
+ * @param {any} options
226
+ * @returns {PredictOutput}
227
+ */
228
+ predict(new_x, options) {
229
+ const ret = wasm.lowessresult_predict(this.__wbg_ptr, new_x, options);
230
+ if (ret[2]) {
231
+ throw takeFromExternrefTable0(ret[1]);
232
+ }
233
+ return PredictOutput.__wrap(ret[0]);
234
+ }
213
235
  /**
214
236
  * @returns {Float64Array | undefined}
215
237
  */
@@ -318,6 +340,27 @@ export class OnlineOutput {
318
340
  const ptr = this.__destroy_into_raw();
319
341
  wasm.__wbg_onlineoutput_free(ptr, 0);
320
342
  }
343
+ /**
344
+ * @returns {number | undefined}
345
+ */
346
+ get confidence_lower() {
347
+ const ret = wasm.onlineoutput_confidence_lower(this.__wbg_ptr);
348
+ return ret[0] === 0 ? undefined : ret[1];
349
+ }
350
+ /**
351
+ * @returns {number | undefined}
352
+ */
353
+ get confidence_upper() {
354
+ const ret = wasm.onlineoutput_confidence_upper(this.__wbg_ptr);
355
+ return ret[0] === 0 ? undefined : ret[1];
356
+ }
357
+ /**
358
+ * @returns {number | undefined}
359
+ */
360
+ get derivative() {
361
+ const ret = wasm.onlineoutput_derivative(this.__wbg_ptr);
362
+ return ret[0] === 0 ? undefined : ret[1];
363
+ }
321
364
  /**
322
365
  * @returns {number | undefined}
323
366
  */
@@ -325,6 +368,20 @@ export class OnlineOutput {
325
368
  const ret = wasm.onlineoutput_iterations_used(this.__wbg_ptr);
326
369
  return ret === Number.MAX_SAFE_INTEGER ? undefined : ret;
327
370
  }
371
+ /**
372
+ * @returns {number | undefined}
373
+ */
374
+ get prediction_lower() {
375
+ const ret = wasm.onlineoutput_prediction_lower(this.__wbg_ptr);
376
+ return ret[0] === 0 ? undefined : ret[1];
377
+ }
378
+ /**
379
+ * @returns {number | undefined}
380
+ */
381
+ get prediction_upper() {
382
+ const ret = wasm.onlineoutput_prediction_upper(this.__wbg_ptr);
383
+ return ret[0] === 0 ? undefined : ret[1];
384
+ }
328
385
  /**
329
386
  * @returns {number | undefined}
330
387
  */
@@ -356,6 +413,78 @@ export class OnlineOutput {
356
413
  }
357
414
  if (Symbol.dispose) OnlineOutput.prototype[Symbol.dispose] = OnlineOutput.prototype.free;
358
415
 
416
+ /**
417
+ * Result of `LowessResult.predict()`.
418
+ */
419
+ export class PredictOutput {
420
+ static __wrap(ptr) {
421
+ const obj = Object.create(PredictOutput.prototype);
422
+ obj.__wbg_ptr = ptr;
423
+ PredictOutputFinalization.register(obj, obj.__wbg_ptr, obj);
424
+ return obj;
425
+ }
426
+ __destroy_into_raw() {
427
+ const ptr = this.__wbg_ptr;
428
+ this.__wbg_ptr = 0;
429
+ PredictOutputFinalization.unregister(this);
430
+ return ptr;
431
+ }
432
+ free() {
433
+ const ptr = this.__destroy_into_raw();
434
+ wasm.__wbg_predictoutput_free(ptr, 0);
435
+ }
436
+ /**
437
+ * @returns {Float64Array | undefined}
438
+ */
439
+ get confidence_lower() {
440
+ const ret = wasm.predictoutput_confidence_lower(this.__wbg_ptr);
441
+ return ret;
442
+ }
443
+ /**
444
+ * @returns {Float64Array | undefined}
445
+ */
446
+ get confidence_upper() {
447
+ const ret = wasm.predictoutput_confidence_upper(this.__wbg_ptr);
448
+ return ret;
449
+ }
450
+ /**
451
+ * @returns {Float64Array | undefined}
452
+ */
453
+ get derivative() {
454
+ const ret = wasm.predictoutput_derivative(this.__wbg_ptr);
455
+ return ret;
456
+ }
457
+ /**
458
+ * @returns {Float64Array | undefined}
459
+ */
460
+ get prediction_lower() {
461
+ const ret = wasm.predictoutput_prediction_lower(this.__wbg_ptr);
462
+ return ret;
463
+ }
464
+ /**
465
+ * @returns {Float64Array | undefined}
466
+ */
467
+ get prediction_upper() {
468
+ const ret = wasm.predictoutput_prediction_upper(this.__wbg_ptr);
469
+ return ret;
470
+ }
471
+ /**
472
+ * @returns {Float64Array | undefined}
473
+ */
474
+ get standard_errors() {
475
+ const ret = wasm.predictoutput_standard_errors(this.__wbg_ptr);
476
+ return ret;
477
+ }
478
+ /**
479
+ * @returns {Float64Array}
480
+ */
481
+ get y() {
482
+ const ret = wasm.predictoutput_y(this.__wbg_ptr);
483
+ return ret;
484
+ }
485
+ }
486
+ if (Symbol.dispose) PredictOutput.prototype[Symbol.dispose] = PredictOutput.prototype.free;
487
+
359
488
  export class StreamingLowess {
360
489
  __destroy_into_raw() {
361
490
  const ptr = this.__wbg_ptr;
@@ -411,72 +540,72 @@ export function init_panic_hook() {
411
540
  function __wbg_get_imports() {
412
541
  const import0 = {
413
542
  __proto__: null,
414
- __wbg_Error_408e67f47ca7b58b: function(arg0, arg1) {
543
+ __wbg_Error_67e7344beaa85059: function(arg0, arg1) {
415
544
  const ret = Error(getStringFromWasm0(arg0, arg1));
416
545
  return ret;
417
546
  },
418
- __wbg_Number_3890faa6d3ff057d: function(arg0) {
547
+ __wbg_Number_c54e7112a3fa7e3e: function(arg0) {
419
548
  const ret = Number(arg0);
420
549
  return ret;
421
550
  },
422
- __wbg___wbindgen_bigint_get_as_i64_c4ecf48528083721: function(arg0, arg1) {
551
+ __wbg___wbindgen_bigint_get_as_i64_b482365c149396c8: function(arg0, arg1) {
423
552
  const v = arg1;
424
553
  const ret = typeof(v) === 'bigint' ? v : undefined;
425
554
  getDataViewMemory0().setBigInt64(arg0 + 8 * 1, isLikeNone(ret) ? BigInt(0) : ret, true);
426
555
  getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
427
556
  },
428
- __wbg___wbindgen_boolean_get_c9c83ebd41b34df3: function(arg0) {
557
+ __wbg___wbindgen_boolean_get_7a12af2b3f899c5a: function(arg0) {
429
558
  const v = arg0;
430
559
  const ret = typeof(v) === 'boolean' ? v : undefined;
431
560
  return isLikeNone(ret) ? 0xFFFFFF : ret ? 1 : 0;
432
561
  },
433
- __wbg___wbindgen_debug_string_a57024b9c6e4a48b: function(arg0, arg1) {
562
+ __wbg___wbindgen_debug_string_0e68cf47c9cbd9b0: function(arg0, arg1) {
434
563
  const ret = debugString(arg1);
435
564
  const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
436
565
  const len1 = WASM_VECTOR_LEN;
437
566
  getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
438
567
  getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
439
568
  },
440
- __wbg___wbindgen_in_ac983077f137f2e6: function(arg0, arg1) {
569
+ __wbg___wbindgen_in_50072d4d6e45c193: function(arg0, arg1) {
441
570
  const ret = arg0 in arg1;
442
571
  return ret;
443
572
  },
444
- __wbg___wbindgen_is_bigint_8ffbbef442139384: function(arg0) {
573
+ __wbg___wbindgen_is_bigint_60fc0336cb14f5d7: function(arg0) {
445
574
  const ret = typeof(arg0) === 'bigint';
446
575
  return ret;
447
576
  },
448
- __wbg___wbindgen_is_function_5e4570eb24ffa122: function(arg0) {
577
+ __wbg___wbindgen_is_function_fcda5e3902d732fe: function(arg0) {
449
578
  const ret = typeof(arg0) === 'function';
450
579
  return ret;
451
580
  },
452
- __wbg___wbindgen_is_null_7d13f41e1a2d5140: function(arg0) {
581
+ __wbg___wbindgen_is_null_5160b3e381865372: function(arg0) {
453
582
  const ret = arg0 === null;
454
583
  return ret;
455
584
  },
456
- __wbg___wbindgen_is_object_a2790eb24c211ea0: function(arg0) {
585
+ __wbg___wbindgen_is_object_edb6b15aa3afe12e: function(arg0) {
457
586
  const val = arg0;
458
587
  const ret = typeof(val) === 'object' && val !== null;
459
588
  return ret;
460
589
  },
461
- __wbg___wbindgen_is_undefined_6cff064c44e0d823: function(arg0) {
590
+ __wbg___wbindgen_is_undefined_8c687d0b90d5b524: function(arg0) {
462
591
  const ret = arg0 === undefined;
463
592
  return ret;
464
593
  },
465
- __wbg___wbindgen_jsval_eq_0a18949a61670320: function(arg0, arg1) {
594
+ __wbg___wbindgen_jsval_eq_9fdcd3c0a860dd3b: function(arg0, arg1) {
466
595
  const ret = arg0 === arg1;
467
596
  return ret;
468
597
  },
469
- __wbg___wbindgen_jsval_loose_eq_acf2776254a8d832: function(arg0, arg1) {
598
+ __wbg___wbindgen_jsval_loose_eq_3c30021c243b64cd: function(arg0, arg1) {
470
599
  const ret = arg0 == arg1;
471
600
  return ret;
472
601
  },
473
- __wbg___wbindgen_number_get_136b9679cab35cfb: function(arg0, arg1) {
602
+ __wbg___wbindgen_number_get_1dc732b810cb937c: function(arg0, arg1) {
474
603
  const obj = arg1;
475
604
  const ret = typeof(obj) === 'number' ? obj : undefined;
476
605
  getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true);
477
606
  getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
478
607
  },
479
- __wbg___wbindgen_string_get_d154f1e671052120: function(arg0, arg1) {
608
+ __wbg___wbindgen_string_get_92ab86bb19cbc12f: function(arg0, arg1) {
480
609
  const obj = arg1;
481
610
  const ret = typeof(obj) === 'string' ? obj : undefined;
482
611
  var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
@@ -484,14 +613,14 @@ function __wbg_get_imports() {
484
613
  getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
485
614
  getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
486
615
  },
487
- __wbg___wbindgen_throw_bb96b2010945f0bc: function(arg0, arg1) {
616
+ __wbg___wbindgen_throw_5d9e815e6fdf150f: function(arg0, arg1) {
488
617
  throw new Error(getStringFromWasm0(arg0, arg1));
489
618
  },
490
- __wbg_call_1c5886ab9c57d1c7: function() { return handleError(function (arg0, arg1) {
619
+ __wbg_call_269c5566fbede3eb: function() { return handleError(function (arg0, arg1) {
491
620
  const ret = arg0.call(arg1);
492
621
  return ret;
493
622
  }, arguments); },
494
- __wbg_done_669171204c3dcae2: function(arg0) {
623
+ __wbg_done_cffed884d87aa22e: function(arg0) {
495
624
  const ret = arg0.done;
496
625
  return ret;
497
626
  },
@@ -506,11 +635,11 @@ function __wbg_get_imports() {
506
635
  wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
507
636
  }
508
637
  },
509
- __wbg_get_d173c0308df22d37: function() { return handleError(function (arg0, arg1) {
638
+ __wbg_get_6cf5a4d4d8ad3c5a: function() { return handleError(function (arg0, arg1) {
510
639
  const ret = Reflect.get(arg0, arg1);
511
640
  return ret;
512
641
  }, arguments); },
513
- __wbg_get_unchecked_e20b893aeafc3fca: function(arg0, arg1) {
642
+ __wbg_get_unchecked_363572bdd397d473: function(arg0, arg1) {
514
643
  const ret = arg0[arg1 >>> 0];
515
644
  return ret;
516
645
  },
@@ -518,7 +647,7 @@ function __wbg_get_imports() {
518
647
  const ret = arg0[arg1];
519
648
  return ret;
520
649
  },
521
- __wbg_instanceof_ArrayBuffer_993d02d2d254cad1: function(arg0) {
650
+ __wbg_instanceof_ArrayBuffer_d4ff01f8247925ae: function(arg0) {
522
651
  let result;
523
652
  try {
524
653
  result = arg0 instanceof ArrayBuffer;
@@ -528,7 +657,7 @@ function __wbg_get_imports() {
528
657
  const ret = result;
529
658
  return ret;
530
659
  },
531
- __wbg_instanceof_Uint8Array_f935dbb0aa7cdeed: function(arg0) {
660
+ __wbg_instanceof_Uint8Array_598adc0fef426aa8: function(arg0) {
532
661
  let result;
533
662
  try {
534
663
  result = arg0 instanceof Uint8Array;
@@ -538,54 +667,54 @@ function __wbg_get_imports() {
538
667
  const ret = result;
539
668
  return ret;
540
669
  },
541
- __wbg_isArray_6339f732981044bf: function(arg0) {
670
+ __wbg_isArray_5674713bb7b79043: function(arg0) {
542
671
  const ret = Array.isArray(arg0);
543
672
  return ret;
544
673
  },
545
- __wbg_isSafeInteger_f3d6cd19ccfe4512: function(arg0) {
674
+ __wbg_isSafeInteger_8f51c743827d1ec5: function(arg0) {
546
675
  const ret = Number.isSafeInteger(arg0);
547
676
  return ret;
548
677
  },
549
- __wbg_iterator_5cebbb86e33c6dd6: function() {
678
+ __wbg_iterator_22ddeb808cf55a6f: function() {
550
679
  const ret = Symbol.iterator;
551
680
  return ret;
552
681
  },
553
- __wbg_length_36bd29c6848c2144: function(arg0) {
682
+ __wbg_length_31bdaf014f5fbde2: function(arg0) {
554
683
  const ret = arg0.length;
555
684
  return ret;
556
685
  },
557
- __wbg_length_46f80504ebb6ebb4: function(arg0) {
686
+ __wbg_length_4e1adc0d42e23620: function(arg0) {
558
687
  const ret = arg0.length;
559
688
  return ret;
560
689
  },
561
- __wbg_length_ecfa2c63d3d0d82c: function(arg0) {
690
+ __wbg_length_598aff98d0c65a59: function(arg0) {
562
691
  const ret = arg0.length;
563
692
  return ret;
564
693
  },
694
+ __wbg_new_1da3429bc3c4541c: function(arg0) {
695
+ const ret = new Uint8Array(arg0);
696
+ return ret;
697
+ },
565
698
  __wbg_new_227d7c05414eb861: function() {
566
699
  const ret = new Error();
567
700
  return ret;
568
701
  },
569
- __wbg_new_77cc4f4f472aeb81: function(arg0) {
570
- const ret = new Uint8Array(arg0);
702
+ __wbg_next_95053e306b1c3aed: function(arg0) {
703
+ const ret = arg0.next;
571
704
  return ret;
572
705
  },
573
- __wbg_next_42cf16ee0dafc9e2: function() { return handleError(function (arg0) {
706
+ __wbg_next_f31ecb8646d2c605: function() { return handleError(function (arg0) {
574
707
  const ret = arg0.next();
575
708
  return ret;
576
709
  }, arguments); },
577
- __wbg_next_8f26b64fa5e9f64b: function(arg0) {
578
- const ret = arg0.next;
579
- return ret;
580
- },
581
710
  __wbg_onlineoutput_new: function(arg0) {
582
711
  const ret = OnlineOutput.__wrap(arg0);
583
712
  return ret;
584
713
  },
585
- __wbg_prototypesetcall_35505001a41def4c: function(arg0, arg1, arg2) {
714
+ __wbg_prototypesetcall_5c62be9626638df9: function(arg0, arg1, arg2) {
586
715
  Float64Array.prototype.set.call(getArrayF64FromWasm0(arg0, arg1), arg2);
587
716
  },
588
- __wbg_prototypesetcall_de8e0d9553586985: function(arg0, arg1, arg2) {
717
+ __wbg_prototypesetcall_ae9f5e7459250748: function(arg0, arg1, arg2) {
589
718
  Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), arg2);
590
719
  },
591
720
  __wbg_stack_3b0d974bbf31e44f: function(arg0, arg1) {
@@ -595,21 +724,21 @@ function __wbg_get_imports() {
595
724
  getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
596
725
  getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
597
726
  },
598
- __wbg_value_1e2369fab29b420e: function(arg0) {
727
+ __wbg_value_c227f843d21da141: function(arg0) {
599
728
  const ret = arg0.value;
600
729
  return ret;
601
730
  },
602
- __wbindgen_cast_0000000000000001: function(arg0, arg1) {
731
+ __wbindgen_generic_0000000000000001: function(arg0, arg1) {
603
732
  // Cast intrinsic for `Ref(Slice(F64)) -> NamedExternref("Float64Array")`.
604
733
  const ret = getArrayF64FromWasm0(arg0, arg1);
605
734
  return ret;
606
735
  },
607
- __wbindgen_cast_0000000000000002: function(arg0, arg1) {
736
+ __wbindgen_generic_0000000000000002: function(arg0, arg1) {
608
737
  // Cast intrinsic for `Ref(String) -> Externref`.
609
738
  const ret = getStringFromWasm0(arg0, arg1);
610
739
  return ret;
611
740
  },
612
- __wbindgen_cast_0000000000000003: function(arg0) {
741
+ __wbindgen_generic_0000000000000003: function(arg0) {
613
742
  // Cast intrinsic for `U64 -> Externref`.
614
743
  const ret = BigInt.asUintN(64, arg0);
615
744
  return ret;
@@ -645,6 +774,9 @@ const OnlineLowessFinalization = (typeof FinalizationRegistry === 'undefined')
645
774
  const OnlineOutputFinalization = (typeof FinalizationRegistry === 'undefined')
646
775
  ? { register: () => {}, unregister: () => {} }
647
776
  : new FinalizationRegistry(ptr => wasm.__wbg_onlineoutput_free(ptr, 1));
777
+ const PredictOutputFinalization = (typeof FinalizationRegistry === 'undefined')
778
+ ? { register: () => {}, unregister: () => {} }
779
+ : new FinalizationRegistry(ptr => wasm.__wbg_predictoutput_free(ptr, 1));
648
780
  const StreamingLowessFinalization = (typeof FinalizationRegistry === 'undefined')
649
781
  ? { register: () => {}, unregister: () => {} }
650
782
  : new FinalizationRegistry(ptr => wasm.__wbg_streaminglowess_free(ptr, 1));
Binary file
package/package.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "Amir Valizadeh <thisisamirv@gmail.com>"
6
6
  ],
7
7
  "description": "High-performance LOWESS (Locally Weighted Scatterplot Smoothing)",
8
- "version": "3.2.1",
8
+ "version": "4.1.0",
9
9
  "license": "MIT OR Apache-2.0",
10
10
  "repository": {
11
11
  "type": "git",