How to use the matrixprofile.scrimp.calc_curdistance 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
expected_result = np.array([
        0,
        0,
        0.4215e-07,
        0.4215e-07,
        0.4215e-07,
    ])

    np.testing.assert_almost_equal(curdistance, expected_result)

    # test index 3
    idx = 3
    curlastz = np.zeros(profile_len)
    curlastz = scrimp.calc_curlastz(ts, m, n, idx, profile_len, curlastz)
    curdistance = np.zeros(profile_len)
    curdistance = scrimp.calc_curdistance(curlastz, meanx, sigmax, idx, 
                                          profile_len, m, curdistance)

    np.testing.assert_almost_equal(curdistance, expected_result)
github target / matrixprofile-ts / tests / test_scrimp.py View on Github external
def test_calc_curdistance():
    ts = np.array([1, 2, 3, 4, 5, 6, 7, 8])
    m = 4

    # test index 2
    idx = 2
    profile_len = scrimp.calc_profile_len(len(ts), m)
    X, n, sumx2, sumx, meanx, sigmax2, sigmax = scrimp.fast_find_nn_pre(ts, m)
    curlastz = np.zeros(profile_len)
    curlastz = scrimp.calc_curlastz(ts, m, n, idx, profile_len, curlastz)

    curdistance = np.zeros(profile_len)
    curdistance = scrimp.calc_curdistance(curlastz, meanx, sigmax, idx, 
                                          profile_len, m, curdistance)

    expected_result = np.array([
        0,
        0,
        0.4215e-07,
        0.4215e-07,
        0.4215e-07,
    ])

    np.testing.assert_almost_equal(curdistance, expected_result)

    # test index 3
    idx = 3
    curlastz = np.zeros(profile_len)
    curlastz = scrimp.calc_curlastz(ts, m, n, idx, profile_len, curlastz)