master_thesis_models / configs /hparams_search /focusConvMSE_150_hyperparameter_search.yaml
Hannes Kuchelmeister
add hyperparameter search for convolutional model
6693f22
raw
history blame
2.29 kB
# @package _global_
# example hyperparameter optimization of some experiment with Optuna:
# python train.py -m hparams_search=mnist_optuna experiment=example
defaults:
- override /datamodule: focus150.yaml
- override /model: focusConv_150.yaml
- override /hydra/sweeper: optuna
# choose metric which will be optimized by Optuna
# make sure this is the correct name of some metric logged in lightning module!
optimized_metric: "val/mae_best"
name: "focusConvMSE_150_hyperparameter_search"
# here we define Optuna hyperparameter search
# it optimizes for value returned from function with @hydra.main decorator
# docs: https://hydra.cc/docs/next/plugins/optuna_sweeper
hydra:
sweeper:
_target_: hydra_plugins.hydra_optuna_sweeper.optuna_sweeper.OptunaSweeper
# storage URL to persist optimization results
# for example, you can use SQLite if you set 'sqlite:///example.db'
storage: null
# name of the study to persist optimization results
study_name: focusConvMSE_150_hyperparameter_search
# number of parallel workers
n_jobs: 1
# 'minimize' or 'maximize' the objective
direction: minimize
# total number of runs that will be executed
n_trials: 20
# choose Optuna hyperparameter sampler
# docs: https://optuna.readthedocs.io/en/stable/reference/samplers.html
sampler:
_target_: optuna.samplers.TPESampler
seed: 12345
n_startup_trials: 10 # number of random sampling runs before optimization starts
# define range of hyperparameters
search_space:
datamodule.batch_size:
type: categorical
choices: [64, 128]
model.lr:
type: float
low: 0.0001
high: 0.2
model.pool_size:
type: categorical
choices: [1, 2, 3]
model.conv1_size:
type: categorical
choices: [3, 5, 7, 9]
model.conv1_channels:
type: categorical
choices: [1, 3, 6, 9]
model.conv2_size:
type: categorical
choices: [3, 5, 7, 9]
model.conv2_channels:
type: categorical
choices: [1, 3, 6, 9]
model.lin1_size:
type: categorical
choices: [16, 32, 64, 96, 128]
model.lin2_size:
type: categorical
choices: [16, 32, 64, 96, 128]