diff --git a/tests/test_cmp.py b/tests/test_cmp.py index 18c0c38..f77b5a0 100644 --- a/tests/test_cmp.py +++ b/tests/test_cmp.py @@ -152,4 +152,5 @@ def test_seasonality_cmp_sampling(N: int = 200, off_param=1): check_metrics_for_sampling(trace_, simulation) betas_np = np.concatenate([betas_intercept, betas_hour, betas_week]) beta_pred = trace_.posterior["beta_s"].values[0].mean(0) - assert np.allclose(beta_pred, betas_np) + beta_mape = abs(beta_pred - betas_np) / betas_np + assert beta_mape.mean() < 0.2 diff --git a/tests/test_sampling_seasonality.py b/tests/test_sampling_seasonality.py index d9d99b9..f9909a2 100644 --- a/tests/test_sampling_seasonality.py +++ b/tests/test_sampling_seasonality.py @@ -82,4 +82,9 @@ def test_seasonality_sampling(N: int = 200, off_param=1): check_metrics_for_sampling(trace_, simulation) betas_np = np.concatenate([betas_intercept, betas_hour, betas_week]) beta_pred = trace_.posterior["beta_s"].values[0].mean(0) - assert np.allclose(beta_pred, betas_np) + beta_mape = abs(beta_pred - betas_np) / betas_np + assert beta_mape.mean() < 0.1 + + +#%% +test_seasonality_sampling() diff --git a/tests/test_ztp.py b/tests/test_ztp.py index 50745f3..63f23e4 100644 --- a/tests/test_ztp.py +++ b/tests/test_ztp.py @@ -132,4 +132,5 @@ def test_seasonality_ztp_sampling(N: int = 200, off_param=1): check_metrics_for_sampling(trace_, simulation) betas_np = np.concatenate([betas_intercept, betas_hour, betas_week]) beta_pred = trace_.posterior["beta_s"].values[0].mean(0) - assert np.allclose(beta_pred, betas_np) + beta_mape = abs(beta_pred - betas_np) / betas_np + assert beta_mape.mean() < 0.1