Skip to content

Instantly share code, notes, and snippets.

@jvence
Created April 21, 2016 10:07
Show Gist options
  • Save jvence/c011235a00dbd767909efb3f34b2a2b1 to your computer and use it in GitHub Desktop.
Save jvence/c011235a00dbd767909efb3f34b2a2b1 to your computer and use it in GitHub Desktop.

Revisions

  1. jvence created this gist Apr 21, 2016.
    20 changes: 20 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,20 @@
    MultiLayerConfiguration conf = new NeuralNetConfiguration.Builder()
    .seed(seed)
    .iterations(1)
    .optimizationAlgo(OptimizationAlgorithm.STOCHASTIC_GRADIENT_DESCENT)
    .learningRate(learningRate)
    .updater(Updater.NESTEROVS).momentum(0.9)
    .list(2)
    .layer(0, new DenseLayer.Builder().nIn(numInputs).nOut(numHiddenNodes)
    .weightInit(WeightInit.XAVIER)
    .activation("relu")
    .build())
    .layer(1, new OutputLayer.Builder(LossFunction.NEGATIVELOGLIKELIHOOD)
    .weightInit(WeightInit.XAVIER)
    .activation("softmax")
    .nIn(numHiddenNodes).nOut(numOutputs).build())
    .pretrain(false).backprop(true).build();

    MultiLayerNetwork model = new MultiLayerNetwork(conf);
    model.init();
    model.setListeners(new ScoreIterationListener(1));