Created
January 30, 2018 13:51
-
-
Save tastyminerals/cb2c0bcfa046050c403ba9d2b75f09a9 to your computer and use it in GitHub Desktop.
demo
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
class NetworkInit(vocabSize: Int) { | |
private val embeddingWidth = 100 | |
private val hiddenSize = 200 | |
private val numberOfFeats = 9 | |
private val numberOfClasses = 1 | |
val config: ComputationGraphConfiguration = new NeuralNetConfiguration.Builder() | |
.learningRate(DatasetTools.getTomlConfTable("romain").getDouble("minlr")) | |
.graphBuilder() | |
.addInputs("wordIndeces") | |
.addInputs("features") | |
.addLayer("wordVectorizer", | |
new EmbeddingLayer.Builder() | |
.nIn(vocabSize) | |
.nOut(embeddingWidth) | |
.build(), | |
"wordIndeces") | |
.addLayer("linear1", | |
new DenseLayer.Builder() | |
.nIn(numberOfFeats) | |
.nOut(embeddingWidth) | |
.build(), | |
"features") | |
.addVertex("sum", new ElementWiseVertex(ElementWiseVertex.Op.Add), "wordVectorizer", "linear1") | |
.addLayer("hidden", | |
new GravesLSTM.Builder() | |
.activation(Activation.TANH) | |
.nIn(hiddenSize) | |
.nOut(hiddenSize) | |
.build(), | |
"sum") | |
.addLayer("linear2", | |
new DenseLayer.Builder() | |
.activation(Activation.SIGMOID) | |
.nIn(hiddenSize) | |
.nOut(numberOfClasses) | |
.build(), | |
"hidden") | |
.setOutputs("linear2") | |
.build() | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment