I am new to deep learning in general. I am trying to predict a sequence. My data is shaped as:
unix | change | low_margin | high_margin
1596322800000 | 0.12413154238073182029 | 0.88003705419175544233 | 0.15312164612708634025
1596326400000 | -0.27751567963589942832 | 0.60017439379603346877 | 0.46807644631921703576
1596330000000 | 1.7769698768363259 | 0.09413488648167383885 | 0.23692363768908328777
1596333600000 | -0.45876993166287015945 | 0.68331708567322522918 | 0.16993166287015945330
I would like to build a net to predict the next (change, and if possible high_mrg , low_mrgn).
The data is coming from SQL DB, using
JDBCRecordReader reader = new JDBCRecordReader(sql, ds);
reader.initialize(null);
RecordReaderDataSetIterator trainIter = new RecordReaderDataSetIterator(reader, BATCH_SIZE, 1, 1, true);
The model I am starting with:
int lstmLayerSize = 256;
LSTM lstmLayer1 = new LSTM.Builder()//
.nIn(lstmLayerSize)
.nOut(lstmLayerSize)
.activation(Activation.TANH)
.gateActivationFunction(Activation.HARDSIGMOID)
.dropOut(dropoutRatio)
.build();
DenseLayer denseLayer = new DenseLayer.Builder()//
.nIn(lstmLayerSize)
.nOut(lstmLayerSize)
.activation(Activation.RELU)
.build();
RnnOutputLayer rnnOutputLayer = new RnnOutputLayer.Builder(LossFunction.MSE).activation(Activation.IDENTITY)
.nIn(200)
.nOut(52)
.gradientNormalization(GradientNormalization.ClipElementWiseAbsoluteValue)
.gradientNormalizationThreshold(10)
.build();
MultiLayerConfiguration conf = new NeuralNetConfiguration.Builder()//
.seed(seed)
.optimizationAlgo(OptimizationAlgorithm.STOCHASTIC_GRADIENT_DESCENT)
.weightInit(WeightInit.XAVIER)
.updater(new Nesterovs(learningRate, 0.9))
.l2(1e-4)
.list()
.layer(0, lstmLayer1)
.layer(1, denseLayer)
.layer(2, rnnOutputLayer)
.build();
MultiLayerNetwork net = new MultiLayerNetwork(conf);
net.init();
net.setListeners(new ScoreIterationListener(10));
It is not clear to me how to reshape the data coming from the SQL DB. The page https://deeplearning4j.konduit.ai/models/recurrent describes features, examples, examplesNum, inputSize … etc. I think I am lost there trying to understand what would be timeSeriesLength, features, example, inputSize and the rest of terminology. So my question is, can someone please kindly clarify these terminologies, and how to shape them properly ?
Thank you