How to do it...

  1. Configure the neural network with default configurations:
NeuralNetConfiguration.Builder neuralNetConfigBuilder = new NeuralNetConfiguration.Builder();
neuralNetConfigBuilder.seed(123);
neuralNetConfigBuilder.weightInit(WeightInit.XAVIER);
neuralNetConfigBuilder.updater(new Nadam());
neuralNetConfigBuilder.gradientNormalization(GradientNormalization.ClipElementWiseAbsoluteValue);
neuralNetConfigBuilder.gradientNormalizationThreshold(0.5);
  1. Specify the input layer labels by calling addInputs():
ComputationGraphConfiguration.GraphBuilder compGraphBuilder = neuralNetConfigBuilder.graphBuilder();
compGraphBuilder.addInputs("trainFeatures");
  1. Add an LSTM layer using the addLayer() method:
compGraphBuilder.addLayer("L1", new LSTM.Builder().activation(Activation.TANH).nIn(1).nOut(10).build(), "trainFeatures");

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

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