I have a list containing many lists. I use a dtw approach using the fastdtw python package to calculate the distance between an input list and the lists inside the list. This gives me a list of distances from which I choose the minimum value and estimate it as the one closest to the input array. This process works but it is CPU intensive and time consuming if the number and the length of lists are large.
from fastdtw import fastdtw
import scipy.spatial.distance as ssd
inputlist = [1,2,3,4,5]
complelte_list = [[1,1,3,9,1],[1,2,6,4],[9,8,7,4,2]]
dst = []
for arr in complete_lists:
distance, path = fastdtw(arr,inputlist,dist=ssd.euclidean)
dst.append(distance)