-1

I have 60 signals sequences samples with length 200 each labeled by 6 label groups, each label is marked with one of 10 values. I'd like to get prediction in each label group on each label when feeding the 200-length or even shorter sample to the network.

I tried to build own network based on https://github.com/eclipse/deeplearning4j-examples/blob/master/dl4j-examples/src/main/java/org/deeplearning4j/examples/recurrent/seqclassification/UCISequenceClassificationExample.java example, which, however, provides the label padding. I use no padding for the label and I'm getting exception like this:

Exception in thread "main" java.lang.IllegalStateException: Sequence lengths do not match for RnnOutputLayer input and labels:Arrays should be rank 3 with shape [minibatch, size, sequenceLength] - mismatch on dimension 2 (sequence length) - input=[1, 200, 12000] vs. label=[1, 1, 10]
Eljah
  • 4,188
  • 4
  • 41
  • 85

1 Answers1

-1

In fact, it is a requirement for the labels to have a time dimension what is 200-long for the features the same as features are. So here I have to do some kind of techniques like zeroes padding in all 6 labels channel. On other hand, the input was wrong, I put all 60*200 there, however it should be [1, 200, 60] there while 6 labels are [1, 200, 10] each.

The thing under the question is in which part of 200-length label I should place the real label value [0], [199] or may be place labels to the typical parts of the signals they are associated with? My trainings that should check this is still in progress. What kind of padding is better? Zeroes padding or the label value padding? Still not clear and can't google out paper explaining what is the best.

Eljah
  • 4,188
  • 4
  • 41
  • 85
  • 1
    Take a look at this thread on the community forums, it should answer your question pretty well: https://community.konduit.ai/t/cannot-do-lstm-dense-in-sequence-classification/365/7 – Paul Dubs Apr 15 '20 at 19:30
  • @PaulDubs the discussion you have posted it great, but for me it doesn't explain what particular position of 200 on the output data to use in order to obtain the classification. As far as I have understood, despite of ```train.setPreProcessor(new LabelLastTimeStepPreProcessor());``` I'm still getting the output of feature size, not the original label size, right? If so, what particulart position on the "labels array" works for the classification choise? – Eljah Apr 15 '20 at 19:55
  • 1
    You *don't* have to put it into a sequence, if you use just the last step, then you set it to use `AlignmentMode.ALIGN_END` and the record reader will align things so that your label ends up at the last timestep. Take another look at the linked discussion. – Paul Dubs Apr 16 '20 at 08:15
  • @PaulDubs got it about the labels NDArray and how it is actually aligned, but what about the output, evaluated from the model? It would have the size of the whole series, right? So, when I'm getting the output values in order to find the max and look it up to assign the correct label for the classification, so which position of all 200 existing in the output I should use to get the value (they are not de-aligned for the evaluated output, right?)? I haven't got this from the linked discussion, that's my problem. – Eljah Apr 16 '20 at 08:52
  • 1
    When you are wrapping it with the last timestep wrapper, you will only get the output from the last timestep, and that is just a single value. – Paul Dubs Apr 17 '20 at 09:40