How to do it...

  1. Configure the neural network using ComputationGraph, as shown here:
ComputationGraphConfiguration.GraphBuilder builder = new NeuralNetConfiguration.Builder()
.seed(RANDOM_SEED)
.optimizationAlgo(OptimizationAlgorithm.STOCHASTIC_GRADIENT_DESCENT)
.weightInit(WeightInit.XAVIER)
.updater(new Adam())
.dropOut(0.9)
.graphBuilder()
.addInputs("trainFeatures");
  1. Configure the LSTM layer:
new LSTM.Builder()
.nIn(INPUTS)
.nOut(LSTM_LAYER_SIZE)
.forgetGateBiasInit(1)
.activation(Activation.TANH)
.build(),"trainFeatures");
  1. Add the LSTM layer to the ComputationGraph configuration:
builder.addLayer("L1", new LSTM.Builder()
.nIn(86)
.nOut(200)
.forgetGateBiasInit(1)
.activation(Activation.TANH)
.build(),"trainFeatures");
..................Content has been hidden....................

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