MCPcopy
hub / github.com/stumpy-dev/stumpy / test_stimped

Function test_stimped

tests/test_stimp.py:222–264  ·  view source on GitHub ↗
(T, dask_cluster)

Source from the content-addressed store, hash-verified

220@pytest.mark.filterwarnings("ignore:\\s+Port 8787 is already in use:UserWarning")
221@pytest.mark.parametrize("T", T)
222def test_stimped(T, dask_cluster):
223 with Client(dask_cluster) as dask_client:
224 threshold = 0.2
225 min_m = 3
226 n = T.shape[0] - min_m + 1
227
228 pan = stimped(
229 dask_client,
230 T,
231 min_m=min_m,
232 max_m=None,
233 step=1,
234 # normalize=True,
235 )
236
237 for i in range(n):
238 pan.update()
239
240 ref_PAN = np.full((pan.M_.shape[0], T.shape[0]), fill_value=np.inf)
241
242 for idx, m in enumerate(pan.M_[:n]):
243 zone = int(np.ceil(m / 4))
244 ref_mp = naive.stump(T, m, T_B=None, exclusion_zone=zone)
245 ref_PAN[pan._bfs_indices[idx], : ref_mp.shape[0]] = ref_mp[:, 0]
246
247 # Compare raw pan
248 cmp_PAN = pan._PAN
249
250 naive.replace_inf(ref_PAN)
251 naive.replace_inf(cmp_PAN)
252
253 npt.assert_almost_equal(ref_PAN, cmp_PAN)
254
255 # Compare transformed pan
256 cmp_pan = pan.PAN_
257 ref_pan = naive.transform_pan(
258 pan._PAN, pan._M, threshold, pan._bfs_indices, pan._n_processed
259 )
260
261 naive.replace_inf(ref_pan)
262 naive.replace_inf(cmp_pan)
263
264 npt.assert_almost_equal(ref_pan, cmp_pan)
265
266
267def test_stimp_1_percent_with_isconstant():

Callers

nothing calls this directly

Calls 2

stimpedClass · 0.90
updateMethod · 0.45

Tested by

no test coverage detected