-
Notifications
You must be signed in to change notification settings - Fork 131
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
YAML Saving and Loading #20
Merged
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
A fit RegressionModel stores a statsmodels RegressionResults subclass and uses that for prediction. (And users can look at the statistics of the model fit.) For the purposes of storing models on disk all we can save is the model expression and the fit coefficients. _FakeRegressionResults can wrap those to provide a RegressionResults stand in when loading a fit model from a file.
We'll be able to save even a fit model on disk or in a database as JSON.
also updating the order for the lcm yaml options added simple_relocation_rate to the location choice model
should have been in the relocation model - didn't notice this at first
Also moved the creation of a dict representation out to its own method.
….utils.yamlio module.
…tsy string So that models can be expressed as strings, lists, or dictionaries and converted to strings for statsmodels/patsy on the fly.
… string, list, or dict.
jiffyclub
added a commit
that referenced
this pull request
May 14, 2014
YAML Saving and Loading With this RegressionModel and MNLLocationChoiceModel can have their configuration saved to YAML files using .to_yaml methods. Saved configurations can be used to instantiate models using .from_yaml methods. Matching methods for the other model classes will come soon (where applicable). Another change here is some flexibility in how model expressions can be specified for regressions and location choice models. Previously these had to be strings compatible with patsy, and that's still fine, but now lists and dictionaries can be used.
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.
With this
RegressionModel
andMNLLocationChoiceModel
can have their configuration saved to YAML files using.to_yaml
methods. Saved configurations can be used to instantiate models using.from_yaml
methods. Matching methods for the other model classes will come soon (where applicable).Another change here is some flexibility in how model expressions can be specified for regressions and location choice models. Previously these had to be strings compatible with patsy, and that's still fine, but now lists and dictionaries can be used. The following are valid and equivalent model expressions:
And for right-side only expressions these are all equivalent and valid: