Skip to content

Instantly share code, notes, and snippets.

@bayerj
Created September 30, 2012 19:58
Show Gist options
  • Select an option

  • Save bayerj/3808298 to your computer and use it in GitHub Desktop.

Select an option

Save bayerj/3808298 to your computer and use it in GitHub Desktop.
import spearmint
exp = spearmint.Experiment()
exp.add_variable('n_hiddens', min=1, max=100, type=int)
for i in range(100): # Do 100 trials.
id, args = exp.draw() # Get a new candidate; id is used as a handle for later pushing back results into the experiment.
cost = f(args) # Evaluate objective.
exp.push(id, cost) # Push results into the experiment so we get a new candidate based on those results in the next iteration.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment