Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed problem with experiments with 1 variable #72

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions spearmint/tasks/base_task.py
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ def variables_config_to_meta(self, variables_config):
def paramify_and_print(self, data_vector, left_indent=0, indent_top_row=False):
params = self.paramify(data_vector)
indentation = ' '*left_indent

if indent_top_row:
sys.stderr.write(indentation)
sys.stderr.write('NAME TYPE VALUE\n')
Expand All @@ -263,7 +263,7 @@ def paramify_and_print(self, data_vector, left_indent=0, indent_top_row=False):
if i == 0:
sys.stderr.write(format_str % (indentation, param_name, param['type'], param['values'][i]))
else:
sys.stderr.write(format_str % (indentation, '', param['values'][i]))
sys.stderr.write(format_str % (indentation, '', '', param['values'][i]))

# Converts a vector in input space to the corresponding dict of params
def paramify(self, data_vector):
Expand All @@ -284,7 +284,7 @@ def paramify(self, data_vector):
params[name]['values'].append(vdict['options'][data_vector[ind].argmax(0)])
else:
raise Exception('Unknown parameter type.')

return params

# Converts a dict of params to the corresponding vector in puts space
Expand Down Expand Up @@ -334,7 +334,7 @@ def to_unit(self, V):
U = np.squeeze(U)

return U

def from_unit(self, U):
if U.shape[0] == 0:
return np.array([])
Expand Down Expand Up @@ -368,14 +368,14 @@ def from_unit(self, U):
raise Exception("Unknown variable type: %s" % variable['type'])

if squeeze:
V = np.squeeze(V)
V = np.ma.atleast_1d(np.squeeze(V))

return V

# Convert primitive types to the unit hypercube
def int_to_unit(self, v, vmin, vmax):
unit = (np.double(v) - vmin) / (vmax - vmin)

# Make sure we are not over bounds
try:
unit[unit > 1] = 1
Expand All @@ -389,7 +389,7 @@ def int_to_unit(self, v, vmin, vmax):

def float_to_unit(self, v, vmin, vmax):
unit = (np.double(v) - vmin) / (vmax - vmin)

# Make sure we are not over bounds
try:
unit[unit > 1] = 1.0
Expand Down