summaryrefslogtreecommitdiff
path: root/worker.py
diff options
context:
space:
mode:
Diffstat (limited to 'worker.py')
-rw-r--r--worker.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/worker.py b/worker.py
index a1ab696..e53617b 100644
--- a/worker.py
+++ b/worker.py
@@ -121,8 +121,8 @@ class Model(object):
return vars(record.roster[0].match[0])[column]
raise KeyError("Invalid path " + path)
- def _batch(self, ids=[], size=None):
- if len(ids) == 0: # training, get random sample
+ def _batch(self, ids=None, size=None):
+ if ids is None: # training, get random sample
size = size or self.batchsize
# train a model one batch
offset = random.random() * self._db.query(Participant).count()
@@ -151,6 +151,8 @@ class Model(object):
labels = np.array(labels)
logging.info("sample size: %s", len(labels))
+ if ids is not None:
+ assert len(ids) == len(labels), "got nonexisting participant"
return tf.contrib.learn.io.numpy_input_fn(
data, labels, batch_size=self.batchsize,