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,596 Bytes
ac7f7cb | 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 | 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)
|