Datasets:
Formats:
json
Languages:
English
Size:
< 1K
Tags:
time-series
time-series-decomposition
benchmark
component-recovery
symbolic-regression
icml-2026
License:
Download code/TSDecompose/src/tsdecomp/methods/sl_lib.py from Zipeng365/TSDecompose-Benchmark: direct link, hf CLI and curl.
- Browser
- Download file 1.16 kB
-
https://huggingface.co/datasets/Zipeng365/TSDecompose-Benchmark/resolve/main/code/TSDecompose/src/tsdecomp/methods/sl_lib.py
- Command line
-
hf download hf://datasets/Zipeng365/TSDecompose-Benchmark/code/TSDecompose/src/tsdecomp/methods/sl_lib.py
-
curl -L -o sl_lib.py https://huggingface.co/datasets/Zipeng365/TSDecompose-Benchmark/resolve/main/code/TSDecompose/src/tsdecomp/methods/sl_lib.py
1.16 kB
| import numpy as np | |
| from typing import Any, Dict | |
| from ..core import DecompResult | |
| from ..registry import MethodRegistry | |
| try: | |
| from synthetic_ts_bench.sl_lib import sl_lib_decompose | |
| _HAS_SL_LIB = True | |
| except ImportError as exc: # pragma: no cover - optional dependency path | |
| sl_lib_decompose = None | |
| _HAS_SL_LIB = False | |
| _IMPORT_ERROR = exc | |
| def sl_lib_wrapper( | |
| y: np.ndarray, | |
| params: Dict[str, Any], | |
| ) -> DecompResult: | |
| if not _HAS_SL_LIB: | |
| raise ImportError( | |
| "synthetic_ts_bench is required for SL_LIB decomposition." | |
| ) from _IMPORT_ERROR | |
| cfg = dict(params or {}) | |
| res = sl_lib_decompose( | |
| np.asarray(y, dtype=float).ravel(), | |
| config=cfg, | |
| fs=float(cfg.get("fs", 1.0)), | |
| meta=None, | |
| ) | |
| meta_out = dict(getattr(res, "extra", {}) or {}) | |
| meta_out.setdefault("method", "SL_LIB") | |
| return DecompResult( | |
| trend=np.asarray(res.trend, dtype=float), | |
| season=np.asarray(res.season, dtype=float), | |
| residual=np.asarray(res.residual, dtype=float), | |
| meta=meta_out, | |
| ) | |