Spaces:
Sleeping
Sleeping
Download code/tests/test_fcm.py from acra-thesis/acra-backend: direct link, hf CLI and curl.
- Browser
- Download file 426 Bytes
-
https://huggingface.co/spaces/acra-thesis/acra-backend/resolve/main/code/tests/test_fcm.py
- Command line
-
hf download hf://spaces/acra-thesis/acra-backend/code/tests/test_fcm.py
-
curl -L -o test_fcm.py https://huggingface.co/spaces/acra-thesis/acra-backend/resolve/main/code/tests/test_fcm.py
426 Bytes
| import numpy as np | |
| from pipeline.fcm import run_fcm | |
| def test_fcm_keeps_centers_finite_when_clusters_are_empty(): | |
| lab = np.zeros((64, 64, 3), dtype=np.float64) | |
| lab[:32, :, 0] = 50.0 | |
| lab[32:, :, 0] = 70.0 | |
| centers, memberships = run_fcm(lab, n_clusters=16) | |
| assert np.isfinite(centers).all() | |
| assert np.isfinite(memberships).all() | |
| np.testing.assert_allclose(memberships.sum(axis=1), 1.0, atol=1e-6) |