@@ -23,7 +23,7 @@ def state() -> workflow.State:
2323def test_interaction_sample_ignores_stable_positions_without_global_eet (
2424 state , monkeypatch
2525):
26- # Do not support stable alt positions or tracking total alts when running with MC sampling
26+ # Do not support stable alt positions or tracking total alts when running with inverse-CDF sampling
2727 # to not introduce any additional changes while adding eet simulation support to ensure no
2828 # regressions. We can add these features later if desired.
2929 captured = {}
@@ -139,7 +139,7 @@ def test_interaction_sample_parity(state):
139139 index = pd .Index (["chooser_attr * alt_attr" ], name = "Expression" ),
140140 )
141141
142- # Run Monte Carlo with replacement.
142+ # Run inverse-CDF sampling with replacement.
143143 state .settings .use_explicit_error_terms = False
144144 state .rng ().set_base_seed (42 )
145145 state .rng ().add_channel ("person_id" , choosers )
@@ -198,14 +198,14 @@ def test_interaction_sample_parity(state):
198198 assert choices_eet ["alt_id" ].isin (alternatives .index ).all ()
199199
200200 shares = {
201- "monte_carlo " : _weighted_shares (choices_mnl ),
201+ "inverse_cdf " : _weighted_shares (choices_mnl ),
202202 "poisson" : _weighted_shares (choices_poisson ),
203203 "eet" : _weighted_shares (choices_eet ),
204204 }
205205
206206 for left , right in [
207- ("monte_carlo " , "poisson" ),
208- ("monte_carlo " , "eet" ),
207+ ("inverse_cdf " , "poisson" ),
208+ ("inverse_cdf " , "eet" ),
209209 ("poisson" , "eet" ),
210210 ]:
211211 all_alts = set (shares [left ].index ) | set (shares [right ].index )
@@ -428,7 +428,7 @@ def _shares_for_sample(
428428 return choices , _weighted_shares (choices )
429429
430430
431- def test_interaction_sample_eet_sampling_under_mc_simulation (state ):
431+ def test_interaction_sample_eet_sampling_under_inverse_cdf_simulation (state ):
432432 # use_eet=False + sample_method="eet" was silently ignored before the
433433 # sampling/simulation decoupling. The dispatch now keys on sampling_method
434434 # only, so this combo must produce shares that match use_eet=True + eet.
@@ -483,9 +483,9 @@ def test_interaction_sample_eet_sampling_under_mc_simulation(state):
483483 )
484484
485485
486- def test_interaction_sample_poisson_sampling_under_mc_simulation (state ):
487- # use_eet=False + sample_method="poisson" used to silently fall through to MC
488- # sampling and then have pick_count forced to 1, corrupting results. After
486+ def test_interaction_sample_poisson_sampling_under_inverse_cdf_simulation (state ):
487+ # use_eet=False + sample_method="poisson" used to silently fall through to
488+ # inverse-CDF sampling and then have pick_count forced to 1, corrupting results. After
489489 # decoupling, the combo must run the Poisson path and match use_eet=True + poisson.
490490 num_choosers = 100_000
491491 num_alts = 100
@@ -530,7 +530,7 @@ def test_interaction_sample_poisson_sampling_under_mc_simulation(state):
530530
531531 # Poisson contract: pick_count must be uniformly 1
532532 assert (choices_mc_sim ["pick_count" ] == 1 ).all (), (
533- "Poisson sampling under MC simulation must produce pick_count=1; got "
533+ "Poisson sampling under inverse-CDF simulation must produce pick_count=1; got "
534534 f"{ choices_mc_sim ['pick_count' ].value_counts ().to_dict ()} "
535535 )
536536
@@ -544,7 +544,7 @@ def test_interaction_sample_poisson_sampling_under_mc_simulation(state):
544544 )
545545
546546
547- def test_interaction_sample_mc_sampling_under_eet_simulation (state ):
547+ def test_interaction_sample_inverse_cdf_sampling_under_eet_simulation (state ):
548548 num_choosers = 100_000
549549 num_alts = 100
550550 sample_size = 10
@@ -570,7 +570,7 @@ def test_interaction_sample_mc_sampling_under_eet_simulation(state):
570570 spec ,
571571 sample_size ,
572572 use_eet = False ,
573- sample_method = "monte_carlo " ,
573+ sample_method = "inverse_cdf " ,
574574 seed = 42 ,
575575 step_name = "test_mc_under_mc_sim" ,
576576 )
@@ -581,7 +581,7 @@ def test_interaction_sample_mc_sampling_under_eet_simulation(state):
581581 spec ,
582582 sample_size ,
583583 use_eet = True ,
584- sample_method = "monte_carlo " ,
584+ sample_method = "inverse_cdf " ,
585585 seed = 42 ,
586586 step_name = "test_mc_under_eet_sim" ,
587587 )
@@ -590,7 +590,7 @@ def test_interaction_sample_mc_sampling_under_eet_simulation(state):
590590 for alt in all_alts :
591591 diff = abs (shares_mc_sim .get (alt , 0.0 ) - shares_eet_sim .get (alt , 0.0 ))
592592 assert diff < 0.01 , (
593- f"MC sampling shares should not depend on simulation mode at alt { alt } : "
593+ f"Inverse-CDF sampling shares should not depend on simulation mode at alt { alt } : "
594594 f"mc_sim={ shares_mc_sim .get (alt , 0.0 ):.4f} , "
595595 f"eet_sim={ shares_eet_sim .get (alt , 0.0 ):.4f} , diff={ diff :.4f} "
596596 )
0 commit comments