question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Saving a study locally

See original GitHub issue

Hi !

From what I read in the optuna.study.create_study documentation, the storage parameter only takes a database URL as input. Is there a way to persist a study locally? (I’m already using MLflow to log my metrics and model parameters, could it help?)

Thanks for your input 😃

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5

github_iconTop GitHub Comments

1reaction
dianemarquettecommented, Jun 18, 2021

@nbkn865 Thanks for your input 😃. I wasn’t aware of the built-in SQLite database in Python that can run locally. I’m going to try to implement your solution 👍🏻

1reaction
nbkn865commented, Jun 18, 2021

@dianemarquette, not familiar with Hydra, but it looks like a Python package, and it looks like there’s a parameter for Optuna storage. Given that, have you tried using the built-in SQLite database in Python?

From a Python call, you can set an Optuna study to store in SQLite that resides locally on whatever path your script is on.

For example:

study_name = “my_study” storage_name = f"sqlite:///{study_name}.db" study = optuna.create_study(study_name=study_name, storage=storage_name, load_if_exists=True)

This will create a file called my_study.db in the directory of your Python script that stores the study

You can then query its results using the following method call that creates a pandas dataframe:

df = study.trials_dataframe() # Get all columns of study

Based on the above, and using the Hydra documentation, maybe you can try the following parameter for storage and study_name:

sampler: target: optuna.samplers.TPESampler seed: 123 … warn_independent_sampling: true target: hydra_plugins.hydra_optuna_sweeper.optuna_sweeper.OptunaSweeper direction: minimize storage: sqlite:///my_test_study.db study_name: my_test_study

Read more comments on GitHub >

github_iconTop Results From Across the Web

3 Ways to Save Time Studying: Easy Time-Saving Tips
Trying to force yourself to study a ton of information during the last couple of days leading up to your exam is incredibly...
Read more >
Studying locally | Goldsmiths, University of London
1. Saving money. Staying local could help to keep down costs as you are already familiar with your outgoings and won't need to...
Read more >
Advantages Of Studying Locally Essay Sample 2023
The cost factor is considered when one decides to study locally. The cost of living is affordable and friendly because it saves one...
Read more >
Studying locally and studying abroad: Pros & Cons
First, studying in local universities can save the cost compared to studying in universities abroad. The different countries have different currency rate.
Read more >
"Studying locally is very beneficial to students" | University of ...
In my own experience, studying locally is very beneficial to students. You can get the support of friends and family (both morally and ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found