diff options
| author | schneefux <schneefux+commit@schneefux.xyz> | 2017-04-07 20:40:31 +0200 |
|---|---|---|
| committer | schneefux <schneefux+commit@schneefux.xyz> | 2017-04-07 20:40:31 +0200 |
| commit | 64621cf21b43b47dcb615a4a626f31b789cac4b0 (patch) | |
| tree | 8b5fca71776da8cad4b9431a4d35c307da0ac2e5 | |
| parent | 15dfc83ea4504c74fdf18e3c036e2b392f3a9352 (diff) | |
| download | analyzer-64621cf21b43b47dcb615a4a626f31b789cac4b0.tar.gz analyzer-64621cf21b43b47dcb615a4a626f31b789cac4b0.zip | |
warn and crash on invalid queue jobs
| -rw-r--r-- | worker.py | 6 |
1 files changed, 4 insertions, 2 deletions
@@ -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, |
