Created
April 29, 2021 05:36
-
-
Save MareHanus/f7fa5aa0884a2cfeff96e9a1818e4dfa 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
new Thread(() -> { | |
MultiLayerConfiguration conf = new NeuralNetConfiguration.Builder() | |
.optimizationAlgo(OptimizationAlgorithm.STOCHASTIC_GRADIENT_DESCENT) | |
.weightInit(WeightInit.XAVIER) | |
.updater(new Sgd(0.1)) | |
.list() | |
.layer(0, new DenseLayer.Builder() | |
.nIn(100) | |
.nOut(100) | |
.activation(Activation.LEAKYRELU) | |
.build()) | |
.layer(1, new DenseLayer.Builder() | |
.nIn(100) | |
.nOut(100) | |
.activation(Activation.LEAKYRELU) | |
.build()) | |
.layer(2, new OutputLayer.Builder(LossFunctions.LossFunction.MCXENT) | |
.nIn(100) | |
.nOut(3) | |
.activation(Activation.SOFTMAX) | |
.build()) | |
.build(); | |
MultiLayerNetwork model = new MultiLayerNetwork(conf); | |
model.init(); | |
INDArray inputs = Nd4j.rand(10_000, 100); | |
INDArray outputs = Nd4j.rand(10_000, 3); | |
for (int i = 0; i < 10_000; i++) { | |
model.fit(inputs, outputs); | |
} | |
}).start(); | |
new Thread(() -> { | |
MultiLayerConfiguration conf = new NeuralNetConfiguration.Builder() | |
.optimizationAlgo(OptimizationAlgorithm.STOCHASTIC_GRADIENT_DESCENT) | |
.weightInit(WeightInit.XAVIER) | |
.updater(new Sgd(0.1)) | |
.list() | |
.layer(0, new DenseLayer.Builder() | |
.nIn(100) | |
.nOut(100) | |
.activation(Activation.LEAKYRELU) | |
.build()) | |
.layer(1, new DenseLayer.Builder() | |
.nIn(100) | |
.nOut(100) | |
.activation(Activation.LEAKYRELU) | |
.build()) | |
.layer(2, new OutputLayer.Builder(LossFunctions.LossFunction.MCXENT) | |
.nIn(100) | |
.nOut(3) | |
.activation(Activation.SOFTMAX) | |
.build()) | |
.build(); | |
MultiLayerNetwork model = new MultiLayerNetwork(conf); | |
model.init(); | |
INDArray inputs = Nd4j.rand(10_000, 100); | |
INDArray outputs = Nd4j.rand(10_000, 3); | |
for (int i = 0; i < 10_000; i++) { | |
model.fit(inputs, outputs); | |
} | |
}).start(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment