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

Function test_stumpi_self_join_egress

tests/test_stumpi.py:81–188  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

79
80
81def test_stumpi_self_join_egress():
82 m = 3
83
84 seed = np.random.randint(100000)
85 np.random.seed(seed)
86 n = 30
87 T = np.random.rand(n)
88
89 ref_mp = naive.stumpi_egress(T, m)
90 ref_P = ref_mp.P_.copy()
91 ref_I = ref_mp.I_
92 ref_left_P = ref_mp.left_P_.copy()
93 ref_left_I = ref_mp.left_I_
94
95 stream = stumpi(T, m, egress=True)
96
97 comp_P = stream.P_.copy()
98 comp_I = stream.I_
99 comp_left_P = stream.left_P_.copy()
100 comp_left_I = stream.left_I_
101
102 naive.replace_inf(ref_P)
103 naive.replace_inf(ref_left_P)
104 naive.replace_inf(comp_P)
105 naive.replace_inf(comp_left_P)
106
107 npt.assert_almost_equal(ref_P, comp_P)
108 npt.assert_almost_equal(ref_I, comp_I)
109 npt.assert_almost_equal(ref_left_P, comp_left_P)
110 npt.assert_almost_equal(ref_left_I, comp_left_I)
111
112 for i in range(34):
113 t = np.random.rand()
114 ref_mp.update(t)
115 stream.update(t)
116
117 comp_P = stream.P_.copy()
118 comp_I = stream.I_
119 comp_left_P = stream.left_P_.copy()
120 comp_left_I = stream.left_I_
121
122 ref_P = ref_mp.P_.copy()
123 ref_I = ref_mp.I_
124 ref_left_P = ref_mp.left_P_.copy()
125 ref_left_I = ref_mp.left_I_
126
127 naive.replace_inf(ref_P)
128 naive.replace_inf(ref_left_P)
129 naive.replace_inf(comp_P)
130 naive.replace_inf(comp_left_P)
131
132 npt.assert_almost_equal(ref_P, comp_P)
133 npt.assert_almost_equal(ref_I, comp_I)
134 npt.assert_almost_equal(ref_left_P, comp_left_P)
135 npt.assert_almost_equal(ref_left_I, comp_left_I)
136
137 np.random.seed(seed)
138 T = np.random.rand(n)

Callers

nothing calls this directly

Calls 2

stumpiClass · 0.90
updateMethod · 0.45

Tested by

no test coverage detected