def test_deseasonalised_values(sp): transformer = Deseasonalizer(sp=sp) transformer.fit(y_train) actual = transformer.transform(y_train) r = seasonal_decompose(y_train, period=sp) expected = y_train - r.seasonal np.testing.assert_array_equal(actual, expected)
def test_transform_inverse_transform_equivalence(sp, model): transformer = Deseasonalizer(sp=sp, model=model) transformer.fit(y_train) yit = transformer.inverse_transform(transformer.transform(y_train)) np.testing.assert_array_equal(y_train.index, yit.index) np.testing.assert_array_almost_equal(y_train, yit)
def test_inverse_transform_time_index(sp, model): transformer = Deseasonalizer(sp=sp, model=model) transformer.fit(y_train) yit = transformer.inverse_transform(y_test) np.testing.assert_array_equal(yit.index, y_test.index)