Skip to content

Commit

Permalink
Alt name for jtfc estimation mode (#771)
Browse files Browse the repository at this point in the history
  • Loading branch information
dhensle authored Mar 28, 2024
1 parent 27d5b36 commit 1453d87
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions activitysim/abm/models/joint_tour_frequency_composition.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,11 @@ def joint_tour_frequency_composition(
model_settings_file_name,
)

# FIXME setting index as "alt" causes crash in estimation mode...
alts = simulate.read_model_alts(
state, "joint_tour_frequency_composition_alternatives.csv", set_index="alt"
state, "joint_tour_frequency_composition_alternatives.csv", set_index=None
)
alts.index = alts["alt"].values

# - only interested in households with more than one cdap travel_active person and
# - at least one non-preschooler
Expand Down Expand Up @@ -116,14 +118,16 @@ def joint_tour_frequency_composition(
estimator.write_model_settings(model_settings, model_settings_file_name)
estimator.write_coefficients(coefficients_df, model_settings)
estimator.write_choosers(choosers)
estimator.write_alternatives(alts)

assert choosers.index.name == "household_id"
assert "household_id" not in choosers.columns
choosers["household_id"] = choosers.index

estimator.set_chooser_id(choosers.index.name)

# FIXME set_alt_id - do we need this for interaction_simulate estimation bundle tables?
estimator.set_alt_id("alt_id")

# The choice value 'joint_tour_frequency_composition' assigned by interaction_simulate
# is the index value of the chosen alternative in the alternatives table.
choices = interaction_simulate(
Expand Down Expand Up @@ -157,6 +161,7 @@ def joint_tour_frequency_composition(
# - but we don't know the tour participants yet
# - so we arbitrarily choose the first person in the household
# - to be point person for the purpose of generating an index and setting origin
# FIXME: not all models are guaranteed to have PNUM
temp_point_persons = persons.loc[persons.PNUM == 1]
temp_point_persons["person_id"] = temp_point_persons.index
temp_point_persons = temp_point_persons.set_index("household_id")
Expand Down

0 comments on commit 1453d87

Please sign in to comment.