-
Notifications
You must be signed in to change notification settings - Fork 33
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.2.dev1] Better sampling support for MergedChoiceTable utility #37
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This was referenced Sep 7, 2018
smmaurer
changed the title
Better sampling support for MergedChoiceTable utility
[0.2.dev1] Better sampling support for MergedChoiceTable utility
Nov 10, 2018
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR adds substantial functionality to the MergedChoiceTable utility.
It's related to Issues #4, #5, and #11, and to UDST/urbansim_templates MNL support.
Features and usage
MergedChoiceTable now supports:
All this should work automatically in MNL models. Note that with non-random sampling of alternatives and small sample sizes, estimated coefficients can be biased unless a correction term is added (see issue #38).
The intention of this PR is to provide general-purpose functionality that can serve as a back end for more specialized tools that automate distance-based sampling, bands, buckets, etc.
I've also done groundwork for the following features that will come later:
Implementation
This required deep enough surgery that the easiest approach was to start fresh rather than drawing on existing code in
urbansim.urbanchoice
(which did not support weights, availability, non-replacement, or non-sampling use cases).I've done some basic optimization for things like choosing the most efficient underlying sampling library for each use case (mostly NumPy but sometimes core Python) and drawing single rather than repeated samples whenever possible.
Issue #39 discusses the current performance of the code, and optimizations we might want to look into.
Other changes
LargeMultinomialLogit
class now optionally accepts aMergedChoiceTable
as inputVersioning