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)

train is a TimeView frozen at the problemโ€™s training cutoff. Pull what you need via train.history(...) / train.forecasts(...).

predict(obs)

Return a DataFrame indexed by obs.target_index with either a "point" column or float quantile columns matching self.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 fit with 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.

abstract predict(obs) DataFrame[source]๏ƒ

Forecast one origin: a DataFrame indexed by obs.target_index.

copy(name: str | None = None) Predictor[source]๏ƒ
class emflow.models.predictor.FeaturePredictor(features=None, name: str | None = None)[source]๏ƒ

Bases: Predictor

Predictor over a declarative, point-in-time-correct feature matrix.

Subclasses declare features (specs from emflow.features) and implement predict_tabular(); they may also use emflow.features.materialize.supervised_frame() in fit.

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.

predict(obs) DataFrame[source]๏ƒ

Forecast one origin: a DataFrame indexed by obs.target_index.