How it works...

In steps 1 and 2, we used AlignmentMode while creating the iterators for the training and test datasets. The AlignmentMode deals with input/labels of varying lengths (for example, one-to-many and many-to-one situations). Here are some types of alignment modes:

  • ALIGN_END: This is intended to align labels or input at the last time step. Basically, it adds zero padding at the end of either the input or the labels.
  • ALIGN_START: This is intended to align labels or input at the first time step. Basically, it adds zero padding at the end of the input or the labels.
  • EQUAL_LENGTH: This assumes that the input time series and label are of the same length, and all examples are the same length.
  • SequenceRecordReaderDataSetIterator: This helps to generate a time series dataset from the record reader passed in. The record reader should be based on sequence data and is optimal for time series data. Check out the attributes passed to the constructor:
DataSetIterator testDataSetIterator = new SequenceRecordReaderDataSetIterator(testFeaturesReader,testLabelsReader,batchSize,numberOfLabels,false, SequenceRecordReaderDataSetIterator.AlignmentMode.ALIGN_END);

testFeaturesReader and testLabelsReader are record reader objects for input data (features) and labels (for evaluation), respectively. The Boolean attribute (false) refers to whether we have regression samples. Since we are talking about time series classification, this is going to be false. For regression data, this has to be set to true

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset