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,207 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 27 | """Split checks and the fit call shared by verification and refits."""
import numpy as np
def check_splits(*parts):
"""Require sequence metadata, one global vocabulary and disjoint group IDs."""
first = parts[0]
if not first.label_names:
raise ValueError("Supply the ordered global label_names")
seen = set()
for data in parts:
if data.label_names != first.label_names or data.X.shape[1:] != first.X.shape[1:]:
raise ValueError("Split vocabularies and time/channel shapes must match")
if data.subject is None or data.time_index is None or not len(data.y):
raise ValueError("Every split needs nonempty windows, subject and time_index")
if np.min(data.y) < 0 or np.max(data.y) >= len(first.label_names):
raise ValueError("Class ID outside supplied global vocabulary")
groups = set(np.asarray(data.subject).astype(str))
if groups & seen:
raise ValueError("Participant/sequence groups overlap between splits")
seen |= groups
def fit_on(model, data):
return model.fit(data.X, data.y, groups=data.subject, time_index=data.time_index,
n_classes=data.n_classes)
|