Scikit-learn
human-activity-recognition
wearable
wrist
time-series
cpu
scikit-learn
File size: 1,625 Bytes
4731b11
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
93a9282
4731b11
 
 
 
93a9282
 
4731b11
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
33
34
35
36
37
38
39
40
41
"""When run against an installed wheel (WISP_EXPECT_INSTALLED=1), check what is imported."""
import importlib.util
import os
from pathlib import Path

import pytest

ROOT = Path(__file__).resolve().parents[1]


@pytest.mark.skipif(os.environ.get("WISP_EXPECT_INSTALLED") != "1", reason="only for installed-wheel runs")
def test_imports_resolve_outside_source_tree():
    import wisp
    import wisp_fast
    import wisp_release
    for mod in (wisp, wisp_fast, wisp_release):
        assert ROOT / "src" not in Path(mod.__file__).resolve().parents, mod.__file__
    assert wisp.__version__ == "0.4.0"


@pytest.mark.skipif(os.environ.get("WISP_EXPECT_NATIVE") not in ("0", "1"), reason="native expectation not set")
def test_native_kernels_presence():
    names = ("_kernels", "_family_kernels", "_cis_intervals", "_cis_conv",
             "funnel._kernels", "funnel._family_kernels", "funnel._cis_intervals", "funnel._cis_lite")
    found = [importlib.util.find_spec(f"wisp_fast.{n}") is not None for n in names]
    if os.environ["WISP_EXPECT_NATIVE"] == "1":
        assert all(found), found
    else:
        assert not any(found), found


def test_public_names():
    import wisp
    for name in ("WISPClassifier", "WISPRepresentation", "HMMSmoother", "WISPSelect", "WISPSearch",
                 "recipes", "blocks", "adapters", "datasets", "hub", "metrics"):
        assert getattr(wisp, name) is not None
    with pytest.raises(NotImplementedError):
        wisp.hub.load_pretrained(method="random", dataset="adl", fold=0, seed=42)
    from wisp.cli import main
    assert main(["recipes", "--source", "fixed"]) == 0