Guest User

Untitled

a guest
Dec 14th, 2018
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.71 KB | None | 0 0
  1. import pickle
  2. import time
  3. #utf8
  4. import pandas as pd
  5. import numpy as np
  6. from hyperopt import fmin, tpe, hp, STATUS_OK, Trials
  7.  
  8. def objective(x):
  9. return {
  10. 'loss': x ** 2,
  11. 'status': STATUS_OK,
  12. # -- store other results like this
  13. 'eval_time': time.time(),
  14. 'other_stuff': {'type': None, 'value': [0, 1, 2]},
  15. # -- attachments are handled differently
  16. 'attachments':
  17. {'time_module': pickle.dumps(time.time)}
  18. }
  19. trials = Trials()
  20. best = fmin(objective,
  21. space=hp.qloguniform('x', np.log(0.001), np.log(0.1), np.log(0.001)),
  22. algo=tpe.suggest,
  23. max_evals=100,
  24. trials=trials)
  25. pd.DataFrame(trials.trials)
  26.  
  27. hp.qloguniform('x', 0.001,0.1, 0.001)
Add Comment
Please, Sign In to add comment