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

[0.1.dev9] Backdoor to add weights and interaction terms for MNL estimation #30

Merged
merged 8 commits into from
Aug 30, 2018

Conversation

smmaurer
Copy link
Member

@smmaurer smmaurer commented Aug 27, 2018

This PR adds a backdoor to the LargeMultinomialLogitStep template so that users can pass their own MergedChoiceTable for model estimation.

The objective is to let people test out the new functionality in ChoiceModels PR #37 (sampling weights, interaction terms) before it's fully integrated into the templates.

Full integration will take a little while because we need to set up UrbanSim data structures and usage guidelines for 2d weights and interaction terms.

Usage

# create a MergedChoiceTable with complicated interaction and sampling
mct = choicemodels.tools.MergedChoiceTable(...)

# set up an MNL model step and give it a model expression (data tables not needed)
m = LargeMultinomialLogitStep()
m.model_expression = 'empl_density + distance_km - 1'

# pass the MergedChoiceTable directly to the fit() method
m.fit(mct)

See this notebook for a demonstration: Interaction-and-sampling-demo-v1.ipynb

Other changes

Separately, this PR also formalizes the utilities for version comparison that we use to make sure saved model steps are recent enough to be loaded into the current version of ModelManager.

These new utilities even have unit tests! 🎉

Versioning

  • library version and ModelManager version incremented to 0.1.dev9
  • LargeMultinomialLogitStep version incremented to 0.1.dev2

@smmaurer smmaurer merged commit 02ea377 into master Aug 30, 2018
@smmaurer smmaurer deleted the mct-backdoor branch August 30, 2018 21:44
@smmaurer smmaurer changed the title Backdoor to add weights and interaction terms for MNL estimation [0.1.dev9] Backdoor to add weights and interaction terms for MNL estimation Nov 9, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant