0

I've used a function to compute the Dynamic Time Warping (DTW) score between two time series. However, in some cases, the calculated score exceeds 1, such as 5.39. As a newcomer to this concept, I'm uncertain whether my implementation is flawed or if I'm overlooking a fundamental aspect.

My primary objective is to ascertain the similarity score (DTW) between two sequences, which I intend to utilize for classification purposes. I've experimented with normalizing the scores, and while it appears to yield satisfactory results, I'm unsure whether normalization is the appropriate approach and whether it's typical for DTW scores to surpass 1. Could someone please elucidate this?

Below is the code snippet I've employed:

def calculate_Discords_dtw_distance(series1, series2):
    
    try:
        """
        Calculates the Dynamic Time Warping distance between two series.

        Args:
            series1 (np.ndarray): First series of data points.
            series2 (np.ndarray): Second series of data points.
        """

        from dtaidistance import dtw

        distance, paths = dtw.warping_paths(series1, series2, use_c=False)
        best_path = dtw.best_path(paths)
        similarity_score = distance / len(best_path)

        # Check if distance exceeds the threshold
        return similarity_score
        
    except Exception as e:
        
        print(e)

Any insights into refining the wording and understanding the behavior of DTW scores exceeding 1 would be greatly appreciated.

I was expecting the function to return scores below 1, but for some cases it is returning a much higher values like 5.39. I tried normalizing it but I am unsure if that is correct approach or not.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.