@sipemu/anofox-forecast 0.4.6 → 0.4.8

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.
@@ -260,10 +260,6 @@ const JsConformalResultFinalization = (typeof FinalizationRegistry === 'undefine
260
260
  ? { register: () => {}, unregister: () => {} }
261
261
  : new FinalizationRegistry(ptr => wasm.__wbg_jsconformalresult_free(ptr >>> 0, 1));
262
262
 
263
- const JsDataProfileFinalization = (typeof FinalizationRegistry === 'undefined')
264
- ? { register: () => {}, unregister: () => {} }
265
- : new FinalizationRegistry(ptr => wasm.__wbg_jsdataprofile_free(ptr >>> 0, 1));
266
-
267
263
  const JsHistoricalSimResultFinalization = (typeof FinalizationRegistry === 'undefined')
268
264
  ? { register: () => {}, unregister: () => {} }
269
265
  : new FinalizationRegistry(ptr => wasm.__wbg_jshistoricalsimresult_free(ptr >>> 0, 1));
@@ -284,18 +280,6 @@ const JsNormalResultFinalization = (typeof FinalizationRegistry === 'undefined')
284
280
  ? { register: () => {}, unregister: () => {} }
285
281
  : new FinalizationRegistry(ptr => wasm.__wbg_jsnormalresult_free(ptr >>> 0, 1));
286
282
 
287
- const JsPipelineBuilderFinalization = (typeof FinalizationRegistry === 'undefined')
288
- ? { register: () => {}, unregister: () => {} }
289
- : new FinalizationRegistry(ptr => wasm.__wbg_jspipelinebuilder_free(ptr >>> 0, 1));
290
-
291
- const JsPipelineReportFinalization = (typeof FinalizationRegistry === 'undefined')
292
- ? { register: () => {}, unregister: () => {} }
293
- : new FinalizationRegistry(ptr => wasm.__wbg_jspipelinereport_free(ptr >>> 0, 1));
294
-
295
- const JsPipelineResultFinalization = (typeof FinalizationRegistry === 'undefined')
296
- ? { register: () => {}, unregister: () => {} }
297
- : new FinalizationRegistry(ptr => wasm.__wbg_jspipelineresult_free(ptr >>> 0, 1));
298
-
299
283
  const JsPointForecastsFinalization = (typeof FinalizationRegistry === 'undefined')
300
284
  ? { register: () => {}, unregister: () => {} }
301
285
  : new FinalizationRegistry(ptr => wasm.__wbg_jspointforecasts_free(ptr >>> 0, 1));
@@ -714,7 +698,7 @@ if (Symbol.dispose) AutoETSForecaster.prototype[Symbol.dispose] = AutoETSForecas
714
698
  /**
715
699
  * Automatic ensemble that selects top-K models across families.
716
700
  *
717
- * Fits AutoARIMA, AutoETS, and AutoTheta, ranks them by in-sample MSE,
701
+ * Fits AutoARIMA, AutoETS, and AutoTheta, ranks them by cross-validation error,
718
702
  * and combines the top-K into a weighted ensemble forecast.
719
703
  */
720
704
  export class AutoEnsembleForecaster {
@@ -929,18 +913,6 @@ export class AutoForecastBuilder {
929
913
  const ret = wasm.autoforecastbuilder_seasonalPeriod(ptr, period);
930
914
  return AutoForecastBuilder.__wrap(ret);
931
915
  }
932
- /**
933
- * Use cross-validation instead of in-sample MSE for model selection.
934
- *
935
- * @param useCv - Whether to use cross-validation (default: false)
936
- * @param {boolean} use_cv
937
- * @returns {AutoForecastBuilder}
938
- */
939
- useCrossValidation(use_cv) {
940
- const ptr = this.__destroy_into_raw();
941
- const ret = wasm.autoforecastbuilder_useCrossValidation(ptr, use_cv);
942
- return AutoForecastBuilder.__wrap(ret);
943
- }
944
916
  /**
945
917
  * Create a new builder with all defaults enabled.
946
918
  */
@@ -968,7 +940,7 @@ if (Symbol.dispose) AutoForecastBuilder.prototype[Symbol.dispose] = AutoForecast
968
940
  * Automatic model selection across ARIMA, ETS, and Theta families.
969
941
  *
970
942
  * Fits all enabled auto models and selects the best one based on
971
- * in-sample MSE or cross-validation error.
943
+ * cross-validation error.
972
944
  */
973
945
  export class AutoForecaster {
974
946
  static __wrap(ptr) {
@@ -1008,16 +980,14 @@ export class AutoForecaster {
1008
980
  * @param includeArima - Include AutoARIMA candidate (default: true)
1009
981
  * @param includeEts - Include AutoETS candidate (default: true)
1010
982
  * @param includeTheta - Include AutoTheta candidate (default: true)
1011
- * @param useCrossValidation - Use cross-validation instead of in-sample MSE (default: false)
1012
983
  * @param {number | null} [seasonal_period]
1013
984
  * @param {boolean | null} [include_arima]
1014
985
  * @param {boolean | null} [include_ets]
1015
986
  * @param {boolean | null} [include_theta]
1016
- * @param {boolean | null} [use_cross_validation]
1017
987
  * @returns {AutoForecaster}
1018
988
  */
1019
- static withConfig(seasonal_period, include_arima, include_ets, include_theta, use_cross_validation) {
1020
- const ret = wasm.autoforecaster_withConfig(isLikeNone(seasonal_period) ? 0x100000001 : (seasonal_period) >>> 0, isLikeNone(include_arima) ? 0xFFFFFF : include_arima ? 1 : 0, isLikeNone(include_ets) ? 0xFFFFFF : include_ets ? 1 : 0, isLikeNone(include_theta) ? 0xFFFFFF : include_theta ? 1 : 0, isLikeNone(use_cross_validation) ? 0xFFFFFF : use_cross_validation ? 1 : 0);
989
+ static withConfig(seasonal_period, include_arima, include_ets, include_theta) {
990
+ const ret = wasm.autoforecaster_withConfig(isLikeNone(seasonal_period) ? 0x100000001 : (seasonal_period) >>> 0, isLikeNone(include_arima) ? 0xFFFFFF : include_arima ? 1 : 0, isLikeNone(include_ets) ? 0xFFFFFF : include_ets ? 1 : 0, isLikeNone(include_theta) ? 0xFFFFFF : include_theta ? 1 : 0);
1021
991
  return AutoForecaster.__wrap(ret);
1022
992
  }
1023
993
  /**
@@ -1071,7 +1041,7 @@ export class AutoForecaster {
1071
1041
  * Create a new AutoForecaster with default configuration.
1072
1042
  *
1073
1043
  * By default, includes AutoARIMA, AutoETS, and AutoTheta candidates
1074
- * and uses in-sample MSE for model selection.
1044
+ * and uses cross-validation for model selection.
1075
1045
  */
1076
1046
  constructor() {
1077
1047
  const ret = wasm.autoforecaster_new();
@@ -2726,334 +2696,6 @@ export class JsConformalResult {
2726
2696
  }
2727
2697
  if (Symbol.dispose) JsConformalResult.prototype[Symbol.dispose] = JsConformalResult.prototype.free;
2728
2698
 
2729
- /**
2730
- * Automated data profile — stationarity, trend, seasonality, quality score.
2731
- *
2732
- * Profile a time series to understand its characteristics before model selection.
2733
- */
2734
- export class JsDataProfile {
2735
- static __wrap(ptr) {
2736
- ptr = ptr >>> 0;
2737
- const obj = Object.create(JsDataProfile.prototype);
2738
- obj.__wbg_ptr = ptr;
2739
- JsDataProfileFinalization.register(obj, obj.__wbg_ptr, obj);
2740
- return obj;
2741
- }
2742
- __destroy_into_raw() {
2743
- const ptr = this.__wbg_ptr;
2744
- this.__wbg_ptr = 0;
2745
- JsDataProfileFinalization.unregister(this);
2746
- return ptr;
2747
- }
2748
- free() {
2749
- const ptr = this.__destroy_into_raw();
2750
- wasm.__wbg_jsdataprofile_free(ptr, 0);
2751
- }
2752
- /**
2753
- * Whether every finite value is integer-valued.
2754
- * @returns {boolean}
2755
- */
2756
- get isInteger() {
2757
- const ret = wasm.jsdataprofile_isInteger(this.__wbg_ptr);
2758
- return ret !== 0;
2759
- }
2760
- /**
2761
- * Lempel-Ziv complexity (normalized).
2762
- * @returns {number}
2763
- */
2764
- get lempelZiv() {
2765
- const ret = wasm.jsdataprofile_lempelZiv(this.__wbg_ptr);
2766
- return ret;
2767
- }
2768
- /**
2769
- * ADF p-value.
2770
- * @returns {number}
2771
- */
2772
- get adfPValue() {
2773
- const ret = wasm.jsdataprofile_adfPValue(this.__wbg_ptr);
2774
- return ret;
2775
- }
2776
- /**
2777
- * Profile a time series.
2778
- *
2779
- * @param series - TimeSeries to profile
2780
- * @returns A comprehensive data profile
2781
- * @param {TimeSeries} series
2782
- * @returns {JsDataProfile}
2783
- */
2784
- static fromSeries(series) {
2785
- _assertClass(series, TimeSeries);
2786
- const ret = wasm.jsdataprofile_fromSeries(series.__wbg_ptr);
2787
- return JsDataProfile.__wrap(ret);
2788
- }
2789
- /**
2790
- * Profile raw values (without timestamps).
2791
- *
2792
- * @param values - Array of numeric values
2793
- * @returns A data profile
2794
- * @param {Float64Array} values
2795
- * @returns {JsDataProfile}
2796
- */
2797
- static fromValues(values) {
2798
- const ptr0 = passArrayF64ToWasm0(values, wasm.__wbindgen_malloc);
2799
- const len0 = WASM_VECTOR_LEN;
2800
- const ret = wasm.jsdataprofile_fromValues(ptr0, len0);
2801
- return JsDataProfile.__wrap(ret);
2802
- }
2803
- /**
2804
- * Slope of the linear trend.
2805
- * @returns {number}
2806
- */
2807
- get trendSlope() {
2808
- const ret = wasm.jsdataprofile_trendSlope(this.__wbg_ptr);
2809
- return ret;
2810
- }
2811
- /**
2812
- * KPSS p-value.
2813
- * @returns {number}
2814
- */
2815
- get kpssPValue() {
2816
- const ret = wasm.jsdataprofile_kpssPValue(this.__wbg_ptr);
2817
- return ret;
2818
- }
2819
- /**
2820
- * Full profile as a formatted string.
2821
- * @returns {string}
2822
- */
2823
- toString() {
2824
- let deferred1_0;
2825
- let deferred1_1;
2826
- try {
2827
- const ret = wasm.jsdataprofile_toString(this.__wbg_ptr);
2828
- deferred1_0 = ret[0];
2829
- deferred1_1 = ret[1];
2830
- return getStringFromWasm0(ret[0], ret[1]);
2831
- } finally {
2832
- wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
2833
- }
2834
- }
2835
- /**
2836
- * ADF test statistic.
2837
- * @returns {number}
2838
- */
2839
- get adfStatistic() {
2840
- const ret = wasm.jsdataprofile_adfStatistic(this.__wbg_ptr);
2841
- return ret;
2842
- }
2843
- /**
2844
- * Whether any value is negative.
2845
- * @returns {boolean}
2846
- */
2847
- get hasNegatives() {
2848
- const ret = wasm.jsdataprofile_hasNegatives(this.__wbg_ptr);
2849
- return ret !== 0;
2850
- }
2851
- /**
2852
- * Combined stationarity (ADF stationary AND KPSS stationary).
2853
- * @returns {boolean}
2854
- */
2855
- get isStationary() {
2856
- const ret = wasm.jsdataprofile_isStationary(this.__wbg_ptr);
2857
- return ret !== 0;
2858
- }
2859
- /**
2860
- * Count of NaN or infinite values.
2861
- * @returns {number}
2862
- */
2863
- get missingCount() {
2864
- const ret = wasm.jsdataprofile_missingCount(this.__wbg_ptr);
2865
- return ret >>> 0;
2866
- }
2867
- /**
2868
- * Heuristic data-quality score in [0.0, 1.0].
2869
- * @returns {number}
2870
- */
2871
- get qualityScore() {
2872
- const ret = wasm.jsdataprofile_qualityScore(this.__wbg_ptr);
2873
- return ret;
2874
- }
2875
- /**
2876
- * Fraction of values that are exactly zero.
2877
- * @returns {number}
2878
- */
2879
- get zeroFraction() {
2880
- const ret = wasm.jsdataprofile_zeroFraction(this.__wbg_ptr);
2881
- return ret;
2882
- }
2883
- /**
2884
- * KPSS test statistic.
2885
- * @returns {number}
2886
- */
2887
- get kpssStatistic() {
2888
- const ret = wasm.jsdataprofile_kpssStatistic(this.__wbg_ptr);
2889
- return ret;
2890
- }
2891
- /**
2892
- * Number of observations.
2893
- * @returns {number}
2894
- */
2895
- get nObservations() {
2896
- const ret = wasm.jsdataprofile_nObservations(this.__wbg_ptr);
2897
- return ret >>> 0;
2898
- }
2899
- /**
2900
- * Trend strength (R-squared, 0.0 to 1.0).
2901
- * @returns {number}
2902
- */
2903
- get trendStrength() {
2904
- const ret = wasm.jsdataprofile_trendStrength(this.__wbg_ptr);
2905
- return ret;
2906
- }
2907
- /**
2908
- * Whether the series is classified as intermittent.
2909
- * @returns {boolean}
2910
- */
2911
- get isIntermittent() {
2912
- const ret = wasm.jsdataprofile_isIntermittent(this.__wbg_ptr);
2913
- return ret !== 0;
2914
- }
2915
- /**
2916
- * Trend direction: "Rising", "Falling", or "Flat".
2917
- * @returns {string}
2918
- */
2919
- get trendDirection() {
2920
- let deferred1_0;
2921
- let deferred1_1;
2922
- try {
2923
- const ret = wasm.jsdataprofile_trendDirection(this.__wbg_ptr);
2924
- deferred1_0 = ret[0];
2925
- deferred1_1 = ret[1];
2926
- return getStringFromWasm0(ret[0], ret[1]);
2927
- } finally {
2928
- wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
2929
- }
2930
- }
2931
- /**
2932
- * Partial autocorrelation at lag 1.
2933
- * @returns {number}
2934
- */
2935
- get partialAcfLag1() {
2936
- const ret = wasm.jsdataprofile_partialAcfLag1(this.__wbg_ptr);
2937
- return ret;
2938
- }
2939
- /**
2940
- * Whether ADF concludes stationarity at 5%.
2941
- * @returns {boolean}
2942
- */
2943
- get adfIsStationary() {
2944
- const ret = wasm.jsdataprofile_adfIsStationary(this.__wbg_ptr);
2945
- return ret !== 0;
2946
- }
2947
- /**
2948
- * Whether KPSS concludes stationarity at 5%.
2949
- * @returns {boolean}
2950
- */
2951
- get kpssIsStationary() {
2952
- const ret = wasm.jsdataprofile_kpssIsStationary(this.__wbg_ptr);
2953
- return ret !== 0;
2954
- }
2955
- /**
2956
- * Approximate entropy (undefined if series is too short).
2957
- * @returns {number | undefined}
2958
- */
2959
- get approximateEntropy() {
2960
- const ret = wasm.jsdataprofile_approximateEntropy(this.__wbg_ptr);
2961
- return ret[0] === 0 ? undefined : ret[1];
2962
- }
2963
- /**
2964
- * Maximum value.
2965
- * @returns {number}
2966
- */
2967
- get max() {
2968
- const ret = wasm.jsdataprofile_max(this.__wbg_ptr);
2969
- return ret;
2970
- }
2971
- /**
2972
- * Minimum value.
2973
- * @returns {number}
2974
- */
2975
- get min() {
2976
- const ret = wasm.jsdataprofile_min(this.__wbg_ptr);
2977
- return ret;
2978
- }
2979
- /**
2980
- * Arithmetic mean.
2981
- * @returns {number}
2982
- */
2983
- get mean() {
2984
- const ret = wasm.jsconformalresult_quantileValue(this.__wbg_ptr);
2985
- return ret;
2986
- }
2987
- /**
2988
- * Standard deviation.
2989
- * @returns {number}
2990
- */
2991
- get stdDev() {
2992
- const ret = wasm.jsconformalresult_coverage(this.__wbg_ptr);
2993
- return ret;
2994
- }
2995
- /**
2996
- * Human-readable summary string.
2997
- * @returns {string}
2998
- */
2999
- summary() {
3000
- let deferred1_0;
3001
- let deferred1_1;
3002
- try {
3003
- const ret = wasm.jsdataprofile_summary(this.__wbg_ptr);
3004
- deferred1_0 = ret[0];
3005
- deferred1_1 = ret[1];
3006
- return getStringFromWasm0(ret[0], ret[1]);
3007
- } finally {
3008
- wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
3009
- }
3010
- }
3011
- /**
3012
- * Profile as a JSON-serializable object.
3013
- * @returns {any}
3014
- */
3015
- toJSON() {
3016
- const ret = wasm.jsdataprofile_toJSON(this.__wbg_ptr);
3017
- if (ret[2]) {
3018
- throw takeFromExternrefTable0(ret[1]);
3019
- }
3020
- return takeFromExternrefTable0(ret[0]);
3021
- }
3022
- /**
3023
- * Autocorrelation at lag 1.
3024
- * @returns {number}
3025
- */
3026
- get acfLag1() {
3027
- const ret = wasm.jsdataprofile_acfLag1(this.__wbg_ptr);
3028
- return ret;
3029
- }
3030
- /**
3031
- * Autocorrelation at lag 2.
3032
- * @returns {number}
3033
- */
3034
- get acfLag2() {
3035
- const ret = wasm.jsdataprofile_acfLag2(this.__wbg_ptr);
3036
- return ret;
3037
- }
3038
- /**
3039
- * Excess kurtosis.
3040
- * @returns {number}
3041
- */
3042
- get kurtosis() {
3043
- const ret = wasm.jsdataprofile_kurtosis(this.__wbg_ptr);
3044
- return ret;
3045
- }
3046
- /**
3047
- * Skewness.
3048
- * @returns {number}
3049
- */
3050
- get skewness() {
3051
- const ret = wasm.jsdataprofile_skewness(this.__wbg_ptr);
3052
- return ret;
3053
- }
3054
- }
3055
- if (Symbol.dispose) JsDataProfile.prototype[Symbol.dispose] = JsDataProfile.prototype.free;
3056
-
3057
2699
  /**
3058
2700
  * Historical simulation result — stores the empirical error distribution.
3059
2701
  */
@@ -3238,7 +2880,7 @@ export class JsModelDiagnostics {
3238
2880
  * @returns {number}
3239
2881
  */
3240
2882
  get residualStd() {
3241
- const ret = wasm.jsdataprofile_max(this.__wbg_ptr);
2883
+ const ret = wasm.jsmodeldiagnostics_residualStd(this.__wbg_ptr);
3242
2884
  return ret;
3243
2885
  }
3244
2886
  /**
@@ -3246,7 +2888,7 @@ export class JsModelDiagnostics {
3246
2888
  * @returns {number}
3247
2889
  */
3248
2890
  get residualMean() {
3249
- const ret = wasm.jsdataprofile_min(this.__wbg_ptr);
2891
+ const ret = wasm.jsmodeldiagnostics_residualMean(this.__wbg_ptr);
3250
2892
  return ret;
3251
2893
  }
3252
2894
  /**
@@ -3449,506 +3091,27 @@ export class JsNormalResult {
3449
3091
  if (Symbol.dispose) JsNormalResult.prototype[Symbol.dispose] = JsNormalResult.prototype.free;
3450
3092
 
3451
3093
  /**
3452
- * Declarative pipeline builder for composing forecasting workflows.
3453
- *
3454
- * Chain configuration methods and call `build()` to produce a pipeline,
3455
- * then `execute()` to run it.
3094
+ * Point forecasts a sequence of predicted values.
3456
3095
  *
3457
- * ```js
3458
- * const result = new JsPipelineBuilder()
3459
- * .profile()
3460
- * .preprocess("auto")
3461
- * .metric("auto")
3462
- * .ensemble("auto")
3463
- * .addModel("Naive")
3464
- * .addModel("SES")
3465
- * .withFallback()
3466
- * .nonNegative()
3467
- * .build()
3468
- * .execute(ts, 12);
3469
- * ```
3096
+ * Used as input for postprocessing methods.
3470
3097
  */
3471
- export class JsPipelineBuilder {
3472
- static __wrap(ptr) {
3473
- ptr = ptr >>> 0;
3474
- const obj = Object.create(JsPipelineBuilder.prototype);
3475
- obj.__wbg_ptr = ptr;
3476
- JsPipelineBuilderFinalization.register(obj, obj.__wbg_ptr, obj);
3477
- return obj;
3478
- }
3098
+ export class JsPointForecasts {
3479
3099
  __destroy_into_raw() {
3480
3100
  const ptr = this.__wbg_ptr;
3481
3101
  this.__wbg_ptr = 0;
3482
- JsPipelineBuilderFinalization.unregister(this);
3102
+ JsPointForecastsFinalization.unregister(this);
3483
3103
  return ptr;
3484
3104
  }
3485
3105
  free() {
3486
3106
  const ptr = this.__destroy_into_raw();
3487
- wasm.__wbg_jspipelinebuilder_free(ptr, 0);
3107
+ wasm.__wbg_jspointforecasts_free(ptr, 0);
3488
3108
  }
3489
3109
  /**
3490
- * Set preprocessing mode.
3491
- *
3492
- * @param mode - "auto", "none", or "manual"
3493
- * @param {string} mode
3494
- * @returns {JsPipelineBuilder}
3110
+ * Create point forecasts from an array of values.
3111
+ * @param {Float64Array} values
3495
3112
  */
3496
- preprocess(mode) {
3497
- const ptr = this.__destroy_into_raw();
3498
- const ptr0 = passStringToWasm0(mode, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
3499
- const len0 = WASM_VECTOR_LEN;
3500
- const ret = wasm.jspipelinebuilder_preprocess(ptr, ptr0, len0);
3501
- return JsPipelineBuilder.__wrap(ret);
3502
- }
3503
- /**
3504
- * Apply non-negative constraint to forecasts.
3505
- * @returns {JsPipelineBuilder}
3506
- */
3507
- nonNegative() {
3508
- const ptr = this.__destroy_into_raw();
3509
- const ret = wasm.jspipelinebuilder_nonNegative(ptr);
3510
- return JsPipelineBuilder.__wrap(ret);
3511
- }
3512
- /**
3513
- * Select top-K models for evaluation.
3514
- *
3515
- * @param k - Number of models to select
3516
- * @param {number} k
3517
- * @returns {JsPipelineBuilder}
3518
- */
3519
- selectModels(k) {
3520
- const ptr = this.__destroy_into_raw();
3521
- const ret = wasm.jspipelinebuilder_selectModels(ptr, k);
3522
- return JsPipelineBuilder.__wrap(ret);
3523
- }
3524
- /**
3525
- * Enable fallback chain (Naive → SMA).
3526
- * @returns {JsPipelineBuilder}
3527
- */
3528
- withFallback() {
3529
- const ptr = this.__destroy_into_raw();
3530
- const ret = wasm.jspipelinebuilder_withFallback(ptr);
3531
- return JsPipelineBuilder.__wrap(ret);
3532
- }
3533
- /**
3534
- * Enable cross-validation.
3535
- *
3536
- * @param folds - Number of CV folds
3537
- * @param horizon - Forecast horizon for each fold
3538
- * @param {number} folds
3539
- * @param {number} horizon
3540
- * @returns {JsPipelineBuilder}
3541
- */
3542
- crossValidate(folds, horizon) {
3543
- const ptr = this.__destroy_into_raw();
3544
- const ret = wasm.jspipelinebuilder_crossValidate(ptr, folds, horizon);
3545
- return JsPipelineBuilder.__wrap(ret);
3546
- }
3547
- /**
3548
- * Set the seasonal period hint.
3549
- *
3550
- * @param period - Seasonal period (e.g., 12 for monthly data)
3551
- * @param {number} period
3552
- * @returns {JsPipelineBuilder}
3553
- */
3554
- seasonalPeriod(period) {
3555
- const ptr = this.__destroy_into_raw();
3556
- const ret = wasm.jspipelinebuilder_seasonalPeriod(ptr, period);
3557
- return JsPipelineBuilder.__wrap(ret);
3558
- }
3559
- /**
3560
- * Add a seasonal model to the pipeline.
3561
- *
3562
- * @param name - Model name (e.g., "SeasonalNaive")
3563
- * @param period - Seasonal period
3564
- * @param {string} name
3565
- * @param {number} period
3566
- * @returns {JsPipelineBuilder}
3567
- */
3568
- addSeasonalModel(name, period) {
3569
- const ptr = this.__destroy_into_raw();
3570
- const ptr0 = passStringToWasm0(name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
3571
- const len0 = WASM_VECTOR_LEN;
3572
- const ret = wasm.jspipelinebuilder_addSeasonalModel(ptr, ptr0, len0, period);
3573
- return JsPipelineBuilder.__wrap(ret);
3574
- }
3575
- /**
3576
- * Create a new pipeline builder.
3577
- */
3578
- constructor() {
3579
- const ret = wasm.jspipelinebuilder_new();
3580
- this.__wbg_ptr = ret >>> 0;
3581
- JsPipelineBuilderFinalization.register(this, this.__wbg_ptr, this);
3582
- return this;
3583
- }
3584
- /**
3585
- * Set the metric strategy for model selection.
3586
- *
3587
- * @param strategy - "auto", "mae", "mse", "rmse", "smape", "wape", or "mda"
3588
- * @param {string} strategy
3589
- * @returns {JsPipelineBuilder}
3590
- */
3591
- metric(strategy) {
3592
- const ptr = this.__destroy_into_raw();
3593
- const ptr0 = passStringToWasm0(strategy, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
3594
- const len0 = WASM_VECTOR_LEN;
3595
- const ret = wasm.jspipelinebuilder_metric(ptr, ptr0, len0);
3596
- return JsPipelineBuilder.__wrap(ret);
3597
- }
3598
- /**
3599
- * Build and execute the pipeline.
3600
- *
3601
- * @param series - TimeSeries to forecast
3602
- * @param horizon - Number of steps to forecast
3603
- * @returns JsPipelineResult with forecast, profile, and diagnostics
3604
- * @param {TimeSeries} series
3605
- * @param {number} horizon
3606
- * @returns {JsPipelineResult}
3607
- */
3608
- execute(series, horizon) {
3609
- const ptr = this.__destroy_into_raw();
3610
- _assertClass(series, TimeSeries);
3611
- const ret = wasm.jspipelinebuilder_execute(ptr, series.__wbg_ptr, horizon);
3612
- if (ret[2]) {
3613
- throw takeFromExternrefTable0(ret[1]);
3614
- }
3615
- return JsPipelineResult.__wrap(ret[0]);
3616
- }
3617
- /**
3618
- * Enable data profiling.
3619
- * @returns {JsPipelineBuilder}
3620
- */
3621
- profile() {
3622
- const ptr = this.__destroy_into_raw();
3623
- const ret = wasm.jspipelinebuilder_profile(ptr);
3624
- return JsPipelineBuilder.__wrap(ret);
3625
- }
3626
- /**
3627
- * Set the ensemble mode.
3628
- *
3629
- * @param mode - "auto", "none", "mean", "median", or "weighted"
3630
- * @param {string} mode
3631
- * @returns {JsPipelineBuilder}
3632
- */
3633
- ensemble(mode) {
3634
- const ptr = this.__destroy_into_raw();
3635
- const ptr0 = passStringToWasm0(mode, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
3636
- const len0 = WASM_VECTOR_LEN;
3637
- const ret = wasm.jspipelinebuilder_ensemble(ptr, ptr0, len0);
3638
- return JsPipelineBuilder.__wrap(ret);
3639
- }
3640
- /**
3641
- * Add a built-in model to the pipeline.
3642
- *
3643
- * Supported models: "Naive", "SES", "SMA", "SMA5", "SMA10"
3644
- *
3645
- * @param name - Model name
3646
- * @param {string} name
3647
- * @returns {JsPipelineBuilder}
3648
- */
3649
- addModel(name) {
3650
- const ptr = this.__destroy_into_raw();
3651
- const ptr0 = passStringToWasm0(name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
3652
- const len0 = WASM_VECTOR_LEN;
3653
- const ret = wasm.jspipelinebuilder_addModel(ptr, ptr0, len0);
3654
- return JsPipelineBuilder.__wrap(ret);
3655
- }
3656
- }
3657
- if (Symbol.dispose) JsPipelineBuilder.prototype[Symbol.dispose] = JsPipelineBuilder.prototype.free;
3658
-
3659
- /**
3660
- * Structured multi-section pipeline report.
3661
- *
3662
- * Contains summary, data profile, preprocessing, model selection,
3663
- * ensemble, forecast, horizon analysis, decision log, and execution metadata.
3664
- */
3665
- export class JsPipelineReport {
3666
- static __wrap(ptr) {
3667
- ptr = ptr >>> 0;
3668
- const obj = Object.create(JsPipelineReport.prototype);
3669
- obj.__wbg_ptr = ptr;
3670
- JsPipelineReportFinalization.register(obj, obj.__wbg_ptr, obj);
3671
- return obj;
3672
- }
3673
- __destroy_into_raw() {
3674
- const ptr = this.__wbg_ptr;
3675
- this.__wbg_ptr = 0;
3676
- JsPipelineReportFinalization.unregister(this);
3677
- return ptr;
3678
- }
3679
- free() {
3680
- const ptr = this.__destroy_into_raw();
3681
- wasm.__wbg_jspipelinereport_free(ptr, 0);
3682
- }
3683
- /**
3684
- * Get the full report as formatted text.
3685
- * @returns {string}
3686
- */
3687
- toString() {
3688
- let deferred1_0;
3689
- let deferred1_1;
3690
- try {
3691
- const ret = wasm.jspipelinereport_toString(this.__wbg_ptr);
3692
- deferred1_0 = ret[0];
3693
- deferred1_1 = ret[1];
3694
- return getStringFromWasm0(ret[0], ret[1]);
3695
- } finally {
3696
- wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
3697
- }
3698
- }
3699
- /**
3700
- * Get the number of sections.
3701
- * @returns {number}
3702
- */
3703
- get sectionCount() {
3704
- const ret = wasm.jspipelinereport_sectionCount(this.__wbg_ptr);
3705
- return ret >>> 0;
3706
- }
3707
- /**
3708
- * Get a section heading by index.
3709
- * @param {number} index
3710
- * @returns {string | undefined}
3711
- */
3712
- sectionHeading(index) {
3713
- const ret = wasm.jspipelinereport_sectionHeading(this.__wbg_ptr, index);
3714
- let v1;
3715
- if (ret[0] !== 0) {
3716
- v1 = getStringFromWasm0(ret[0], ret[1]).slice();
3717
- wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
3718
- }
3719
- return v1;
3720
- }
3721
- /**
3722
- * Get the report title.
3723
- * @returns {string}
3724
- */
3725
- get title() {
3726
- let deferred1_0;
3727
- let deferred1_1;
3728
- try {
3729
- const ret = wasm.jspipelinereport_title(this.__wbg_ptr);
3730
- deferred1_0 = ret[0];
3731
- deferred1_1 = ret[1];
3732
- return getStringFromWasm0(ret[0], ret[1]);
3733
- } finally {
3734
- wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
3735
- }
3736
- }
3737
- /**
3738
- * Get the report as a JSON object.
3739
- *
3740
- * Returns `{ title, sections: [{ heading, content }] }`.
3741
- * @returns {any}
3742
- */
3743
- toJSON() {
3744
- const ret = wasm.jspipelinereport_toJSON(this.__wbg_ptr);
3745
- if (ret[2]) {
3746
- throw takeFromExternrefTable0(ret[1]);
3747
- }
3748
- return takeFromExternrefTable0(ret[0]);
3749
- }
3750
- }
3751
- if (Symbol.dispose) JsPipelineReport.prototype[Symbol.dispose] = JsPipelineReport.prototype.free;
3752
-
3753
- /**
3754
- * Result of executing a forecasting pipeline.
3755
- *
3756
- * Contains the forecast, selected model name, data profile, decision log,
3757
- * preprocessing info, ensemble weights, and metric scores.
3758
- */
3759
- export class JsPipelineResult {
3760
- static __wrap(ptr) {
3761
- ptr = ptr >>> 0;
3762
- const obj = Object.create(JsPipelineResult.prototype);
3763
- obj.__wbg_ptr = ptr;
3764
- JsPipelineResultFinalization.register(obj, obj.__wbg_ptr, obj);
3765
- return obj;
3766
- }
3767
- __destroy_into_raw() {
3768
- const ptr = this.__wbg_ptr;
3769
- this.__wbg_ptr = 0;
3770
- JsPipelineResultFinalization.unregister(this);
3771
- return ptr;
3772
- }
3773
- free() {
3774
- const ptr = this.__destroy_into_raw();
3775
- wasm.__wbg_jspipelineresult_free(ptr, 0);
3776
- }
3777
- /**
3778
- * Get the name of the selected model.
3779
- * @returns {string}
3780
- */
3781
- get modelName() {
3782
- let deferred1_0;
3783
- let deferred1_1;
3784
- try {
3785
- const ret = wasm.jspipelineresult_modelName(this.__wbg_ptr);
3786
- deferred1_0 = ret[0];
3787
- deferred1_1 = ret[1];
3788
- return getStringFromWasm0(ret[0], ret[1]);
3789
- } finally {
3790
- wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
3791
- }
3792
- }
3793
- /**
3794
- * Get the decision log as a formatted string.
3795
- * @returns {string}
3796
- */
3797
- get decisionLog() {
3798
- let deferred1_0;
3799
- let deferred1_1;
3800
- try {
3801
- const ret = wasm.jspipelineresult_decisionLog(this.__wbg_ptr);
3802
- deferred1_0 = ret[0];
3803
- deferred1_1 = ret[1];
3804
- return getStringFromWasm0(ret[0], ret[1]);
3805
- } finally {
3806
- wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
3807
- }
3808
- }
3809
- /**
3810
- * Get a human-readable summary of the result.
3811
- * @returns {string}
3812
- */
3813
- toString() {
3814
- let deferred1_0;
3815
- let deferred1_1;
3816
- try {
3817
- const ret = wasm.jspipelineresult_toString(this.__wbg_ptr);
3818
- deferred1_0 = ret[0];
3819
- deferred1_1 = ret[1];
3820
- return getStringFromWasm0(ret[0], ret[1]);
3821
- } finally {
3822
- wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
3823
- }
3824
- }
3825
- /**
3826
- * Get metric scores as JSON (undefined if not computed).
3827
- * @returns {any}
3828
- */
3829
- get metricScores() {
3830
- const ret = wasm.jspipelineresult_metricScores(this.__wbg_ptr);
3831
- if (ret[2]) {
3832
- throw takeFromExternrefTable0(ret[1]);
3833
- }
3834
- return takeFromExternrefTable0(ret[0]);
3835
- }
3836
- /**
3837
- * Get quality floor result (undefined if not computed).
3838
- * @returns {string | undefined}
3839
- */
3840
- get qualityFloor() {
3841
- const ret = wasm.jspipelineresult_qualityFloor(this.__wbg_ptr);
3842
- let v1;
3843
- if (ret[0] !== 0) {
3844
- v1 = getStringFromWasm0(ret[0], ret[1]).slice();
3845
- wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
3846
- }
3847
- return v1;
3848
- }
3849
- /**
3850
- * Get the number of decisions in the log.
3851
- * @returns {number}
3852
- */
3853
- get decisionCount() {
3854
- const ret = wasm.jspipelineresult_decisionCount(this.__wbg_ptr);
3855
- return ret >>> 0;
3856
- }
3857
- /**
3858
- * Get preprocessing info (undefined if not applied).
3859
- * @returns {any}
3860
- */
3861
- get preprocessInfo() {
3862
- const ret = wasm.jspipelineresult_preprocessInfo(this.__wbg_ptr);
3863
- if (ret[2]) {
3864
- throw takeFromExternrefTable0(ret[1]);
3865
- }
3866
- return takeFromExternrefTable0(ret[0]);
3867
- }
3868
- /**
3869
- * Get ensemble weights as JSON (undefined if not an ensemble).
3870
- * @returns {any}
3871
- */
3872
- get ensembleWeights() {
3873
- const ret = wasm.jspipelineresult_ensembleWeights(this.__wbg_ptr);
3874
- if (ret[2]) {
3875
- throw takeFromExternrefTable0(ret[1]);
3876
- }
3877
- return takeFromExternrefTable0(ret[0]);
3878
- }
3879
- /**
3880
- * Get model confidence set (undefined if not computed).
3881
- * @returns {any}
3882
- */
3883
- get modelConfidenceSet() {
3884
- const ret = wasm.jspipelineresult_modelConfidenceSet(this.__wbg_ptr);
3885
- if (ret[2]) {
3886
- throw takeFromExternrefTable0(ret[1]);
3887
- }
3888
- return takeFromExternrefTable0(ret[0]);
3889
- }
3890
- /**
3891
- * Get selection confidence (undefined if not computed).
3892
- * @returns {string | undefined}
3893
- */
3894
- get selectionConfidence() {
3895
- const ret = wasm.jspipelineresult_selectionConfidence(this.__wbg_ptr);
3896
- let v1;
3897
- if (ret[0] !== 0) {
3898
- v1 = getStringFromWasm0(ret[0], ret[1]).slice();
3899
- wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
3900
- }
3901
- return v1;
3902
- }
3903
- /**
3904
- * Generate a full structured report.
3905
- * @returns {JsPipelineReport}
3906
- */
3907
- report() {
3908
- const ret = wasm.jspipelineresult_report(this.__wbg_ptr);
3909
- return JsPipelineReport.__wrap(ret);
3910
- }
3911
- /**
3912
- * Get the data profile (undefined if profiling was not enabled).
3913
- * @returns {JsDataProfile | undefined}
3914
- */
3915
- get profile() {
3916
- const ret = wasm.jspipelineresult_profile(this.__wbg_ptr);
3917
- return ret === 0 ? undefined : JsDataProfile.__wrap(ret);
3918
- }
3919
- /**
3920
- * Get the forecast.
3921
- * @returns {Forecast}
3922
- */
3923
- get forecast() {
3924
- const ret = wasm.jspipelineresult_forecast(this.__wbg_ptr);
3925
- return Forecast.__wrap(ret);
3926
- }
3927
- }
3928
- if (Symbol.dispose) JsPipelineResult.prototype[Symbol.dispose] = JsPipelineResult.prototype.free;
3929
-
3930
- /**
3931
- * Point forecasts — a sequence of predicted values.
3932
- *
3933
- * Used as input for postprocessing methods.
3934
- */
3935
- export class JsPointForecasts {
3936
- __destroy_into_raw() {
3937
- const ptr = this.__wbg_ptr;
3938
- this.__wbg_ptr = 0;
3939
- JsPointForecastsFinalization.unregister(this);
3940
- return ptr;
3941
- }
3942
- free() {
3943
- const ptr = this.__destroy_into_raw();
3944
- wasm.__wbg_jspointforecasts_free(ptr, 0);
3945
- }
3946
- /**
3947
- * Create point forecasts from an array of values.
3948
- * @param {Float64Array} values
3949
- */
3950
- constructor(values) {
3951
- const ptr0 = passArrayF64ToWasm0(values, wasm.__wbindgen_malloc);
3113
+ constructor(values) {
3114
+ const ptr0 = passArrayF64ToWasm0(values, wasm.__wbindgen_malloc);
3952
3115
  const len0 = WASM_VECTOR_LEN;
3953
3116
  const ret = wasm.jspointforecasts_new(ptr0, len0);
3954
3117
  this.__wbg_ptr = ret >>> 0;
@@ -6038,27 +5201,6 @@ export function durbinWatson(residuals) {
6038
5201
  return takeFromExternrefTable0(ret[0]);
6039
5202
  }
6040
5203
 
6041
- /**
6042
- * Generate a human-readable explanation of a pipeline result.
6043
- *
6044
- * @param result - A JsPipelineResult to explain
6045
- * @param verbosity - "brief", "normal", or "detailed"
6046
- * @returns Object with `summary` and `sections`
6047
- * @param {JsPipelineResult} result
6048
- * @param {string} verbosity
6049
- * @returns {any}
6050
- */
6051
- export function explainResult(result, verbosity) {
6052
- _assertClass(result, JsPipelineResult);
6053
- const ptr0 = passStringToWasm0(verbosity, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
6054
- const len0 = WASM_VECTOR_LEN;
6055
- const ret = wasm.explainResult(result.__wbg_ptr, ptr0, len0);
6056
- if (ret[2]) {
6057
- throw takeFromExternrefTable0(ret[1]);
6058
- }
6059
- return takeFromExternrefTable0(ret[0]);
6060
- }
6061
-
6062
5204
  /**
6063
5205
  * Initialize the WASM module.
6064
5206
  *
@@ -6241,28 +5383,6 @@ export function sampleEntropy(values, m, r) {
6241
5383
  return ret;
6242
5384
  }
6243
5385
 
6244
- /**
6245
- * Recommend models based on data profile characteristics.
6246
- *
6247
- * Returns an object with `recommended` (model names) and `reasoning` (explanations).
6248
- *
6249
- * @param profile - A JsDataProfile from profiling
6250
- * @param availableModels - Optional array of model names to filter by
6251
- * @param {JsDataProfile} profile
6252
- * @param {string[] | null} [available_models]
6253
- * @returns {any}
6254
- */
6255
- export function selectModels(profile, available_models) {
6256
- _assertClass(profile, JsDataProfile);
6257
- var ptr0 = isLikeNone(available_models) ? 0 : passArrayJsValueToWasm0(available_models, wasm.__wbindgen_malloc);
6258
- var len0 = WASM_VECTOR_LEN;
6259
- const ret = wasm.selectModels(profile.__wbg_ptr, ptr0, len0);
6260
- if (ret[2]) {
6261
- throw takeFromExternrefTable0(ret[1]);
6262
- }
6263
- return takeFromExternrefTable0(ret[0]);
6264
- }
6265
-
6266
5386
  /**
6267
5387
  * Compute the skewness (third standardized moment) of a time series.
6268
5388
  *