This is an automated email from the ASF dual-hosted git repository.
joern pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/opennlp-sandbox.git
The following commit(s) were added to refs/heads/master by this push:
new c6b5669 Shuffle the training samples for each epoch in namecat
c6b5669 is described below
commit c6b5669cddb42af1243d7d254eba4c26c79be2b2
Author: Jörn Kottmann <[email protected]>
AuthorDate: Wed Apr 3 10:38:10 2019 +0200
Shuffle the training samples for each epoch in namecat
---
tf-ner-poc/src/main/python/namecat/namecat.py | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/tf-ner-poc/src/main/python/namecat/namecat.py
b/tf-ner-poc/src/main/python/namecat/namecat.py
index 86822c0..cc3f28a 100644
--- a/tf-ner-poc/src/main/python/namecat/namecat.py
+++ b/tf-ner-poc/src/main/python/namecat/namecat.py
@@ -169,7 +169,11 @@ def main():
acc_train = []
batch_indexes = list(range(floor(len(names_train) / batch_size)))
- random.Random(epoch).shuffle(batch_indexes)
+
+ # Shuffle the data
+ combined = list(zip(names_train, labels_train))
+ random.shuffle(combined)
+ names_train[:], labels_train[:] = zip(*combined)
for batch_index in batch_indexes:
label_train_batch, name_train_batch, name_train_length = \