Strategy for "forcing" number of labels in seq2seq predictions with Keras?



I'm trying to train a seq2seq model that for every timestep in a given timeseries sample will output 1 of 6 possible labels.

Furthermore, the training data is constructed in such a way that

  • Each sample can only contain a maximum of 2 types of labels

  • Label 1 can co-occur with any other label. No other labels can co-occur.

Is there any way to specifically guide training with rules like these, or is my best bet to hope that the model will pick up on this? In roughly 85-90% of cases the model behaves as hoped, but in a few noisy edge-cases it sometimes oscillates wildly between different labels, throughout the sample.


Posted 2019-04-25T11:23:29.567

Reputation: 143

1Simply remap your labels into 6 + 5 + 1=12 new labels: empty, 1-6, 12, 13, 14, 15, 16. – Valentas – 2019-04-25T12:02:28.133

1Could you do a more detailed writeup? I don't really understand what you're getting at. Edit: do you mean "12" as in "label 2 if it co-occurs with 1"? – komodovaran_ – 2019-04-25T12:17:36.990

No answers