keras-team / keras-contrib

Keras community contributions
MIT License
1.59k stars 653 forks source link

how does marginal mode process mask? #516

Open MeloMing opened 4 years ago

MeloMing commented 4 years ago

I am using marginal mode to get a probability distribution of each slice for active learning.As usual,I use mask to preprocess my data.I use zero-mask to make my train set size (train_num,mask_length),and my label set size(train_num,mask_length,1).That means all of my train_dic or label_dic should start from 1 because 0 is used for mask.The training is ok when I use join mode,but when I trianed on marginal mode,it had such wrong information: InvalidArgumentError: Received a label value of 19 which is outside the valid range of [0, 19). I have 19 labels in my train_set,and I labeled them from 1 to 19,I have learned that marginal mode not uses the default crf implement but uses sparse_categorical_crossentropy to compute loss.Does the problem comes from here?I think in normal sparse_categorical_crossentropy loss,the label should start from zero,but here zero is used for mask.

MeloMing commented 4 years ago

@lzfelix