Commit db84919f authored by Marius Kriegerowski's avatar Marius Kriegerowski

bare hyperparameter optimizer

parent b4885bf1
import skopt, gp_minimize
from skopt.space import Real, Categorical, Integer
from pyrocko.guts import Object, Int, Float, List
class Optimizer(Object):
learning_rate = Tuple.T(Float.T(), 3, default=(1e-5, 1e-2, 1e-4)) # low, high, default
path_best = String.T(default='winner')
def evaluate(self, model):
# loss = model(**)
return loss
def optimize(self):
default_parameters = [
self.learning_rate[-1]
]
gp_minimize(func=self.evaluate,
x0=default_parameters)
def log_dir_name(self, learning_rate):
# The dir-name for the TensorBoard log-dir.
s = "./logs/lr_{0:.0e}_layers"
# Insert all the hyper-parameters in the dir-name.
log_dir = s.format(learning_rate)
return log_dir
if __name__ == '__main__':
print(skopt.__version__)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment