src/demo/TextSeqDemo.java
private static NeuralNetwork buildNeuralNetwork(int inputSize, int outputSize) throws DynamicParamException, NeuralNetworkException, MatrixException {
        NeuralNetwork neuralNetwork = new NeuralNetwork();
        neuralNetwork.addInputLayer("width = " + inputSize);
        neuralNetwork.addHiddenLayer(LayerType.BIMINGRU, "width = 128");
        neuralNetwork.addHiddenLayer(LayerType.LAYER_NORMALIZATION);
        neuralNetwork.addHiddenLayer(LayerType.FEEDFORWARD, new ActivationFunction(UnaryFunctionType.GUMBEL_SOFTMAX), "width = " + outputSize);
        neuralNetwork.addOutputLayer(BinaryFunctionType.CROSS_ENTROPY);
        neuralNetwork.build();
        neuralNetwork.setOptimizer(OptimizationType.ADAM);
        return neuralNetwork;
    }
/**
     * Builds recurrent neural network (GRU) instance.
     *
     * @param inputSize input size of neural network (digits as one hot encoded in sequence).
     * @param outputSize output size of neural network (digits as one hot encoded in sequence).
     * @return neural network instance.
     * @throws DynamicParamException throws exception if setting of neural network parameters fail.
     * @throws NeuralNetworkException throws exception if creation of neural network instance fails.
     * @throws MatrixException throws exception if custom function is attempted to be created with this constructor.
     */
Builds recurrent neural network (GRU) instance.
@param inputSize input size of neural network (digits as one hot encoded in sequence).
@param outputSize output size of neural network (digits as one hot encoded in sequence).
@return neural network instance.
@throws DynamicParamException throws exception if setting of neural network parameters fail.
@throws NeuralNetworkException throws exception if creation of neural network instance fails.
@throws MatrixException throws exception if custom function is attempted to be created with this constructor.
Builds recurrent neural network ( GRU ) instance . @param inputSize input size of neural network ( digits as one hot encoded in sequence ) . @param outputSize output size of neural network ( digits as one hot encoded in sequence ) . @return neural network instance . @throws DynamicParamException throws exception if setting of neural network parameters fail . @throws NeuralNetworkException throws exception if creation of neural network instance fails . @throws MatrixException throws exception if custom function is attempted to be created with this constructor .
private static NeuralNetwork buildNeuralNetwork(int inputSize, int outputSize) throws DynamicParamException, NeuralNetworkException, MatrixException {
        NeuralNetwork neuralNetwork = new NeuralNetwork();
        neuralNetwork.addInputLayer("width = " + inputSize);
        neuralNetwork.addHiddenLayer(LayerType.BIMINGRU, "width = 128");
        neuralNetwork.addHiddenLayer(LayerType.LAYER_NORMALIZATION);
        neuralNetwork.addHiddenLayer(LayerType.FEEDFORWARD, new ActivationFunction(UnaryFunctionType.GUMBEL_SOFTMAX), "width = " + outputSize);
        neuralNetwork.addOutputLayer(BinaryFunctionType.CROSS_ENTROPY);
        neuralNetwork.build();
        neuralNetwork.setOptimizer(OptimizationType.ADAM);
        return neuralNetwork;
    }
private static NeuralNetwork buildNeuralNetwork ( int inputSize , int outputSize ) throws DynamicParamException , NeuralNetworkException , MatrixException { NeuralNetwork neuralNetwork = new NeuralNetwork ( ) ; neuralNetwork . addInputLayer ( "width = " + inputSize ) ; neuralNetwork . addHiddenLayer ( LayerType . BIMINGRU , "width = 128" ) ; neuralNetwork . addHiddenLayer ( LayerType . LAYER_NORMALIZATION ) ; neuralNetwork . addHiddenLayer ( LayerType . FEEDFORWARD , new ActivationFunction ( UnaryFunctionType . GUMBEL_SOFTMAX ) , "width = " + outputSize ) ; neuralNetwork . addOutputLayer ( BinaryFunctionType . CROSS_ENTROPY ) ; neuralNetwork . build ( ) ; neuralNetwork . setOptimizer ( OptimizationType . ADAM ) ; return neuralNetwork ; }
Builds recurrent neural network (GRU) instance.
Builds recurrent neural network ( GRU ) instance .