Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Fix #610 #907

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
NimaSarajpoor wants to merge 3 commits into stumpy-dev:main
base: main
Choose a base branch
Loading
from NimaSarajpoor:fix_precision_identical_subseq
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 47 additions & 0 deletions tests/test_precision.py
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -198,3 +198,50 @@ def test_distance_symmetry_property_in_gpu():
ref = 0.0

npt.assert_almost_equal(comp, ref, decimal=15)


def test_stump_identical_subsequence_self_join_rare_cases_1():
# This test function is designed to capture the errors that migtht be raised
# due the imprecision in the calculation of pearson values in the edge case
# where two subsequences are identical.
m = 3
zone = int(np.ceil(m / 4))

seed_values = [27343, 84451]
for seed in seed_values:
np.random.seed(seed)

identical = np.random.rand(8)
T_A = np.random.rand(20)
T_A[1 : 1 + identical.shape[0]] = identical
T_A[11 : 11 + identical.shape[0]] = identical

ref_mp = naive.stump(T_A, m, exclusion_zone=zone, row_wise=True)
comp_mp = stumpy.stump(T_A, m, ignore_trivial=True)
naive.replace_inf(ref_mp)
naive.replace_inf(comp_mp)
npt.assert_almost_equal(
ref_mp[:, 0], comp_mp[:, 0], decimal=config.STUMPY_TEST_PRECISION
) # ignore indices


def test_stump_identical_subsequence_self_join_rare_cases_2():
m = 3
zone = int(np.ceil(m / 4))

seed_values = [27343, 84451]
for seed in seed_values:
np.random.seed(seed)

identical = np.random.rand(8)
T_A = np.random.rand(20)
T_A[1 : 1 + identical.shape[0]] = identical * 0.001
T_A[11 : 11 + identical.shape[0]] = identical * 1000

ref_mp = naive.stump(T_A, m, exclusion_zone=zone, row_wise=True)
comp_mp = stumpy.stump(T_A, m, ignore_trivial=True)
naive.replace_inf(ref_mp)
naive.replace_inf(comp_mp)
npt.assert_almost_equal(
ref_mp[:, 0], comp_mp[:, 0], decimal=config.STUMPY_TEST_PRECISION
) # ignore indices

AltStyle によって変換されたページ (->オリジナル) /