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: 885 Bytes
93a9282 | 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 | """Numeric geometry (state tables, quantile levels, frequency bands) shared by the feature blocks."""
from functools import lru_cache
import numpy as np
@lru_cache(maxsize=4)
def _state_table(length):
den = np.maximum(np.arange(length + 1), 1)[:, None]
p = np.arange(length + 1, dtype=np.float64)[None, :] / den
return np.stack((p, p * np.log(p + 1e-12)), axis=-1)
@lru_cache(maxsize=128)
def _state_levels(length,bins):
pos = (length-1)*np.linspace(0,1,bins+1)[1:-1]
lo = pos.astype(np.intp)
return lo, np.minimum(lo+1,length-1), pos-lo
@lru_cache(maxsize=64)
def _frequency_plan(time,bands):
freq=np.fft.rfftfreq(time)
pairs=[(0,0) if np.isnan(lo) or np.isnan(hi) else
(int(freq.searchsorted(lo)),int(freq.searchsorted(hi))) for lo,hi in bands]
return freq,np.array([(l,max(l,r)) for l,r in pairs],dtype=np.float64).reshape(-1,2)
|