Skip to content

Commit

Permalink
Merge pull request #1 from MSD-IRIMAS/aif/add-utils
Browse files Browse the repository at this point in the history
[MNT] Add utils missing
  • Loading branch information
hadifawaz1999 authored Jul 21, 2024
2 parents 1b58fd6 + b5f8660 commit 0866872
Showing 1 changed file with 13 additions and 10 deletions.
23 changes: 13 additions & 10 deletions utils.py
Original file line number Diff line number Diff line change
@@ -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):
Expand All @@ -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)

0 comments on commit 0866872

Please sign in to comment.