Skip to content
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

small bug fix for large mnl simulation re: specification of interaction terms #109

Open
wants to merge 2 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ pandas >= 0.22
patsy >= 0.4
statsmodels >= 0.8
urbansim >= 3.1
scipy < 1.3
6 changes: 5 additions & 1 deletion urbansim_templates/models/large_multinomial_logit.py
Original file line number Diff line number Diff line change
Expand Up @@ -536,7 +536,11 @@ def run(self, chooser_batch_size=None, interaction_terms=None):
self.choices = None

if interaction_terms is not None:
uniq_intx_idx_names = set([idx for intx in interaction_terms for idx in intx.index.names])
if type(interaction_terms) == list:
uniq_intx_idx_names = set([
idx for intx in interaction_terms for idx in intx.index.names])
else:
uniq_intx_idx_names = interaction_terms.index.names
obs_extra_cols = to_list(self.chooser_size) + list(uniq_intx_idx_names)
alts_extra_cols = to_list(self.alt_capacity) + list(uniq_intx_idx_names)

Expand Down