-
-
Save rubenfiszel/4a248002309a1647f0dc 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
val iterations = 500 | |
val seed = 456 | |
val listenerFreq = 1 | |
val batchSize = 100 | |
val numEx = 5000 | |
val server = UiServer.getInstance(); | |
log.info("Started on port " + server.getPort()); | |
log.info("Load data....") | |
val iter = new GamesIterator(batchSize, numEx) | |
val h1 = 100 | |
val h2 = 40 | |
// val h3 = 40 | |
val h4 = 40 | |
log.info("Build model....") | |
val conf: MultiLayerConfiguration = new NeuralNetConfiguration.Builder() | |
.seed(seed) | |
.iterations(iterations) | |
// .miniBatch(false) | |
.learningRate(1e-3f) | |
// .momentum(0.6f) | |
.optimizationAlgo(OptimizationAlgorithm.CONJUGATE_GRADIENT) | |
.l1(1e-1).l2(2e-4) | |
.list(3) | |
.layer(0, new DenseLayer.Builder() | |
.nIn(50) | |
.nOut(h1) | |
.weightInit(WeightInit.RELU) | |
.activation("relu") | |
.updater(Updater.NESTEROVS) | |
.build() | |
) | |
.layer(1, new DenseLayer.Builder() | |
.nIn(h1) | |
.nOut(h2) | |
.weightInit(WeightInit.RELU) | |
.activation("relu") | |
.updater(Updater.NESTEROVS) | |
.build() | |
) | |
.layer(2, new OutputLayer.Builder(LossFunctions.LossFunction.RMSE_XENT) | |
.nIn(h2) | |
.nOut(1) | |
.activation("sigmoid") | |
.build() | |
) | |
.build() | |
val model = new MultiLayerNetwork(conf) | |
model.init() | |
model.setListeners(new HistogramIterationListener(1), new ScoreIterationListener(listenerFreq)) | |
log.info("Train model....") | |
model.fit(iter) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment