I have a binary classification problem. I get the following results: a val_loss
(far) lower than the train_loss
, but the accuracy
is also lower for the validation compared to the training set. How is that possible ?
Epoch 1/10
10708/10708 [=======] - loss: 0.6356 - acc: 0.8289 - val_loss: 0.4981 - val_acc: 0.7760
Epoch 2/10
10708/10708 [=======] - loss: 0.6243 - acc: 0.8248 - val_loss: 0.5075 - val_acc: 0.7609
Epoch 3/10
10708/10708 [=======] - loss: 0.6204 - acc: 0.8302 - val_loss: 0.5152 - val_acc: 0.7694
Epoch 4/10
10708/10708 [=======] - loss: 0.6215 - acc: 0.8307 - val_loss: 0.4981 - val_acc: 0.7824
Epoch 5/10
10708/10708 [=======] - loss: 0.6180 - acc: 0.8318 - val_loss: 0.4942 - val_acc: 0.7848
This is the Keras model I'm using:
model = Sequential()
model.add(LSTM(16, input_shape=(1, 1)))
model.add(Dense(2, activation='softmax'))
adam = Adam(lr=0.001)
model.compile(loss='categorical_crossentropy',
optimizer=adam,
metrics=['accuracy'])
model.fit_generator()
. My batches are also not of the same size $\endgroup$