I’ve defined the following MultiLayerNetwork for an intent detection scenario (for a given user input I want to predict the intent that corresponds to that input). I’m trying to define a network with three layers: an embedding one for a BagOfWords (created from the training sentences in the intents definition), a hidden one and a final output one that returns the matching probabilities for every intent.
Two questions:
- Is there obviously wrong in my attempted architecture?
- When I create the model from this configuration, I don’t get any type of exception but the “layers” attribute is null (the model object itself is not)
See below the code I’m using. Thanks!
int numOutputs = context.numberIntents();
int vocabSize = context.getBagOfWords().getVocabCache().numWords();
MultiLayerConfiguration conf = new NeuralNetConfiguration.Builder()
.seed(seed)
.weightInit(WeightInit.RELU)
.updater(new Nesterovs(0.01, 0.9))
.list()
.layer(new EmbeddingLayer.Builder().nIn(vocabSize).nOut(24)
.activation(Activation.RELU)
.build())
.layer(new DenseLayer.Builder().nIn(24).nOut(8)
.activation(Activation.RELU)
.build())
.layer(new OutputLayer.Builder((LossFunctions.LossFunction.NEGATIVELOGLIKELIHOOD))
.activation(Activation.SOFTMAX)
.nIn(8).nOut(numOutputs)
.build())
.build();
MultiLayerNetwork model = new MultiLayerNetwork((conf));