Download tests/test_data.py from david-thrower/geofare-pipeline: direct link, hf CLI and curl.
- Browser
- Download file 672 Bytes
-
https://huggingface.co/david-thrower/geofare-pipeline/resolve/main/tests/test_data.py
- Command line
-
hf download hf://david-thrower/geofare-pipeline/tests/test_data.py
-
curl -L -o test_data.py https://huggingface.co/david-thrower/geofare-pipeline/resolve/main/tests/test_data.py
672 Bytes
| """Sanity checks on the generated dataset.""" | |
| from pathlib import Path | |
| import numpy as np | |
| DATA = Path(__file__).resolve().parent.parent / "data" / "train.csv" | |
| def test_data_shape(): | |
| arr = np.genfromtxt(DATA, delimiter=",", skip_header=1) | |
| assert arr.shape == (12000, 7) | |
| def test_data_clean(): | |
| arr = np.genfromtxt(DATA, delimiter=",", skip_header=1) | |
| assert not np.isnan(arr).any() | |
| assert set(np.unique(arr[:, 6])) <= {0.0, 1.0} | |
| def test_geo_in_grid(): | |
| arr = np.genfromtxt(DATA, delimiter=",", skip_header=1) | |
| assert arr[:, 0].min() >= 40.60 and arr[:, 0].max() <= 40.725 | |
| assert arr[:, 1].min() >= -74.02 and arr[:, 1].max() <= -73.70 | |