Skip to main content

zsfm_core/
forecast.rs

1use std::path::Path;
2
3use anyhow::Result;
4
5/// `[quantile_level][variate][horizon_step]` — the output shape every
6/// zsfm time-series forecaster produces.
7pub type QuantileMatrix = Vec<Vec<Vec<f32>>>;
8
9/// Common interface implemented by every GGUF-quantized zero-shot time-series
10/// forecaster in the workspace (Toto, Chronos, TimesFM, …). Lets the CLI and
11/// Python bindings dispatch across models without per-model glue code.
12pub trait Forecaster: Sized {
13    type Config;
14
15    fn load(gguf_path: &Path, config: Self::Config) -> Result<Self>;
16
17    /// `context[variate][timestep]`, `mask[variate][timestep]` (`true` = observed).
18    /// Returns `quantiles[quantile_level][variate][horizon_step]`.
19    fn forecast(
20        &self,
21        context: &[Vec<f32>],
22        mask: &[Vec<bool>],
23        horizon: usize,
24    ) -> Result<QuantileMatrix>;
25}