activitysim
activitysim copied to clipboard
Preprocessing & Annotation functionality
This pull request standardizes preprocessing and annotation capabilities across all activitysim abm models.
Refactoring of Preprocessing and Table Annotation
-
Standardized Preprocessing:
- Replaced custom preprocessing logic using
expressions.assign_columnswithexpressions.annotate_preprocessorsin models such asauto_ownership,free_parking, andjoint_tour_composition. This change ensures consistency across models and reduces duplication. [1] [2] [3]
- Replaced custom preprocessing logic using
-
Unified Table Annotation:
- Replaced individual table annotation logic with
expressions.annotate_tablesin models likeatwork_subtour_destination,cdap, andjoint_tour_frequency. This provides a consistent and reusable approach for post-model table updates. [1] [2] [3]
- Replaced individual table annotation logic with
Simplification of Model Settings
-
Removal of Unused Fields:
- Removed unnecessary fields like
preprocessorandannotate_*from model settings classes such asAtworkSubtourFrequencySettings,AutoOwnershipSettings, andFreeParkingSettings. This cleanup eliminates unused or redundant configuration options. [1] [2] [3]
- Removed unnecessary fields like
-
Reorganization in
cdap:- Consolidated preprocessor and annotation settings into a single unified structure for better clarity and alignment with other models.
Summary table of model changes:
| Model name | Choosers Preprocessor | Alts Preprocessor | Annotator | Notes |
|---|---|---|---|---|
| accessibility | existed | N/A | N/A | model is essentially a preprocessor |
| atwork_subtour_destination | added | added | added | added preprocessing in both sample and simulate step in util.tour_destination.py |
| atwork_subtour_frequency | updated | N/A | added | |
| atwork_subtour_mode_choice | updated | N/A | added | |
| atwork_subtour_scheduling | added | existed | added | ALTS_PREPROCESSOR segmented by tour purpose, added in util.vectorize_tour_scheduling.py |
| auto_ownership | updated | N/A | added | |
| cdap | added | N/A | updated | |
| disaggregate_accessibility | existed | N/A | existed | now can use alts preprocessors in logsum calculations through tour and location choice models |
| free_parking | updated | N/A | updated | |
| initialize | N/A | N/A | updated | Model is annotator |
| initialize_los | N/A | N/A | N/A | |
| initialize_tours | N/A | N/A | updated | Model is annotator |
| input_checker | N/A | N/A | N/A | |
| joint_tour_composition | updated | N/A | updated | |
| joint_tour_destination | added | added | added | added preprocessing in both sample and simulate step in util.tour_destination.py |
| joint_tour_frequency | updated | N/A | added | |
| joint_tour_frequency_composition | updated | updated | updated | |
| joint_tour_participation | updated | N/A | added | |
| joint_tour_scheduling | updated | added | updated | ALTS_PREPROCESSOR segmented by tour purpose, added in util.vectorize_tour_scheduling.py |
| location_choice | added | added | updated | added preprocessing in both sample and simulate step |
| mandatory_scheduling | added | existed | added | ALTS_PREPROCESSOR segmented by tour purpose, added in util.vectorize_tour_scheduling.py |
| mandatory_tour_frequency | updated | N/A | added | |
| non_mandatory_destination | added | added | added | added preprocessing in both sample and simulate step in util.tour_destination.py |
| non_mandatory_scheduling | added | added | added | ALTS_PREPROCESSOR segmented by tour purpose, added in util.vectorize_tour_scheduling.py |
| non_mandatory_tour_frequency | updated | added | added | |
| parking_location_choice | updated | added | added | |
| school_escorting | existed | added | added | uniquely has 3 preprocessors |
| stop_frequency | updated | N/A | added | |
| summarize | N/A | N/A | existed | Model is annotator |
| telecommute_frequency | updated | N/A | added | |
| tour_mode_choice | updated | N/A | added | |
| tour_od_choice | updated | added | added | added preprocessing in both sample and simulate step |
| tour_scheduling_probabilistic | N/A | N/A | added | |
| transit_pass_ownership | updated | N/A | added | |
| transit_pass_subsidy | updated | N/A | added | |
| trip_departure_choice | existed | added | added | |
| trip_destination | updated | updated | added | added preprocessing in both sample and simulate step |
| trip_matrices | existed | N/A | N/A | |
| trip_mode_choice | existed | N/A | updated | |
| trip_purpose | updated | N/A | added | |
| trip_purpose_and_destination | N/A | N/A | added | |
| trip_scheduling | updated | N/A | added | is probabilistic model |
| trip_scheduling_choice | updated | added | added | |
| vehicle_allocation | updated | N/A | added | |
| vehicle_type_choice | updated | updated | updated | |
| work_from_home | updated | N/A | updated |