Skip to content
DeepForgeby svx
All problems
HardTime Seriests-128

Matrix Profile Lite

Problem

Compute the lite matrix profile for a given window size: for each subsequence return the Euclidean distance to its nearest other subsequence (a lower value means a stronger motif).

Return an empty list if window is not positive or exceeds the series. A series with a single window returns [0.0].

Hint

The matrix profile is the nearest-neighbor distance profile.

Test cases

case 1
in: [[1,2,3,4,5],2]
expected: [1.4142135623730951,1.4142135623730951,1.4142135623730951,1.4142135623730951]
case 2
in: [[1,2,1,2],2]
expected: [0,1.4142135623730951,0]
case 3
in: [[5,5,5],2]
expected: [0,0]
case 4
in: [[1,2,3],2]
expected: [1.4142135623730951,1.4142135623730951]
Starter codePython
def matrix_profile_lite(series, window):
    # Your code here
    pass

4 test cases · run your code against them in the editor