Created
June 17, 2016 13:22
-
-
Save andrewclegg/a4f9db8033e8d10dcdf1194b7979a568 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def buildNetwork(features: Int) = { | |
val builder = new NeuralNetConfiguration.Builder() | |
.seed(1) | |
.iterations(1) | |
.optimizationAlgo(OptimizationAlgorithm.STOCHASTIC_GRADIENT_DESCENT) | |
.l1(0.1) | |
.updater(Updater.NONE) | |
builder.setUseRegularization(true) | |
val conf = builder | |
.list | |
.layer(0, new OutputLayer.Builder(LossFunction.NEGATIVELOGLIKELIHOOD) | |
.weightInit(WeightInit.XAVIER) | |
.activation("softmax").weightInit(WeightInit.XAVIER) | |
.nIn(features).nOut(2).build()) | |
.pretrain(false).backprop(true).build | |
val network = new MultiLayerNetwork(conf) | |
network.init() | |
network.setListeners(Collections.singletonList[IterationListener](new ScoreIterationListener(1))) | |
network | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment