Predictor๏
Predictor: the forecasting model contract.
A predictor is fit on a training TimeView and
asked to forecast at Observation s. Both are
feed-served, so a predictor physically cannot see past the information set โ
there is nothing else to look at.
Contract๏
fit(train)trainis a TimeView frozen at the problemโs training cutoff. Pull what you need viatrain.history(...)/train.forecasts(...).predict(obs)Return a DataFrame indexed by
obs.target_indexwith either a"point"column or float quantile columns matchingself.quantiles.
Set output_kind = "quantiles" and quantiles = (0.1, ..., 0.9) for
probabilistic models; the environment validates submissions against it.
FeaturePredictor adds the declarative-feature path: declare
features specs and implement predict_tabular(X); event-mode
predict() then comes for free, and the model gains supports_batch,
unlocking the vectorized execution mode (all origins in one call).
- class emflow.models.predictor.Predictor(name: str | None = None)[source]๏
Bases:
Model,ABC- output_kind: str = 'point'๏
- quantiles: Tuple[float, ...] | None = None๏
- supports_batch: bool = False๏
- bind(problem) Predictor[source]๏
Called by the Experiment before
fitwith the Problem being run.Gives models that need problem context (the schedule, to enumerate training origins; the dataset, for supervised feature frames) a sanctioned way to get it. Default just stores it as
self.problem.
- fit(train) Predictor[source]๏
Fit on a training TimeView. Optional โ override for trainable models.
- class emflow.models.predictor.FeaturePredictor(features=None, name: str | None = None)[source]๏
Bases:
PredictorPredictor over a declarative, point-in-time-correct feature matrix.
Subclasses declare
features(specs fromemflow.features) and implementpredict_tabular(); they may also useemflow.features.materialize.supervised_frame()infit.- supports_batch: bool = True๏
- features: Sequence = ()๏
- abstract predict_tabular(X: DataFrame) DataFrame[source]๏
Forecast from a feature matrix indexed by
(asof, target_time).Must return a frame on the same index (or on
target_time) with the modelโs output columns. Must be row-wise pure: each rowโs forecast may depend only on that rowโs features โ this is what makes single-origin and all-origins evaluation identical.