Skip to content

Commit

Permalink
Pretty print namespace
Browse files Browse the repository at this point in the history
  • Loading branch information
williamFalcon committed Feb 10, 2018
1 parent 1a153d1 commit fa07f17
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env python
from setuptools import setup, find_packages

version = '0.47'
version = '0.48'

setup(name='test_tube',
packages=find_packages(),
Expand Down
10 changes: 9 additions & 1 deletion test_tube/argparse_hopt.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ def __namespace_from_trial(self, trial):
if k not in trial_dict:
trial_dict[k] = v

return argparse.Namespace(**trial_dict)
return TTNamespace(**trial_dict)


def __flatten_params(self, params):
Expand All @@ -150,6 +150,14 @@ def __flatten_params(self, params):
return flat_params


class TTNamespace(argparse.Namespace):
def __str__(self):
result = '-'*100 + '\nHyperparameters:\n'
for k, v in self.__dict__.items():
result += '{0:20}: {1}\n'.format(k, v)
return result


class OptArg(object):

def __init__(self, obj_id, opt_values, nb_samples=None, tunnable=False):
Expand Down

0 comments on commit fa07f17

Please sign in to comment.