def test_multivariate(self): n = 2 values1 = np.repeat(self.series1.univariate_values(), n) values2 = np.repeat(self.series2.univariate_values(), n) values1 = values1.reshape((-1, n)) values2 = values2.reshape((-1, n)) multi_series1 = TimeSeries.from_values(values1) multi_series2 = TimeSeries.from_values(values2) radius = 2 alignment_uni = dtw.dtw(self.series1, self.series2, multi_grid_radius=radius) alignment_multi = dtw.dtw(multi_series1, multi_series2, multi_grid_radius=radius) self.assertTrue(np.all(alignment_uni.path() == alignment_multi.path()))
def _series_from_values(values): return TimeSeries.from_values( np.array(values) if isinstance(values, list) else values)