Skip to content

Commit

Permalink
Merge pull request ucbrise#6 from andrewmzhang/fix_grid_search
Browse files Browse the repository at this point in the history
Some fixes
  • Loading branch information
andrewmzhang authored Aug 16, 2018
2 parents 08901c4 + ec727eb commit 44d7fdf
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions python/frontend/cirrus/cirrus/GridSearch.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import os
import threading
import time
import math

import graph
from utils import *
Expand Down Expand Up @@ -39,7 +40,7 @@ def __init__(self, task=None, param_base=None, hyper_vars=[], hyper_params=[], m
hyper_params=hyper_params,
machines=machines)

adjust_num_threads();
self.adjust_num_threads();

def adjust_num_threads(self):
# make sure we don't have more threads than experiments
Expand Down Expand Up @@ -139,7 +140,10 @@ def custodian(cirrus_objs, thread_id, num_jobs):
loss = cirrus_obj.get_time_loss()
self.loss_lst[index] = loss

print("Thread", thread_id, "exp", index, "loss", self.loss_lst[index])
round_loss_lst = [(round(a, 3), round(float(b), 4))
for (a,b) in self.loss_lst[index]]
print("Thread", thread_id, "exp", index,
"loss", round_loss_lst)

index += num_jobs
if index >= len(cirrus_objs):
Expand Down Expand Up @@ -200,7 +204,7 @@ def get_number_experiments(self):
def set_threads(self, n):
self.num_jobs = n

adjust_num_threads();
self.adjust_num_threads();


# Start threads to maintain all experiments
Expand Down

0 comments on commit 44d7fdf

Please sign in to comment.