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_fast/funnel/numeric.py from Zipeng365/WISP: direct link, hf CLI and curl.
- Browser
- Download file 885 Bytes
-
https://huggingface.co/Zipeng365/WISP/resolve/main/src/wisp_fast/funnel/numeric.py
- Command line
-
hf download hf://Zipeng365/WISP/src/wisp_fast/funnel/numeric.py
-
curl -L -o numeric.py https://huggingface.co/Zipeng365/WISP/resolve/main/src/wisp_fast/funnel/numeric.py
885 Bytes
| """Numeric geometry (state tables, quantile levels, frequency bands) shared by the feature blocks.""" | |
| from functools import lru_cache | |
| import numpy as np | |
| 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) | |
| 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 | |
| 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) | |