Skip to content
Open
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
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