Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ To release a new version (e.g. from `1.0.0` -> `2.0.0`):

## [Unreleased]

* Add model fitting guardrail using EDA to `Meridian`.
* Introduce serde package: a serialization and deserialization library for
Meridian model with a protocol buffer schema.
* Add model quality checks in the `analysis.review` module.
Expand Down
70 changes: 37 additions & 33 deletions meridian/analysis/optimizer_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,43 @@ def _get_sample_optimized_data(is_revenue_kpi: bool = True) -> xr.Dataset:


class OptimizerAlgorithmTest(parameterized.TestCase):

@classmethod
def setUpClass(cls):
super().setUpClass()
cls.inference_data_media_and_rf = az.InferenceData(
prior=xr.open_dataset(
os.path.join(_TEST_DATA_DIR, 'sample_prior_media_and_rf.nc')
),
posterior=xr.open_dataset(
os.path.join(_TEST_DATA_DIR, 'sample_posterior_media_and_rf.nc')
),
)
cls.inference_data_media_only = az.InferenceData(
prior=xr.open_dataset(
os.path.join(_TEST_DATA_DIR, 'sample_prior_media_only.nc')
),
posterior=xr.open_dataset(
os.path.join(_TEST_DATA_DIR, 'sample_posterior_media_only.nc')
),
)
cls.inference_data_rf_only = az.InferenceData(
prior=xr.open_dataset(
os.path.join(_TEST_DATA_DIR, 'sample_prior_rf_only.nc')
),
posterior=xr.open_dataset(
os.path.join(_TEST_DATA_DIR, 'sample_posterior_rf_only.nc')
),
)
cls.inference_data_all_channels = az.InferenceData(
prior=xr.open_dataset(
os.path.join(_TEST_DATA_DIR, 'sample_prior_non_paid.nc')
),
posterior=xr.open_dataset(
os.path.join(_TEST_DATA_DIR, 'sample_posterior_non_paid.nc')
),
)

# TODO: Update the sample datasets to span over 1 year.
def setUp(self):
super(OptimizerAlgorithmTest, self).setUp()
Expand Down Expand Up @@ -331,39 +368,6 @@ def setUp(self):
)
)

self.inference_data_media_and_rf = az.InferenceData(
prior=xr.open_dataset(
os.path.join(_TEST_DATA_DIR, 'sample_prior_media_and_rf.nc')
),
posterior=xr.open_dataset(
os.path.join(_TEST_DATA_DIR, 'sample_posterior_media_and_rf.nc')
),
)
self.inference_data_media_only = az.InferenceData(
prior=xr.open_dataset(
os.path.join(_TEST_DATA_DIR, 'sample_prior_media_only.nc')
),
posterior=xr.open_dataset(
os.path.join(_TEST_DATA_DIR, 'sample_posterior_media_only.nc')
),
)
self.inference_data_rf_only = az.InferenceData(
prior=xr.open_dataset(
os.path.join(_TEST_DATA_DIR, 'sample_prior_rf_only.nc')
),
posterior=xr.open_dataset(
os.path.join(_TEST_DATA_DIR, 'sample_posterior_rf_only.nc')
),
)
self.inference_data_all_channels = az.InferenceData(
prior=xr.open_dataset(
os.path.join(_TEST_DATA_DIR, 'sample_prior_non_paid.nc')
),
posterior=xr.open_dataset(
os.path.join(_TEST_DATA_DIR, 'sample_posterior_non_paid.nc')
),
)

self.meridian_media_and_rf = model.Meridian(
input_data=self.input_data_media_and_rf
)
Expand Down
Loading
Loading