@sipemu/anofox-forecast 0.4.3 → 0.4.5

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
@@ -1,6 +1,6 @@
1
1
  # @sipemu/anofox-forecast
2
2
 
3
- WebAssembly bindings for [anofox-forecast](https://crates.io/crates/anofox-forecast), a comprehensive time series forecasting library.
3
+ WebAssembly bindings for [anofox-forecast](https://crates.io/crates/anofox-forecast), a comprehensive time series forecasting library with 40+ models, automatic model selection, probabilistic postprocessing, and more.
4
4
 
5
5
  ## Installation
6
6
 
@@ -109,9 +109,16 @@ const ts = TimeSeries.withTimestamps(
109
109
  | `MSTLForecasterWrapper` | MSTL decomposition | `seasonal_periods[]` |
110
110
  | `GARCHForecaster` | GARCH volatility model | `p`, `q` |
111
111
 
112
+ ### Auto Selection
113
+
114
+ | Forecaster | Description | Parameters |
115
+ |------------|-------------|------------|
116
+ | `AutoForecaster` | Best of ARIMA, ETS, Theta | - |
117
+ | `AutoEnsembleForecaster` | Ensemble of top-K models | - |
118
+
112
119
  ## Prediction Intervals
113
120
 
114
- Some models support prediction intervals:
121
+ Most models support prediction intervals:
115
122
 
116
123
  ```javascript
117
124
  import { NaiveForecaster } from '@sipemu/anofox-forecast';
@@ -191,6 +198,48 @@ ETSForecaster.isValidSpec("M", "A", "M"); // true
191
198
  ETSForecaster.isValidSpec("M", "A", "A"); // false (unstable)
192
199
  ```
193
200
 
201
+ ## Probabilistic Postprocessing
202
+
203
+ Generate calibrated prediction intervals using conformal prediction, historical simulation, or normal approximation:
204
+
205
+ ```javascript
206
+ import { JsConformalPredictor, JsPointForecasts, JsPostProcessor } from '@sipemu/anofox-forecast';
207
+
208
+ // Conformal prediction intervals (distribution-free)
209
+ const predictor = new JsConformalPredictor(0.9); // 90% coverage
210
+ predictor.calibrate(forecasts, actuals);
211
+ const intervals = predictor.predictIntervals(newForecasts);
212
+ console.log('Lower:', intervals.lower);
213
+ console.log('Upper:', intervals.upper);
214
+
215
+ // Unified PostProcessor API
216
+ const processor = JsPostProcessor.conformal(0.95);
217
+ const trained = processor.train(forecasts, actuals);
218
+ const pi = processor.predictIntervals(trained, newForecasts);
219
+ ```
220
+
221
+ ### Available Methods
222
+ - `JsConformalPredictor` — distribution-free intervals (split, cross-val, jackknife+)
223
+ - `JsNormalPredictor` — Gaussian error assumption baseline
224
+ - `JsHistoricalSimulator` — non-parametric empirical error distribution
225
+ - `JsPostProcessor` — unified API wrapping all methods
226
+ - `JsBacktestConfig` / `JsBacktestResult` — rolling/expanding window backtesting
227
+
228
+ ## Calendar Annotations
229
+
230
+ Add holidays and named regressors for models that support exogenous variables:
231
+
232
+ ```javascript
233
+ import { CalendarAnnotations } from '@sipemu/anofox-forecast';
234
+
235
+ const calendar = new CalendarAnnotations();
236
+ calendar.addHoliday(Date.parse('2024-12-25'));
237
+ calendar.addRegressor('temperature', new Float64Array([20, 22, 25, 23]));
238
+
239
+ ts.setCalendar(calendar);
240
+ model.fit(ts); // ARIMA, MFLES, etc. will automatically use the regressors
241
+ ```
242
+
194
243
  ## Browser Usage
195
244
 
196
245
  ```html