def distance_1d_sax(self, sax1, sax2): """Compute distance between 1d-SAX representations as defined in [1]_. Parameters ---------- sax1 : array-like 1d-SAX representation of a time series sax2 : array-like 1d-SAX representation of another time series Returns ------- float 1d-SAX distance Notes ----- Unlike SAX distance, 1d-SAX distance does not lower bound Euclidean distance between original time series. References ---------- .. [1] S. Malinowski, T. Guyet, R. Quiniou, R. Tavenard. 1d-SAX: a Novel Symbolic Representation for Time Series. IDA 2013. """ if not self._is_fitted(): raise NotFittedError("Model not fitted yet: cannot be used for " + "distance computation.") else: return cydist_1d_sax(sax1, sax2, self.breakpoints_avg_middle_, self.breakpoints_slope_middle_, self.size_fitted_)
def distance_1d_sax(self, sax1, sax2): """Compute distance between 1d-SAX representations as defined in [1]_. Parameters ---------- sax1 : array-like 1d-SAX representation of a time series sax2 : array-like 1d-SAX representation of another time series Returns ------- float 1d-SAX distance Notes ----- Unlike SAX distance, 1d-SAX distance does not lower bound Euclidean distance between original time series. References ---------- .. [1] S. Malinowski, T. Guyet, R. Quiniou, R. Tavenard. 1d-SAX: a Novel Symbolic Representation for Time Series. IDA 2013. """ self._is_fitted() return cydist_1d_sax(sax1, sax2, self.breakpoints_avg_middle_, self.breakpoints_slope_middle_, self._X_fit_dims_[1])