This chapter's implementation code can be found at https://github.com/PacktPublishing/Java-Deep-Learning-Cookbook/blob/master/07_Constructing_LSTM_Neural_network_for_sequence_classification/sourceCode/cookbookapp/src/main/java/UciSequenceClassificationExample.java.
After cloning our GitHub repository, navigate to the Java-Deep-Learning-Cookbook/07_Constructing_LSTM_Neural_network_for_sequence_classification/sourceCode directory. Then import the cookbookapp project as a Maven project by importing pom.xml.
Download the data from this UCI website: https://archive.ics.uci.edu/ml/machine-learning-databases/synthetic_control-mld/synthetic_control.data.
We need to create directories to store the train and test data. Refer to the following directory structure:
We need to create two separate folders for the train and test datasets and then create subdirectories for features and labels respectively:
This folder structure is a prerequisite for the aforementioned data extraction. We separate features and labels while performing the extraction.
Note that, throughout this cookbook, we are using the DL4J version 1.0.0-beta 3, except in this chapter. You might come across the following error while executing the code that we discuss in this chapter:
Exception in thread "main" java.lang.IllegalStateException: C (result) array is not F order or is a view. Nd4j.gemm requires the result array to be F order and not a view. C (result) array: [Rank: 2,Offset: 0 Order: f Shape: [10,1], stride: [1,10]]
At the time of writing, a new version of DL4J has been released that resolves the issue. Hence, we will use version 1.0.0-beta 4 to run the examples in this chapter.