Instructions to use Zipeng365/WISP with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Scikit-learn
How to use Zipeng365/WISP with Scikit-learn:
from huggingface_hub import hf_hub_download import joblib model = joblib.load( hf_hub_download("Zipeng365/WISP", "sklearn_model.joblib") ) # only load pickle files from sources you trust # read more about it here https://skops.readthedocs.io/en/stable/persistence.html - Notebooks
- Google Colab
- Kaggle
Download tests/conftest.py from Zipeng365/WISP: direct link, hf CLI and curl.
- Browser
- Download file 1.79 kB
-
https://huggingface.co/Zipeng365/WISP/resolve/main/tests/conftest.py
- Command line
-
hf download hf://Zipeng365/WISP/tests/conftest.py
-
curl -L -o conftest.py https://huggingface.co/Zipeng365/WISP/resolve/main/tests/conftest.py
1.79 kB
| """Shared fixtures for the public-interface tests. | |
| Synthetic windows below are software fixtures, not HAR evidence. Tests that compare with | |
| saved paper results need the frozen fold exports and the result CSVs; they run only when | |
| ``WISP_FROZEN_DATA`` (root of ``<dataset>/fold<k>/{train,valid,test}.npz``) is set. | |
| """ | |
| from __future__ import annotations | |
| import os | |
| from pathlib import Path | |
| import numpy as np | |
| import pytest | |
| ROOT = Path(__file__).resolve().parents[1] | |
| def make_windows_fixture(n=90, T=64, C=3, K=3, seed=0, subjects=6, offset=0): | |
| rng = np.random.default_rng(seed) | |
| y = np.resize(np.arange(K), n) | |
| rng.shuffle(y) | |
| t = np.arange(T) | |
| X = np.stack([np.stack([np.sin(2 * np.pi * (c + 1 + k) * t / T + rng.normal()) for c in range(C)], 1) | |
| for k in y]) + rng.normal(0, .3, (n, T, C)) | |
| groups = np.repeat(np.arange(subjects), int(np.ceil(n / subjects)))[:n] + offset | |
| time_index = np.concatenate([np.arange((groups == s).sum()) for s in np.unique(groups)]).astype(float) | |
| return X, y, groups, time_index | |
| def train_windows(): | |
| return make_windows_fixture(seed=0) | |
| def test_windows(): | |
| return make_windows_fixture(seed=1, offset=50) | |
| def valid_windows(): | |
| return make_windows_fixture(n=36, seed=5, subjects=2, offset=100) | |
| def frozen_root(): | |
| root = os.environ.get("WISP_FROZEN_DATA") | |
| return Path(root) if root else None | |
| def saved_results_dir(): | |
| root = os.environ.get("WISP_SAVED_RESULTS") | |
| return Path(root) if root else ROOT / "results" | |
| requires_frozen = pytest.mark.skipif(frozen_root() is None, | |
| reason="set WISP_FROZEN_DATA to the frozen fold exports to run this check") | |