brightmart / text_classification

all kinds of text classification models and more with deep learning
MIT License
7.84k stars 2.57k forks source link

Training and validation accuracy not changing during training #35

Closed jwnsu closed 6 years ago

jwnsu commented 6 years ago

Multiple models (a02_TextCNN, a04_TextRCNN) have training and validation accuracy fixed at 0.5, while training loss/validation loss stably drops over time (dramatically, from 10^8-9 digits down to 1 to 2 digits.)

Is it normal or something wrong?

One of models, aa6_TwoCNNTextRelation has training accuracy fluctuate (above 0.5).

Thx.

brightmart commented 6 years ago

yeah. it is normal, i manuall set accuracy to 0.5, you can change it in models, such as:

self.predictions = tf.argmax(self.logits, 1, name="predictions") # shape:[None,] correct_prediction = tf.equal(tf.cast(self.predictions,tf.int32), self.input_y) #shape=[None,] self.accuracy =tf.reduce_mean(tf.cast(correct_prediction, tf.float32), name="Accuracy") # shape=()

brightmart commented 6 years ago

UPDATE: if you want to try a model now, you can go to folder 'a02_TextCNN', run 'python -u p7_TextCNN_train.py', it will use sample data to train a model, and print loss and F1 score periodically.