How to save and load experiment/model from `optimize`
See original GitHub issueHi, from the documentation, the optimize
function returns the (best_parameters, values, experiment, model)
tuple. I’m wondering what’s the best practices for saving these values (e.g. for visualization in a different machine)? Also, is it possible to interrupt a model and later resume from the state in the optimize
API? Thanks!
Issue Analytics
- State:
- Created 4 years ago
- Reactions:1
- Comments:19 (11 by maintainers)
Top Results From Across the Web
Save, Load and Resume Experiments - garage - Read the Docs
In general, loading models and resuming an experiment includes the following steps: Initialize the Trainer / TFTrainer instance. Restore the algorithm and ...
Read more >Save and Load Machine Learning Models in Python with scikit ...
This article shows how to save a model that is built from scratch. But I am looking to train the model by including...
Read more >How to Save and Load Models in PyTorch - Wandb
This article is a tutorial that covers how to correctly save and load your trained machine learning models in PyTorch using Weights &...
Read more >How to save and load a Gurobi model and solution without ...
There may be a pretty simple answer to your question: it seems you are missing the modelLoaded.optimize() call. Even when "loading a solution" ......
Read more >Guide to model training — Part 6: Save & Load
The simplest way to save a model is as a byte object tied directly to a variable. This can be useful if you...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hi, @ksanjeevan, @theinlinaung2010! Sorry to have missed your tags, the issue was closed so we weren’t notified in time. Feel free to reopen the issue if there is a follow-up, in the future, to make sure we get back to you as soon as we can!
For 2), you can use
get_best_parameters
utility to find the best point on the experiment. You can also useexp_to_df
to view the trials in your experiment as a convenient dataframe. Let me know if those don’t fully address your concern!To use storage functionality for experiment and models used in optimization, I would recommend using our Service API that is well integrated with our storage layer (you can store locally to a .json file or to an SQL backend). You can check out our API comparison code snippets and the Service API tutorial to see how to get started and how to leverage storage.
Let us know if you have further questions, I’ll keep the issue open for now.
Hi @nwrim ! The easiest way to accomplish what you want is probably to save the data that you’re using to fit the model (rather than the model itself), and then you can refit it whenever you want. If you want to take advantage of Ax’s storage to do so, you would use
experiment.attach_data()
followed bysave_experiment
. Then you can useload_experiment
andexperiment.lookup_data_for_trial
orexperiment.lookup_data_for_ts
at a later point to grab that data again and refit the model. Does that sound like it would help?