-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Description
Describe the bug
- Additive noise in
simulate_media()can push CPC below zero;_negative_replace()then sets it to0, and the subsequentspend / noisy_cpcdivision producesinfinlifetime_clicks(and similarly for CPM/impressions). - The logger warns about negative CPC, but the data frame still contains
inf, which contaminates downstream ROI calculations.
To Reproduce
sim.simulate_media(
true_cpm={'Display': 5.0},
true_cpc={'Search': 0.5}, # Low CPC
noisy_cpm_cpc={
'Display': {'loc': 0, 'scale': 1.0},
'Search': {'loc': 0, 'scale': 0.2}, # scale/CPC = 40%
},
)
# Warning: "negative values... will be set to 0"
# Result: inf in lifetime_clicksWith true_cpc=0.5 and scale=0.2, approximately 48% of random seeds produce inf values.
Expected behavior
No inf values in lifetime_clicks/lifetime_impressions
Root Cause
In src/pysimmmulator/simulate.py the helper _negative_replace() replaces negative CPC/CPM with 0 (see ~L171–L183), and simulate_media() divides by that column (see ~L212–L228), yielding divide-by-zero.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels