use of org.deeplearning4j.nn.conf.stepfunctions.NegativeDefaultStepFunction in project deeplearning4j by deeplearning4j.
the class GravesLSTMOutputTest method getNetworkConf.
private MultiLayerConfiguration getNetworkConf(int iterations, boolean useTBPTT) {
MultiLayerConfiguration.Builder builder = new NeuralNetConfiguration.Builder().optimizationAlgo(OptimizationAlgorithm.STOCHASTIC_GRADIENT_DESCENT).learningRate(0.1).regularization(true).l2(0.0025).iterations(iterations).stepFunction(new NegativeDefaultStepFunction()).list().layer(0, new GravesLSTM.Builder().weightInit(WeightInit.DISTRIBUTION).dist(new NormalDistribution(0.0, 0.01)).nIn(nIn).nOut(layerSize).updater(Updater.ADAGRAD).activation(Activation.TANH).build()).layer(1, new OutputLayer.Builder(LossFunctions.LossFunction.NEGATIVELOGLIKELIHOOD).updater(Updater.ADAGRAD).nIn(layerSize).nOut(nIn).activation(Activation.SOFTMAX).build()).inputPreProcessor(1, new RnnToFeedForwardPreProcessor()).backprop(true).pretrain(false);
if (useTBPTT) {
builder.backpropType(BackpropType.TruncatedBPTT);
builder.tBPTTBackwardLength(window / 3);
builder.tBPTTForwardLength(window / 3);
}
return builder.build();
}
Aggregations