If you want to just dump all contents to the screen you can do something like this. Here is how you would use the strategy on a Trials
object:
from hyperopt import Trials
def dump(obj):
for attr in dir(obj):
if hasattr( obj, attr ):
print( "obj.%s = %s" % (attr, getattr(obj, attr)))
tpe_trials = Trials()
dump(tpe_trials)
This will print all properties and methods of the Trials
object. I will not include it all here because it's long, but here are a few lines of it:
obj.__class__ = <class 'hyperopt.base.Trials'>
obj.__delattr__ = <method-wrapper '__delattr__' of Trials object at 0x0000012880AA3108>
obj.__dict__ = {'_ids': set(), '_dynamic_trials': [], '_exp_key': None, 'attachments': {}, '_trials': []}
obj.__dir__ = <built-in method __dir__ of Trials object at 0x0000012880AA3108>
. . .
obj._ids = set()
obj._insert_trial_docs = <bound method Trials._insert_trial_docs of <hyperopt.base.Trials object at 0x0000012880AA3108>>
obj._trials = []
obj.aname = <bound method Trials.aname of <hyperopt.base.Trials object at 0x0000012880AA3108>>
But I find it more usefull to look at the source code. There are a few properties declared under the __init__
function, then there are a set of properties declared using the @property
decorator. The methods are all def
s.
Not sure how your environment is setup, but the file is stored in my conda environment at ..\env\Lib\site-packages\yperopt\base.py
. class Trials(object)
should be declared around line 228.