From c09ded41a60cc911df133caf9d04268342806cf7 Mon Sep 17 00:00:00 2001
From: Silas Dohm <silas@sdohm.xyz>
Date: Mon, 2 Aug 2021 14:35:43 +0200
Subject: [PATCH] fixed earlystop

---
 python/w2v_cnn_gen_hdf5.py      | 2 +-
 python/w2v_sentence_mean gen.py | 2 +-
 python/w2v_sentence_mean.py     | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/python/w2v_cnn_gen_hdf5.py b/python/w2v_cnn_gen_hdf5.py
index 78ee36e..bf81056 100644
--- a/python/w2v_cnn_gen_hdf5.py
+++ b/python/w2v_cnn_gen_hdf5.py
@@ -28,7 +28,7 @@ num_rows = 4.8E6
 batchSize = 2048
 steps = num_rows/batchSize
 #early stop
-earlystop = keras.callbacks.EarlyStopping(monitor='sparse_categorical_accuracy',patience=10,verbose=False,restore_best_weights=True)
+earlystop = keras.callbacks.EarlyStopping(monitor='val_sparse_categorical_accuracy',patience=5,verbose=False,restore_best_weights=True)
 cbList = [earlystop]
 
 trainData = hdf5Generator(path + "w2vCNN.hdf5", batchSize, "Train")
diff --git a/python/w2v_sentence_mean gen.py b/python/w2v_sentence_mean gen.py
index 74d8c22..aed03f4 100644
--- a/python/w2v_sentence_mean gen.py	
+++ b/python/w2v_sentence_mean gen.py	
@@ -72,7 +72,7 @@ modelNN.compile(optimizer='adam',loss='categorical_crossentropy',metrics=["spars
 
 # %% fit
 #early stop
-earlystop = keras.callbacks.EarlyStopping(monitor='sparse_categorical_accuracy',patience=10,verbose=False,restore_best_weights=True)
+earlystop = keras.callbacks.EarlyStopping(monitor='val_sparse_categorical_accuracy',patience=10,verbose=False,restore_best_weights=True)
 cbList = [earlystop]
 
 train = generate_arrays_from_file('./train.json',batchSize)
diff --git a/python/w2v_sentence_mean.py b/python/w2v_sentence_mean.py
index bf9fa95..1085823 100644
--- a/python/w2v_sentence_mean.py
+++ b/python/w2v_sentence_mean.py
@@ -64,7 +64,7 @@ modelNN.compile(optimizer='adam',loss='sparse_categorical_crossentropy',metrics=
 
 # %% fit
 #early stop
-earlystop = keras.callbacks.EarlyStopping(monitor='sparse_categorical_accuracy',patience=5,verbose=False,restore_best_weights=True)
+earlystop = keras.callbacks.EarlyStopping(monitor='val_sparse_categorical_accuracy',patience=5,verbose=False,restore_best_weights=True)
 cbList = [earlystop]
 count = np.unique(Y_train,return_counts=True)[1]
 cWeight = 1/(count/Y_train.size)
-- 
GitLab