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
File size: 1,793 Bytes
93a9282 4731b11 | 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 | """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
@pytest.fixture(scope="session")
def train_windows():
return make_windows_fixture(seed=0)
@pytest.fixture(scope="session")
def test_windows():
return make_windows_fixture(seed=1, offset=50)
@pytest.fixture(scope="session")
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")
|