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,803 Bytes
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 | """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)
|