File tree Expand file tree Collapse file tree 3 files changed +24
-2
lines changed
Expand file tree Collapse file tree 3 files changed +24
-2
lines changed Original file line number Diff line number Diff line change @@ -933,7 +933,7 @@ def __init__(
933933 # Make the meridian object ready for methods in this analyzer that create
934934 # backend.function computation graphs: it should be frozen for no more
935935 # internal states mutation before those graphs execute.
936- self .model_context = _get_model_context (meridian , model_context )
936+ self ._model_context = _get_model_context (meridian , model_context )
937937
938938 if meridian is not None :
939939 self ._inference_data = inference_data or meridian .inference_data
@@ -945,7 +945,11 @@ def __init__(
945945 else :
946946 self ._inference_data = inference_data
947947
948- self .model_context .populate_cached_properties ()
948+ self ._model_context .populate_cached_properties ()
949+
950+ @property
951+ def model_context (self ) -> context .ModelContext :
952+ return self ._model_context
949953
950954 @functools .cached_property
951955 def _model_equations (self ) -> equations .ModelEquations :
Original file line number Diff line number Diff line change @@ -1324,6 +1324,16 @@ def setUpClass(cls):
13241324 inference_data = cls .inference_data ,
13251325 )
13261326
1327+ def test_init_populates_cached_properties (self ):
1328+ with mock .patch .object (
1329+ context .ModelContext , "populate_cached_properties"
1330+ ) as mock_populate :
1331+ analyzer .Analyzer (
1332+ model_context = self .meridian .model_context ,
1333+ inference_data = self .inference_data ,
1334+ )
1335+ mock_populate .assert_called_once ()
1336+
13271337 def test_use_kpi_direct_calls_non_revenue_with_revenue_per_kpi (self ):
13281338 # `use_kpi` is respected
13291339 with warnings .catch_warnings (record = True ) as w :
Original file line number Diff line number Diff line change 324324 ' positive correlation with population. If there is low or negative'
325325 ' correlation, please check your data input.'
326326)
327+ PRIOR_PROBABILITY_INFO = (
328+ 'Negative baseline is equivalent to the treatment effects getting too much'
329+ ' credit. Please review the prior probability of negative baseline together'
330+ ' with the channel-level prior mean of contribution. If the prior'
331+ ' probability of negative baseline is high, consider custom treatment'
332+ ' priors. In particular, a custom `contribution prior` type may be'
333+ ' appropriate.'
334+ )
327335PRIOR_PROBABILITY_REPORT_INFO = (
328336 'Negative baseline is equivalent to the treatment effects getting too much'
329337 ' credit. Please review the prior probability of negative baseline together'
You can’t perform that action at this time.
0 commit comments