File size: 1,906 Bytes
ff4becd
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
"""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"]