I'm trying to train a network for a textclassification where the texts are labeled with 6 different categories. Each text can have only one label.
So far I built the following simple network:
## Network architecture
model = Sequential()
model.add(Embedding(20000, 100, input_length=50))
model.add(LSTM(100, dropout=0.2, recurrent_dropout=0.2))
model.add(Dense(1, activation='sigmoid'))
model.compile(loss='categorical_crossentropy', optimizer='adam', metrics=['accuracy'])
## Fit the model
history = model.fit(data, np.array(labels), validation_split=0.2, batch_size = 32, epochs=25)
When I'm training the networtk the training and validation loss stays constantly by '0.0000e+00.
Epoch 1/25
26/26 [==============================] - 8s 225ms/step - loss: 0.0000e+00 - accuracy: 0.2847 - val_loss: 0.0000e+00 - val_accuracy: 0.3188
Epoch 2/25
26/26 [==============================] - 6s 213ms/step - loss: 0.0000e+00 - accuracy: 0.2887 - val_loss: 0.0000e+00 - val_accuracy: 0.2754
Epoch 3/25
26/26 [==============================] - 6s 230ms/step - loss: 0.0000e+00 - accuracy: 0.2350 - val_loss: 0.0000e+00 - val_accuracy: 0.2705
Epoch 4/25
26/26 [==============================] - 6s 217ms/step - loss: 0.0000e+00 - accuracy: 0.2180 - val_loss: 0.0000e+00 - val_accuracy: 0.2657
Epoch 5/25
26/26 [==============================] - 6s 220ms/step - loss: 0.0000e+00 - accuracy: 0.2262 - val_loss: 0.0000e+00 - val_accuracy: 0.2609
Epoch 6/25
26/26 [==============================] - 6s 224ms/step - loss: 0.0000e+00 - accuracy: 0.2542 - val_loss: 0.0000e+00 - val_accuracy: 0.2609
Epoch 7/25
26/26 [==============================] - 6s 223ms/step - loss: 0.0000e+00 - accuracy: 0.2379 - val_loss: 0.0000e+00 - val_accuracy: 0.2512
.
.
.
Does somebody know what's causing this?
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…