from hyperopt_train import do_run

from hyperopt import fmin, tpe, hp, Trials
from hyperopt.mongoexp import MongoTrials
import hyperopt

#trials = MongoTrials('mongo://localhost/nonneg_db14/jobs', exp_key='exp1')
trials = Trials()

#hyper_space = {
#    'mwr': hp.choice('mwr', [0.3, 0.4, 0.5]),
#    'l1': hp.choice('l1', [1/3, 0.1, 0.1*2/3, 0.1/3, 0.01, 0]),
#    'l2': hp.choice('l2', [1/3, 0.1, 0.1*2/3, 0.1/3, 0.01, 0])
#}

hyper_space = {
    'mwr': hp.choice('mwr', [0.3]),
    'l1': hp.choice('l1', [1/3, 0.1, 0.1*2/3]),
    'l2': hp.choice('l2', [1/3, 0.1, 0.1*2/3]),
    'epochs': hp.choice('epochs', [10, 20])
}

best = fmin(do_run, hyper_space, trials=trials, algo=hyperopt.rand.suggest, max_evals=3 * 3 * 2)

print 'best:', best

print 'trials:'
for trial in trials.trials[:2]:
    print trial

print trials.trials