Trip Purpose#

For trip other than the last trip outbound or inbound, assign a purpose based on an observed frequency distribution. The distribution is segmented by tour purpose, tour direction and person type. Work tours are also segmented by departure or arrival time period.

The main interface to the trip purpose model is the trip_purpose function. This function is registered as an Inject step in the example Pipeline.

Structure#

  • Core Table: trips

  • Result Field: purpose

Configuration#

Note#

Trip purpose and trip destination choice can be run iteratively together trip_purpose_and_destination_model

Examples#

Implementation#

activitysim.abm.models.trip_purpose.trip_purpose(state: State, trips: DataFrame) None#

trip purpose model step - calls run_trip_purpose to run the actual model

adds purpose column to trips

activitysim.abm.models.trip_purpose.choose_intermediate_trip_purpose(state: State, trips, probs_spec, estimator, probs_join_cols, use_depart_time, trace_hh_id, trace_label, *, chunk_sizer: ChunkSizer)#

chose purpose for intermediate trips based on probs_spec which assigns relative weights (summing to 1) to the possible purpose choices

Returns:
purpose: pandas.Series of purpose (str) indexed by trip_id
activitysim.abm.models.trip_purpose.run_trip_purpose(state: State, trips_df: DataFrame, estimator, model_settings: Optional[TripPurposeSettings] = None, model_settings_file_name: str = 'trip_purpose.yaml', trace_label: str = 'trip_purpose')#

trip purpose - main functionality separated from model step so it can be called iteratively

For each intermediate stop on a tour (i.e. trip other than the last trip outbound or inbound) each trip is assigned a purpose based on an observed frequency distribution

The distribution should always be segmented by tour purpose and tour direction. By default it is also segmented by person type. The join columns can be overwritten using the “probs_join_cols” parameter in the model settings. The model will attempt to segment by trip depart time as well if necessary and depart time ranges are specified in the probability lookup table.

Returns:
purpose: pandas.Series of purpose (str) indexed by trip_id