DataFeed๏ƒ

DataFeed: the only object that hands out data during a run.

Everything a model sees while being evaluated flows through here, bound to the simulation clock (asof). Availability rules live on the Field; the feed enforces them:

  • actuals โ€” values stamped t are served iff t + availability_lag <= asof;

  • forecasts โ€” runs issued at i are served iff i + availability_lag <= asof, and per valid_time the latest such run wins;

  • statics โ€” always served.

With the feed as the sole gate, look-ahead leakage is impossible by construction rather than by runner discipline.

class emflow.data.feed.DataFeed(dataset: Dataset)[source]๏ƒ

Bases: object

Point-in-time access to a Dataset.

history(asof, name: str, window=None, strict=False) DataFrame[source]๏ƒ

Actual values of field name knowable at asof.

For bitemporal fields (knowledge_col set) the filter runs on the knowledge axis and, per measurement timestamp, the latest revision already knowable wins โ€” a backtest sees preliminary values exactly as a live participant did. The knowledge column is dropped from the returned frame.

window (optional, anything pd.Timedelta accepts) limits the result to the trailing window before the availability cutoff โ€” an efficiency knob, never a leakage one.

strict excludes the cutoff instant itself (< instead of <=). Training views use this so a training boundary placed exactly on the first scored target never serves it.

forecasts(asof, name: str, columns=None) DataFrame[source]๏ƒ

Latest forecast run of field name knowable at asof.

Returns a frame indexed by valid_time where, for each valid_time, the value comes from the most recent run with issue_time + availability_lag <= asof. An issue_time column records which run each row came from.

static(name: str) DataFrame[source]๏ƒ
actuals_between(name: str, start, end, asof) DataFrame[source]๏ƒ

Actuals of name in [start, end] โ€” only if knowable at asof.

Used by environments to settle scores: returns the slice restricted to what the availability rule allows at asof (so an env can only score an origin once its targets have actually arrived).

view(asof, strict=False) TimeView[source]๏ƒ

A feed bound to a fixed clock time (what observations wrap).

strict=True makes the boundary exclusive โ€” used for training views.

class emflow.data.feed.TimeView(feed: DataFeed, asof, strict=False)[source]๏ƒ

Bases: object

A DataFeed frozen at one clock time.

This is the whole world a model gets to see: observations and training views are TimeView s. There is deliberately no way to reach the underlying dataset or move the clock from here.

history(name: str, window=None) DataFrame[source]๏ƒ
forecasts(name: str, columns=None) DataFrame[source]๏ƒ
static(name: str) DataFrame[source]๏ƒ
property fields๏ƒ