New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add PRCIS Distance Measure Notebook #771
Comments
Just a thought, but what we could do is split the time series into a specific num of segments then apply cubic interpolation to each segment. With this, we can approximate values within each segment and then calculate the euclidean distance between interpolated values to get the overall PRCIS. My implementation in Python is written below: import numpy as np
from scipy.interpolate import CubicSpline
# Piecewise Root Cubic Interpolated Segments
def prcis_dist(ts1, ts2, num_segments):
# get segment lens from num of segments
seg_length = len(ts1) // num_segments
# Split time series into specified # of segments
seg1 = np.array_split(ts1, num_segments)
seg2 = np.array_split(ts2, num_segments)
# calculate euclidean distance between interpolated values
distance = 0.0
for i in range(num_segments):
# Apply cubic interpolation to approx values within each segment
spline1 = CubicSpline(np.arange(seg_length), seg1[i])
spline2 = CubicSpline(np.arange(seg_length), seg2[i])
ip_vals1 = spline1(np.linspace(0, seg_length - 1, len(seg1[i])))
ip_vals2 = spline2(np.linspace(0, seg_length - 1, len(seg2[i])))
seg_dist = np.linalg.norm(ip_vals1 - ip_vals2)
distance += seg_dist
return distance
ts1 = np.array([1, 2, 3, 4, 5, 6, 7, 8, 9, 10])
ts2 = np.array([2, 3, 4, 5, 6, 7, 8, 9, 10, 11])
num_segments = 5
distance = prcis_dist(ts1, ts2, num_segments)
print("PRCIS distance:", distance) Let me know what you think, I am still familiarizing myself with the concepts. |
@kennethZhangML Thank you for your interest. So, for issues labeled as "Notebook Reproducer", the goal is to create a throwaway Jupyter notebook that attempts to reproduce the exact process outlined in the paper in order to assess the quality and, more importantly, the feasibility of the published approach (this may involve porting over any Matlab code, downloading their datasets, recreating one or more of the figures from the paper). It is fine if the paper (which I have yet to read) employs spline interpolation but the goal is not to be novel or to deviate from the paper. Instead, we must try to reproduce their process as faithfully as possible as the goal is to prove to ourselves that the published concept actually works and then we can debate whether or not it is worth adding to the STUMPY codebase (there are often many reasons not to). Please let me know if that makes sense or if you have any further questions. We are here to help. |
See this paper
The text was updated successfully, but these errors were encountered: