[0.2.dev8] Fully enable "backdoor" MergedChoiceTable functionality for Segmented Large MNL #118
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.
As the title states, these changes are meant to enable the user to pass in their own MergedChoiceTable object to use for estimating a segmented large-n multinomial logit in choicemodels. The primary use case is for including interaction terms in a model specification (e.g. individual chooser-alternative distances in a location choice model).
The most questionable change I've made is probably in how the
LargeMultinomialLogit
model handles an mct object passed in to itsfit()
method. What I've had to do here is to convert the mct to a dataframe, apply the chooser filters to that df, and then re-cast to an mct object per the new functionality in the PR here. This was the simplest solution I could come up with to the problem of segment-based filtering on a user-constructed MergedChoiceTable object. The alternative would have been to do that filtering in the segmented MNL class. Happy to go that route if you prefer.Let me know what you think.
In any event, we'll want to merge the PR in choicemodels before merging this one.