[0.2.dev1] Fixes Small MNL simulation crash #96
Merged
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 fixes a problem in the Small MNL template that was causing crashes in the simulation stage. This was identified by @xyzjayne.
Problem
Small MNL model steps were crashing in the simulation stage if the output column didn't exist yet, or in certain cases when multiple tables were being assembled.
Causes
When data was being assembled for simulation, the older
TemplateStep._get_data()
method was requesting theout_column
because we used to update it locally before updating Orca (shared.py#L194). This caused errors when the column didn't exist yet.It was also requesting the
choice_column
even when simulating, because of a coding mistake involving the special case of PyLogit model expressions (shared.py#L179), which i think was contributing to some of the crashes.Solution
I updated the Small MNL template to use the new, cleaner
utils.get_data()
function for both estimation and simulation.Testing
I replicated the crash in a unit test, and the changes resolve it. @xyzjayne reports that this branch fixes the crashes she was seeing as well.
Versioning
This PR increments the master branch to 0.2.dev1.
This seems like a pretty important bug fix, so i'm also going to apply these changes to the most recent production version and release it as v0.1.2 on pip and conda. (It will be at least a few weeks before v0.2 is ready for release.)
Before merging