Skip to content

Instantly share code, notes, and snippets.

@WillKoehrsen
Last active August 14, 2018 12:47
Show Gist options
  • Save WillKoehrsen/96e676e81289e8fd2011bb4b51616a5a to your computer and use it in GitHub Desktop.
Save WillKoehrsen/96e676e81289e8fd2011bb4b51616a5a to your computer and use it in GitHub Desktop.
import numpy as np
from hyperopt import hp, tpe, fmin
# Single line bayesian optimization of polynomial function
best = fmin(fn = lambda x: np.poly1d([1, -2, -28, 28, 12, -26, 100])(x),
space = hp.normal('x', 4.9, 0.5), algo=tpe.suggest,
max_evals = 2000)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment