python-3.xhyperopt

contents of Trials() object in hyperopt


This query is referring to usage of trials as an argument in fmin.

trials = Trials()
best = fmin(objective, space=hp.uniform('x', -10, 10), algo=tpe.suggest,
    max_evals=100, trials=trials)

The documentation (https://github.com/hyperopt/hyperopt/wiki/FMin) state that trials object got lists like trials.trials, trials.results, trials.losses() and trials.statuses().

However, I have seen usages like trials.best_trial and trials.trial_attachments that were not mentioned in the document.

Now I wonder how to get a list of all the contents of the trials object? The object type is hyperopt.base.Trials.


Solution

  • As per Hyperopt code: `Trials - a list of documents including at least sub-documents

    ['spec'] - the specification of hyper-parameters for a job
    ['result'] - the result of Domain.evaluate(). Typically includes:
        ['status'] - one of the STATUS_STRINGS
        ['loss'] - real-valued scalar that hyperopt is trying to minimize
    ['idxs'] - compressed representation of spec
    ['vals'] - compressed representation of spec
    ['tid'] - trial id (unique in Trials list)`