-
Notifications
You must be signed in to change notification settings - Fork 100
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Revisit Trip Destination Alternatives Preprocessor #868
Comments
I think the issue is that the original expression itself was not correct. The original implementation found the max MicroAccessTime by TAZ and then reindexed on the alternatives. However, the groupby in the original expression set the index as TAZ where as the alternatives had a destination index of maz. (This was confusing in the original spec because the trip destination option I do not see any reason why we need to actually do the aggregation to TAZ. We can just join directly by MAZ, which is indeed what is done for the origin MicroAccessTime. (I imagine it was implemented like this in the first place due to the above stated I have updated the PR into the sandag abm3 model with corrections to these config files: ActivitySim/sandag-abm3-example@048f8d9. This will change the results slightly because of the fixed expression. Also, upon further inspection, I do not see any reason why we would want to keep the size term columns in the alternatives table. I have reverted that change, as seen here dhensle@17826ed and opened #869. |
I think this is trickier than it at first appears. The original For sampling with presampling, the MAZ alternatives get aggregated to TAZs here: activitysim/activitysim/abm/models/trip_destination.py Lines 559 to 563 in 1cb48c7
... which as noted happens after the alternatives preprocessor. This is how we're getting nonconforming As the comment in the code says, there is (or, was) no data in the thing getting rolled up, just the indexes. But now there is. If there's no data, it doesn't matter what kind of aggregation is done, whomever wrote this line many years ago just put "sum" and it was fine. But now that there may be data appearing, we will need to have some mechanism to allow the user to identify what kind of aggregation to use for each relevant variable (e.g. sum, min, max, etc). At this point, it might be worth reconsidering #862, which is much more limited in functionality than this PR, but does automatically switch between |
Ahh, I see. I missed the aggregation, as you point out. I think the simple fix here is to just have separate preprocessors for the sample part and the simulate part. I have pushed updates to this effect to both ActivitySim/sandag-abm3-example#13 and #869 Let me know what you think. |
Describe the bug
The alternatives pre-processor in #865 is not working correctly. It looks like presampling is aggregating the values as if they are a size term.
To Reproduce
test_sandag_abm3_progressive
,trace_hh_id=785431
,trace/trip_destination/trip_num_1/othdiscr/sample/presample/interaction_sample/alternative-*.csv
Expected behavior
d_microAccTime should take on value of only 0, 5, or 999. But it is getting values that are sometimes a combination of these (e.g. 2997, 2003, 1009, etc).
The text was updated successfully, but these errors were encountered: