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.dev24] Integrating changes from models in production #79

Merged
merged 17 commits into from
Dec 20, 2018

Conversation

smmaurer
Copy link
Member

@smmaurer smmaurer commented Dec 14, 2018

This PR implements clean, systematic versions of changes from the ej-test branch that's being used for various models in production. Issue #75 discusses that branch in more depth.

Also implements some ancillary improvements: adds a change log, moves the tests, etc.

1. Fixes a string comparison bug

Code like string is 'value' mostly works for string comparison, but not always. If the strings contain the same characters but were created in different ways, it can fail. Maybe encoding plays a role too? This caused a bug in the binary logit template where an out_value_false setting of 'nothing' was not being read correctly from YAML in Windows. Using string == 'value' fixes this.

This is fixed in binary logit and in a couple of other places where a similar comparison was being used for ModelManager's saving/reloading of PyLogit pickle files.

2. Adds model object as an attribute of large MNL model steps

It's available as m.model any time after model step m is fitted, including after it's reloaded from storage. This provides a choicemodels.MultinomialLogitResults object, which you can use for things like getting diagnostic choice probabilities outside of the usual simulation flow.

3. Improves the documentation of large MNL class attributes

These are now documented in a single place. Also tweaked the attribute availability a bit to make it more consistent. (MergedChoiceTable now available after a model is run, unless the choices have capacity constraints.)

4. Enables on-the-fly creation of output columns

Adds general functionality for this as utils.update_column(), but for now only large MNL uses it. Other templates are left as-is pending a bigger update.

5. Fixes a simulation bug when there are no valid choosers

If large MNL finds no valid choosers or no valid alternatives after applying filters, the model step will now print a message and exit.

6. Adds more unit tests

Adds or improves unit tests for all of the above.

7. Adds a change log

CHANGELOG.md.

8. Moves tests out of the module directory

Moves tests to the root directory, which is more standard and seems to fix some problems with the new PyTest 4.0.

Versioning

  • updates version number to 0.1.dev24

@coveralls
Copy link

coveralls commented Dec 14, 2018

Pull Request Test Coverage Report for Build 135

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage decreased (-3.5%) to 86.166%

Totals Coverage Status
Change from base Build 100: -3.5%
Covered Lines: 1308
Relevant Lines: 1518

💛 - Coveralls

@smmaurer smmaurer changed the title Work in progress: Integrating changes from models in production [0.1.dev22] Work in progress: Integrating changes from models in production Dec 17, 2018
@smmaurer smmaurer changed the title [0.1.dev22] Work in progress: Integrating changes from models in production [0.1.dev24] Work in progress: Integrating changes from models in production Dec 18, 2018
@smmaurer smmaurer changed the title [0.1.dev24] Work in progress: Integrating changes from models in production [0.1.dev24] Integrating changes from models in production Dec 20, 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.

None yet

2 participants