Skip to content

Optuna.jl is a software package for the Julia programming language that provides an interface for the open source hyperparameter optimization framework Optuna.

License

Notifications You must be signed in to change notification settings

una-auxme/Optuna.jl

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

44 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Optuna.jl

Docs Build Status ColPrac: Contributor's Guide on Collaborative Practices for Community Packages Code Style: Blue Coverage

Optuna.jl is a software package for the Julia programming language that provides an API Interface for the open source hyperparameter optimization framework Optuna.

This package is based on the Python API that is provided by Preferred Networks, Inc. in their GitHub repository.

“Optuna, the Optuna logo and any related marks are trademarks of Preferred Networks, Inc.”

How to install Optuna.jl

  1. Open the Jula REPL. Type ] to open the package manager.
  2. Install Optuna
    pkg> add Optuna
  1. Examples for hyperparameter optimization are provided in the examples folder. You can also refer to the documentation for further information.

How to use Optuna.jl

The purest way to set up a hyperparameter optimization is shown in the following. For more advanced topics - like storing artifacts, multithreading, and more - see the examples folder.

using Optuna

# central database storage for all studies
database_url = "examples/storage"
database_name = "example_db"

# name and artifact path for the study
study_name = "example-study"
artifact_path = "examples/artifacts"

# Create/Load database storage for studies
storage_url = create_sqlite_url(database_url, database_name)
storage = RDBStorage(storage_url)

# Create artifact store for the study
artifact_store = FileSystemArtifactStore(artifact_path)

study = Study(
    study_name,
    artifact_store,
    storage;
    direction="minimize",
    load_if_exists=true,
)

function objective(trial::Trial; x, y, z)
    result = z ? x * (y - param) : x * (y + param)
    return result
end

optimize(study, objective, (x=[0, 100], y=[-10.0f0, 10.0f0], z=[true, false]); n_trials=10, n_jobs=1, verbose=true)

println("Best params: ", best_params(study))
println("Best value: ", best_value(study))

How to contribute

Contributors are welcome. Before contributing, please read, understand and follow the Contributor's Guide on Collaborative Practices for Community Packages.

About

Optuna.jl is a software package for the Julia programming language that provides an interface for the open source hyperparameter optimization framework Optuna.

Resources

License

Stars

Watchers

Forks

Contributors 5

Languages