Skip to content

Instantly share code, notes, and snippets.

@lacic
Last active December 20, 2016 17:24
Show Gist options
  • Save lacic/dce122066d2d46c83b43d14d149bedc6 to your computer and use it in GitHub Desktop.
Save lacic/dce122066d2d46c83b43d14d149bedc6 to your computer and use it in GitHub Desktop.
hiddenWidth = 20;
MultiLayerConfiguration conf = new NeuralNetConfiguration.Builder()
.optimizationAlgo(OptimizationAlgorithm.STOCHASTIC_GRADIENT_DESCENT).iterations(1)
.learningRate(0.05476383804339002) // 0.02 with BPTT
.momentum(0.5358333571512998)
.seed(12345)
.regularization(true)
.l2(0.016384859214629816)
.dropOut(0.8145498131858961)
.gradientNormalization(GradientNormalization.ClipElementWiseAbsoluteValue)
.gradientNormalizationThreshold(28.22828467793605)
.weightInit(WeightInit.XAVIER)
.updater(Updater.NESTEROVS)
.list()
.layer(0, new GravesLSTM.Builder()
.forgetGateBiasInit(1.2662013265922676)
.nIn(numInput)
.nOut(hiddenWidth)
.activation("softsign")
.build())
.layer(1, new GravesLSTM.Builder()
.forgetGateBiasInit(1.2662013265922676)
.nIn(hiddenWidth)
.nOut(hiddenWidth)
.activation("softsign")
.build())
.layer(2, new GravesLSTM.Builder()
.forgetGateBiasInit(1.2662013265922676)
.nIn(hiddenWidth)
.nOut(hiddenWidth)
.activation("tanh")
.build())
.layer(3, new RnnOutputLayer.Builder(LossFunction.MSE).activation("identity")
.nIn(hiddenWidth).nOut(1).build())
.backpropType(BackpropType.TruncatedBPTT).tBPTTForwardLength(28).tBPTTBackwardLength(28)
.pretrain(false).backprop(true)
.build();
MultiLayerNetwork net = new MultiLayerNetwork(conf);
net.init();
net.setListeners(new ScoreIterationListener(1000));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment