Sampling Methods#
ActivitySim supports multiple sampling methods for activitysim.core.interaction_sample.
These methods affect how sampled choice sets are constructed for models such as destination
and location choice.
Available methods are:
inverse_cdf: importance sampling with replacement using probabilities and uniform drawseet: importance sampling with replacement using explicit error-term drawspoisson: independent Poisson inclusion sampling using probabilities
Default behavior depends on the global simulation method setting:
if
use_explicit_error_terms: False, the default sampling method isinverse_cdfif
use_explicit_error_terms: True, the default sampling method ispoisson
However, any method can be used with either simulation method and can be set globally in the settings:
sample_method: "poisson"
To override the default for a particular model, set the component’s compute settings:
compute_settings:
sample_method: eet
This override applies only to interaction_sample. It does not change how final choices
are simulated elsewhere in ActivitySim.
Practical differences:
inverse_cdfandeetboth sample with replacement, so duplicated sampled alternatives are possible and their aggregate sampled shares track repeated-draw MNL behavior more closely.poissonsamples alternatives by inclusion probability, so each sampled alternative appears at most once per chooser. This can change raw sampled shares in highly peaked cases, even though the downstream sampling correction remains well defined.inverse_cdfis the fastest method, followed bypoisson, witheetbeing the slowest. However, for models like location choice, most runtime comes from logsum calculations and the total difference betweeninverse_cdfandpoissonsampling is usually very small.poissonis the current default when running with simulation method explicit error terms because it avoids repeated chooser-by-alternative explicit-error draws during sampling while still providing improved noise reduction compared to inverse-CDF sampling.
For implementation details and runtime considerations, see Sampling Methods for Interaction Sample.