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/test_interval_kernels.py from Zipeng365/WISP: direct link, hf CLI and curl.
- Browser
- Download file 1.6 kB
-
https://huggingface.co/Zipeng365/WISP/resolve/main/tests/test_interval_kernels.py
- Command line
-
hf download hf://Zipeng365/WISP/tests/test_interval_kernels.py
-
curl -L -o test_interval_kernels.py https://huggingface.co/Zipeng365/WISP/resolve/main/tests/test_interval_kernels.py
1.6 kB
| import unittest | |
| from unittest.mock import patch | |
| import numpy as np | |
| from wisp_fast import features as fx | |
| from wisp_fast.cache import transform_blocks | |
| from wisp_fast.parallel import parallel_rows | |
| class IntervalsAndSharedTests(unittest.TestCase): | |
| def test_random_shapes_discrete_and_fractional(self): | |
| rng=np.random.default_rng(918) | |
| for n,t,c in ((1,19,3),(8,160,3),(5,64,1),(7,47,6)): | |
| for turbo in (False,True): | |
| for discrete in (False,True): | |
| with self.subTest(n=n,t=t,c=c,turbo=turbo,discrete=discrete): | |
| X=rng.standard_normal((n,t,c)) | |
| if discrete:X=np.round(X,1) | |
| X[0,:,0]=0 | |
| blocks=[fx.IntervalDistributionSketch(fast_profile=turbo).fit(X), | |
| fx.WearableFeatureExtractor(include_raw_stats=False,include_multiscale=False, | |
| fast_profile=turbo).fit(X)] | |
| with patch.object(fx,"_cis_intervals",None): | |
| want=[block.transform(X) for block in blocks] | |
| got=transform_blocks(blocks,X) | |
| for a,b in zip(want,got):np.testing.assert_array_equal(a,b) | |
| def test_threaded_rows_and_guards(self): | |
| x=np.random.default_rng(7).normal(size=(160,64,3)) | |
| m=fx.IntervalDistributionSketch().fit(x) | |
| np.testing.assert_array_equal(m.transform(x),parallel_rows(m.transform,x,4)) | |
| with self.assertRaises(ValueError):parallel_rows(m.transform,x,0) | |