Skip to content

Best way to extract parameters and save model objects? #40

Answered by mwshinn
hauselin asked this question in Ask for help
Discussion options

You must be logged in to vote

Thanks for your inquiry!

I would not recommend using get_dependence() or model.dependencies, since these will make it difficult to extract the information you need.

If you want to save a model to reuse later, the easiest (and most space-efficient) way to do this is to print() the model, cast it to a string with str(), or run repr() on it, and then save the string they output. The function print() produces a nicer formatting than repr(), but otherwise they are identical. (str(), print(), and repr() I am talking about are all the versions built-in to Python) If you execute these strings on a new python interpreter with the appropriate imports, you should get the same model.

For analyzing pa…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@hauselin
Comment options

Answer selected by hauselin
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants