Created
July 2, 2016 12:28
-
-
Save ftarlao/fadca060f506a188e27f59f314c0028a to your computer and use it in GitHub Desktop.
This file contains 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
MultiLayerConfiguration.Builder builder = new NeuralNetConfiguration.Builder() | |
.seed(seed) | |
.iterations(iterations) | |
.regularization(true).l2(0.0005) | |
.learningRate(0.01)//.biasLearningRate(0.02) | |
//.learningRateDecayPolicy(LearningRatePolicy.Inverse).lrPolicyDecayRate(0.001).lrPolicyPower(0.75) | |
.weightInit(WeightInit.XAVIER) | |
.gradientNormalization(GradientNormalization.RenormalizeL2PerLayer) | |
.optimizationAlgo(OptimizationAlgorithm.STOCHASTIC_GRADIENT_DESCENT) | |
.updater(Updater.NESTEROVS).momentum(0.9) | |
.list(6) | |
.layer(0, new ConvolutionLayer.Builder(5, 5) | |
.nIn(nChannels) | |
.stride(1, 1) | |
.nOut(20) | |
.activation("identity") | |
.build()) | |
.layer(1, new SubsamplingLayer.Builder(SubsamplingLayer.PoolingType.MAX) | |
.kernelSize(2, 2) | |
.stride(2, 2) | |
.build()) | |
.layer(2, new ConvolutionLayer.Builder(5, 5) | |
.nIn(nChannels) | |
.stride(1, 1) | |
.nOut(50) | |
.activation("identity") | |
.build()) | |
.layer(3, new SubsamplingLayer.Builder(SubsamplingLayer.PoolingType.MAX) | |
.kernelSize(2, 2) | |
.stride(2, 2) | |
.build()) | |
.layer(4, new DenseLayer.Builder().activation("relu") | |
.nOut(500).build()) | |
.layer(5, new OutputLayer.Builder(LossFunctions.LossFunction.NEGATIVELOGLIKELIHOOD) | |
.nOut(outputNum) | |
.activation("softmax") | |
.build()) | |
.backprop(true).pretrain(false); | |
new ConvolutionLayerSetup(builder, SCREEN_SIZE, SCREEN_SIZE, nChannels); | |
MultiLayerConfiguration conf = builder.build(); | |
MultiLayerNetwork model = new MultiLayerNetwork(conf); | |
model.init(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment