jiesutd / NCRFpp

NCRF++, a Neural Sequence Labeling Toolkit. Easy use to any sequence labeling tasks (e.g. NER, POS, Segmentation). It includes character LSTM/CNN, word LSTM/CNN and softmax/CRF components.
Apache License 2.0
1.89k stars 446 forks source link

Deterministic Training Behaviour #44

Closed hendriksc closed 6 years ago

hendriksc commented 6 years ago

Hi, what am I doing wrong that the training with the same hyperparameters results always in the same performance? There should be some variance because of the random initialization or am i wrong?

Config looks like this:

train_dir=.../conll2003/en/ner/train.txt
dev_dir=.../conll2003/en/ner/valid.txt
test_dir=.../conll2003/en/ner/test.txt
model_dir=test.model
word_emb_dir=.../sample_data/sample.word.emb
norm_word_emb=False
norm_char_emb=False
number_normalized=True
seg=True
word_emb_dim=50
char_emb_dim=30
use_crf=True
use_char=True
word_seq_feature=LSTM
char_seq_feature=CNN
nbest=1
status=train
optimizer=Adam
iteration=1
batch_size=8
ave_batch_loss=False
cnn_layer=4
char_hidden_dim=30
hidden_dim=200
dropout=0.5
lstm_layer=2
bilstm=True
learning_rate=0.002
lr_decay=0.05
momentum=0
l2=1e-08
gpu=True
jiesutd commented 6 years ago

Yes @hendriksc , the random seed has been fixed at https://github.com/jiesutd/NCRFpp/blob/084bae935c8e519ca14a5a66f29039e7015af2bd/main.py#L28 , so it can generally give the same result. You can manually change the random seed number and get a different result.

hendriksc commented 6 years ago

@jiesutd Thank you very much!