From b5f8660daf586f80f59b491181778f0d03e1a9dd Mon Sep 17 00:00:00 2001 From: hadifawaz1999 Date: Sun, 21 Jul 2024 14:17:52 +0200 Subject: [PATCH] add utils missing --- utils.py | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/utils.py b/utils.py index f470d11..3ea0686 100644 --- a/utils.py +++ b/utils.py @@ -1,17 +1,7 @@ -import matplotlib.pyplot as plt -from tqdm.auto import tqdm -import matplotlib as mpl -from matplotlib.animation import FuncAnimation -from matplotlib.patches import ConnectionPatch -from matplotlib.animation import PillowWriter import numpy as np import os -from matplotlib.lines import Line2D from sklearn.preprocessing import LabelEncoder -from tslearn.metrics import dtw_path -from aeon.distances import cost_matrix -from aeon.distances._alignment_paths import compute_min_return_path def create_directory(directory_path): @@ -34,3 +24,16 @@ def encode_labels(y): labenc = LabelEncoder() return labenc.fit_transform(y) + + +def dtw_path_to_plot(path_dtw): + + axis_x = [] + axis_y = [] + + for pair in path_dtw: + + axis_x.append(pair[0]) + axis_y.append(pair[1]) + + return np.asarray(axis_x), np.asarray(axis_y)