How to use the matrixprofile.scrimp.calc_begin_idx function in matrixprofile

To help you get started, we’ve selected a few matrixprofile examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github target / matrixprofile-ts / tests / test_scrimp.py View on Github external
def test_calc_begin_idx():
    step_size = 1
    idx_diff = 2

    idx = 0
    val = scrimp.calc_begin_idx(idx, step_size, idx_diff)
    assert(val == 0)

    idx = 1
    val = scrimp.calc_begin_idx(idx, step_size, idx_diff)
    assert(val == 1)
github target / matrixprofile-ts / tests / test_scrimp.py View on Github external
def test_calc_begin_idx():
    step_size = 1
    idx_diff = 2

    idx = 0
    val = scrimp.calc_begin_idx(idx, step_size, idx_diff)
    assert(val == 0)

    idx = 1
    val = scrimp.calc_begin_idx(idx, step_size, idx_diff)
    assert(val == 1)
github target / matrixprofile-ts / tests / test_scrimp.py View on Github external
step_size = 0.25

    # test index 0
    idx = 0
    profile_len = scrimp.calc_profile_len(len(ts), m)
    exclusion_zone = scrimp.calc_exclusion_zone(m)
    subsequence = scrimp.next_subsequence(ts, idx, m)
    X, n, sumx2, sumx, meanx, sigmax2, sigmax = scrimp.fast_find_nn_pre(ts, m)
    dp = scrimp.calc_distance_profile(X, subsequence, n, m, meanx, sigmax)
    dp = scrimp.apply_exclusion_zone(idx, exclusion_zone, profile_len, dp)
    mp = np.zeros(profile_len)
    mp_index = np.zeros(profile_len, dtype='int32')
    mp, mp_index, idx_nn = scrimp.find_and_store_nn(0, idx, mp, mp_index, dp)
    idx_diff = scrimp.calc_idx_diff(idx, idx_nn)
    step_size = scrimp.calc_step_size(m, step_size)
    beginidx = scrimp.calc_begin_idx(idx, step_size, idx_diff)

    refine_distance = np.full(profile_len, np.inf)
    result = scrimp.calc_refine_distance_begin_idx(
        refine_distance, dp, beginidx, idx, idx_diff, idx_nn, sigmax, meanx, m)
    expected_result = np.array([np.inf, np.inf, np.inf, np.inf, np.inf])

    np.testing.assert_almost_equal(result, expected_result)