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 src/wisp/blocks.py from Zipeng365/WISP: direct link, hf CLI and curl.
- Browser
- Download file 1.8 kB
-
https://huggingface.co/Zipeng365/WISP/resolve/main/src/wisp/blocks.py
- Command line
-
hf download hf://Zipeng365/WISP/src/wisp/blocks.py
-
curl -L -o blocks.py https://huggingface.co/Zipeng365/WISP/resolve/main/src/wisp/blocks.py
1.8 kB
| """The three WISP-CIS representation blocks under their paper names. | |
| Each function returns an unfitted kernel transformer configured exactly as inside | |
| WISP-CIS (``wisp.cis_algorithms.StateRocketIntervalHMM``) for the given seed. They take | |
| windows ``(n, T, C)`` and return ``(n, d)`` features; each standardises every window | |
| and channel itself. | |
| """ | |
| from __future__ import annotations | |
| from wisp.cpu.features import IntervalDistributionSketch, RandomConvSketch, WearableFeatureExtractor | |
| __all__ = ["RandomConvolution", "IntervalSummary", "StateSpectral"] | |
| def RandomConvolution(random_state: int = 42, n_kernels: int = 384) -> RandomConvSketch: | |
| """Paper block R: random dilated multichannel convolutions with PPV/max/mean/std pooling.""" | |
| return RandomConvSketch(n_kernels=int(n_kernels), random_state=int(random_state)) | |
| def IntervalSummary(random_state: int = 42, n_intervals: int = 24) -> IntervalDistributionSketch: | |
| """Paper block I: dyadic plus random intervals summarised by moments, slope and quantiles. | |
| ``random_state`` is the recipe seed; the CIS seed offset (+29) is applied here, so | |
| ``IntervalSummary(s)`` equals the I block of ``WISPRepresentation("cis", random_state=s)``. | |
| """ | |
| return IntervalDistributionSketch(n_random_intervals=int(n_intervals), random_state=int(random_state) + 29) | |
| def StateSpectral() -> WearableFeatureExtractor: | |
| """Paper block S: magnitude/jerk, spectrum, autocorrelation, cross-axis and symbolic state features.""" | |
| return WearableFeatureExtractor(include_raw_stats=False, include_magnitude=True, include_jerk=True, | |
| include_multiscale=False, include_spectral=True, include_autocorr=True, | |
| include_cross_channel=True, include_symbolic=True, symbolic_bins=6) | |