Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import pickle
- import time
- #utf8
- import pandas as pd
- import numpy as np
- from hyperopt import fmin, tpe, hp, STATUS_OK, Trials
- def objective(x):
- return {
- 'loss': x ** 2,
- 'status': STATUS_OK,
- # -- store other results like this
- 'eval_time': time.time(),
- 'other_stuff': {'type': None, 'value': [0, 1, 2]},
- # -- attachments are handled differently
- 'attachments':
- {'time_module': pickle.dumps(time.time)}
- }
- trials = Trials()
- best = fmin(objective,
- space=hp.qloguniform('x', np.log(0.001), np.log(0.1), np.log(0.001)),
- algo=tpe.suggest,
- max_evals=100,
- trials=trials)
- pd.DataFrame(trials.trials)
- hp.qloguniform('x', 0.001,0.1, 0.001)
Add Comment
Please, Sign In to add comment