Search in sources :

Example 1 with NegativeDefaultStepFunction

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();
}
Also used : OutputLayer(org.deeplearning4j.nn.conf.layers.OutputLayer) RnnToFeedForwardPreProcessor(org.deeplearning4j.nn.conf.preprocessor.RnnToFeedForwardPreProcessor) MultiLayerConfiguration(org.deeplearning4j.nn.conf.MultiLayerConfiguration) NormalDistribution(org.deeplearning4j.nn.conf.distribution.NormalDistribution) NegativeDefaultStepFunction(org.deeplearning4j.nn.conf.stepfunctions.NegativeDefaultStepFunction)

Aggregations

MultiLayerConfiguration (org.deeplearning4j.nn.conf.MultiLayerConfiguration)1 NormalDistribution (org.deeplearning4j.nn.conf.distribution.NormalDistribution)1 OutputLayer (org.deeplearning4j.nn.conf.layers.OutputLayer)1 RnnToFeedForwardPreProcessor (org.deeplearning4j.nn.conf.preprocessor.RnnToFeedForwardPreProcessor)1 NegativeDefaultStepFunction (org.deeplearning4j.nn.conf.stepfunctions.NegativeDefaultStepFunction)1