Skip to content
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

Failure in snippets #984

Open
NimaSarajpoor opened this issue Jun 8, 2024 · 0 comments
Open

Failure in snippets #984

NimaSarajpoor opened this issue Jun 8, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@NimaSarajpoor
Copy link
Collaborator

NimaSarajpoor commented Jun 8, 2024

The test function tests/test_snippets.py::test_mpdist_snippets_s_with_isconstant may sometimes fail. The following script exposes the failure:

# stumpy version: 1.12.0

import numpy as np 
import numpy.testing as npt
import functools
import naive
from stumpy import snippets
from stumpy import config


def test_func(T):  # test_mpdist_snippets_s_with_isconstant
    m = 8
    k = 3
    s = 3

    isconstant_custom_func = functools.partial(
        naive.isconstant_func_stddev_threshold, quantile_threshold=0.05
    )
    (
        ref_snippets,
        ref_indices,
        ref_profiles,
        ref_fractions,
        ref_areas,
        ref_regimes,
    ) = naive.mpdist_snippets(
        T, m, k, s=s, mpdist_T_subseq_isconstant=isconstant_custom_func
    )
    (
        cmp_snippets,
        cmp_indices,
        cmp_profiles,
        cmp_fractions,
        cmp_areas,
        cmp_regimes,
    ) = snippets(T, m, k, s=s, mpdist_T_subseq_isconstant=isconstant_custom_func)

    npt.assert_almost_equal(
        ref_snippets, cmp_snippets, decimal=config.STUMPY_TEST_PRECISION
    )
    npt.assert_almost_equal(
        ref_indices, cmp_indices, decimal=config.STUMPY_TEST_PRECISION
    )
    npt.assert_almost_equal(
        ref_profiles, cmp_profiles, decimal=config.STUMPY_TEST_PRECISION
    )
    npt.assert_almost_equal(
        ref_fractions, cmp_fractions, decimal=config.STUMPY_TEST_PRECISION
    )
    npt.assert_almost_equal(ref_areas, cmp_areas, decimal=config.STUMPY_TEST_PRECISION)
    npt.assert_almost_equal(ref_regimes, cmp_regimes)



if __name__ == '__main__':
    seed = 455
    np.random.seed(seed)
    T = np.random.uniform(-1000, 1000, [64]).astype(np.float64)
    test_func(T)

[Note]
The last three assertions are passing.

@NimaSarajpoor NimaSarajpoor added the bug Something isn't working label Jun 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant