def test_actual_results_dtw_sakoechiba(params, res_desired): """Test that the actual results are the expected ones.""" (dtw_actual, cost_mat_actual, acc_cost_mat_actual, path_actual) = dtw_sakoechiba(x, y, **params_return, **params) np.testing.assert_allclose(cost_mat_actual, res_desired['cost_mat']) np.testing.assert_allclose(dtw_actual, res_desired['dtw']) np.testing.assert_allclose(path_actual, res_desired['path']) np.testing.assert_allclose(acc_cost_mat_actual, res_desired['acc_cost_mat'])
'params, err_msg', [({'method': 'loop'}, "'method' must be either 'classic', 'sakoechiba', 'itakura', " "'multiscale' or 'fast'.")] ) def test_parameter_check_dtw(params, err_msg): """Test parameter validation.""" with pytest.raises(ValueError, match=re.escape(err_msg)): dtw(x, y, **params) @pytest.mark.parametrize( 'params, res_desired', [({}, dtw_classic(x, y, **params_return)), ({'method': 'sakoechiba'}, dtw_sakoechiba(x, y, **params_return)), ({'method': 'sakoechiba', 'options': {'window_size': 0.5}}, dtw_sakoechiba(x, y, **params_return)), ({'method': 'itakura'}, dtw_itakura(x, y, **params_return)), ({'method': 'itakura', 'options': {'max_slope': 8}}, dtw_itakura(x, y, max_slope=8, **params_return)), ({'method': 'multiscale'}, dtw_multiscale(x, y, **params_return)), ({'method': 'multiscale', 'options': {'resolution': 1}}, dtw_multiscale(x, y, resolution=1, **params_return)), ({'method': 'multiscale', 'options': {'radius': 2}},
@pytest.mark.parametrize('params, err_msg', [({ 'method': 'loop' }, "'method' must be either 'classic', 'sakoechiba', 'itakura', " "'multiscale' or 'fast'.")]) def test_parameter_check_dtw(params, err_msg): """Test parameter validation.""" with pytest.raises(ValueError, match=re.escape(err_msg)): dtw(x, y, **params) @pytest.mark.parametrize( 'params, res_desired', [({}, dtw_classic(x, y, **params_return)), ({ 'method': 'sakoechiba' }, dtw_sakoechiba(x, y, **params_return)), ({ 'method': 'sakoechiba', 'options': { 'window_size': 2 } }, dtw_sakoechiba(x, y, window_size=2, **params_return)), ({ 'method': 'itakura' }, dtw_itakura(x, y, **params_return)), ({ 'method': 'itakura', 'options': { 'max_slope': 8 } }, dtw_itakura(x, y, max_slope=8, **params_return)),
@pytest.mark.parametrize('params, err_msg', [({ 'method': 'loop' }, "'method' must be either 'classic', 'sakoechiba', 'itakura', " "'multiscale' or 'fast'.")]) def test_parameter_check_dtw(params, err_msg): """Test parameter validation.""" with pytest.raises(ValueError, match=re.escape(err_msg)): dtw(x, y, **params) @pytest.mark.parametrize( 'params, res_desired', [({}, dtw_classic(x, y, **params_return)), ({ 'method': 'sakoechiba' }, dtw_sakoechiba(x, y, **params_return)), ({ 'method': 'sakoechiba', 'options': { 'window_size': 0.5 } }, dtw_sakoechiba(x, y, **params_return)), ({ 'method': 'itakura' }, dtw_itakura(x, y, **params_return)), ({ 'method': 'itakura', 'options': { 'max_slope': 8 } }, dtw_itakura(x, y, max_slope=8, **params_return)),