Spaces:
Running
Running
File size: 1,070 Bytes
5063745 | 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 | from __future__ import annotations
from dataclasses import dataclass
from typing import Iterator, Protocol, runtime_checkable
import numpy as np
@dataclass(frozen=True)
class DatasetMetadata:
"""Static metadata for a benchmark dataset configuration."""
name: str
domain: str
frequency: str
num_variates: int
terms: tuple[str, ...] = ("short",)
source_type: str = "synthetic"
@dataclass(frozen=True)
class TimeSeriesRecord:
"""One multivariate or univariate time series instance."""
item_id: str
target: np.ndarray
start: str
freq: str
@runtime_checkable
class TimeSeriesDataSource(Protocol):
"""Streaming data source for benchmark datasets.
Real-world backends (HF datasets, databases, APIs) should implement this
protocol and yield ``TimeSeriesRecord`` instances lazily via ``stream()``.
"""
def list_datasets(self) -> list[str]:
...
def get_metadata(self, name: str) -> DatasetMetadata:
...
def stream(self, name: str) -> Iterator[TimeSeriesRecord]:
...
|