Explicit error terms production code#1064
Conversation
…EET comparison tests
… are the same for eval_mnl and eval_nl
…ing cdap eet parity
… toy example and compares the result
Extend logit tests, add model tests, add simulate tests, draft docs
…with edge cases for small sample test. note this also happens for non-eet, e.g. with base seed 1
Poisson sampling, inconsistency fixes, eet runtime improvements, true nested logit eet
|
Regarding tests:
|
|
Inconsistencies fixes:
|
|
Regarding Poisson sampling and disaggregate accessibilities: For the MTC_extended and SANDAG models, we saw large differences (about 50%) when running with Poisson sampling compared to the other two methods. The other two methods agree. Disaggregate accessibilities are destination choice logsums, generated by sampling a subset of alternatives, and we traced the differences back to how the sampling correction factor is specified. The bottom line is that in the current specification Poisson is un-biased, whereas both MC and EET sampling are biased by log(sample_size). This is material (on the order of half the mean value) and leads to significant differences in downstream models that use disaggregate accessibilities, like auto_ownership and cdap in SANDAG. As mentioned in this week's meeting, we will present more details on this in the engineering meeting on 5/21. |
|
Regarding nested logit: The PoC implementation had a recursive structure, with choices made by walking down nests and choosing at each level. The use of logsums means that there were edge cases where unintuitive changes could happen (nest switching), and the recursive structure was slow. We replaced this with a method that draws nested logit error terms directly, solving both of these problems. |
This PR brings the explicit error term (EET) work to production standard. It contains the following major changes compared to the PoC implementation:
1. It adds testing and documentation for EET
2. It decouples the sampling method from the simulation method and adds Poisson sampling (based on @m-richards implementation in #1065), including tests and documentation. It also addresses runtime and memory issues with the sampling method "eet".
3. It removes several inconsistencies in the EET simulation branch where edge cases could have led to unexpected changes in choices for individual choosers due to non-alignment of error terms.
4. It consistently implements EET for nested logit models
Note that the default simulation method remains Monte Carlo, with all existing unit and integration tests unchanged and passing. Users should therefore not see any differences in their model runs unless explicitly opting in to EET. This is done by adding
use_explicit_error_terms: Trueto the settings. This is a drop-in replacement, with default settings leading to a 3-10% runtime increase of a single demand model run for the models we have tested so far.This is a large PR and I will add details in comments below so we can keep discussions focused.