Download code/macrolens/data.py from DeepAuto-AI/MacroLens: direct link, hf CLI and curl.
- Browser
- Download file 1.91 kB
-
https://huggingface.co/datasets/DeepAuto-AI/MacroLens/resolve/main/code/macrolens/data.py
- Command line
-
hf download hf://datasets/DeepAuto-AI/MacroLens/code/macrolens/data.py
-
curl -L -o data.py https://huggingface.co/datasets/DeepAuto-AI/MacroLens/resolve/main/code/macrolens/data.py
1.91 kB
| """Public data-loading entry point for the MacroLens unified API. | |
| This module is a thin wrapper over :func:`whatif_bench.dataloader.load.load`. | |
| The data layer (``dataloader/``) owns all IO and provenance bookkeeping; | |
| this module exists only so that ``import macrolens as ml; ml.load(...)`` | |
| has a stable, lightweight surface. | |
| """ | |
| from __future__ import annotations | |
| from typing import Any | |
| from ..dataloader.load import load as _load | |
| from ._types import LoadedData | |
| def load( | |
| task: str, | |
| split: str, | |
| *, | |
| granularity: str = "daily", | |
| lookback: int | None = None, | |
| horizon: int | None = None, | |
| setting: str | None = None, | |
| ) -> LoadedData: | |
| """Load canonical task data (delegates to ``dataloader.load.load``). | |
| Parameters | |
| ---------- | |
| task | |
| ``"T1"`` .. ``"T7"``. | |
| split | |
| ``"train"`` or ``"test"``. | |
| granularity | |
| ``"daily"`` (default), ``"weekly"``, or ``"monthly"``. | |
| lookback, horizon | |
| Optional overrides; default to the first values from | |
| ``config.get_lookback_windows(granularity)`` / | |
| ``config.get_horizons(granularity)``. | |
| setting | |
| Optional ablation tier ``"A"``, ``"B"``, ``"C"``, ``"D"``, or | |
| ``"E"``. When set, projects the feature space to the named tier | |
| (T1, T2, T4, T5 only). Setting ``"E"`` matches D's numeric | |
| feature set; LLM methods consume filing-text excerpts at the | |
| prompt layer in addition. | |
| Returns | |
| ------- | |
| :class:`LoadedData` | |
| Sklearn-style ``(X, y, meta)`` NamedTuple. | |
| """ | |
| out: Any = _load( | |
| task, split, granularity=granularity, lookback=lookback, horizon=horizon, | |
| setting=setting, | |
| ) | |
| # The data-layer module defines its own LoadedData NamedTuple; coerce | |
| # to the public type so downstream callers see a single class identity. | |
| return LoadedData(X=out.X, y=out.y, meta=out.meta) | |
| __all__ = ["load"] | |