Class ArtificialNeuralNetwork


  • public final class ArtificialNeuralNetwork
    extends java.lang.Object
    • Constructor Detail

      • ArtificialNeuralNetwork

        ArtificialNeuralNetwork​(NetworkBuilder builder)
      • ArtificialNeuralNetwork

        ArtificialNeuralNetwork​(PhysicalStore.Factory<java.lang.Double,​?> factory,
                                int inputs,
                                int[] layers)
    • Method Detail

      • builder

        public static NetworkBuilder builder​(int numberOfNetworkInputNodes)
      • builder

        @Deprecated
        public static NetworkTrainer builder​(int numberOfInputNodes,
                                             int... nodesPerCalculationLayer)
        Deprecated.
        Use builder(int) instead
      • from

        public static ArtificialNeuralNetwork from​(java.io.DataInput input)
                                            throws java.io.IOException
        Read (reconstruct) an ANN from the specified input previously written by writeTo(DataOutput).
        Throws:
        java.io.IOException
      • doIdentity

        static void doIdentity​(PhysicalStore<java.lang.Double> output)
      • doReLU

        static void doReLU​(PhysicalStore<java.lang.Double> output)
      • doSigmoid

        static void doSigmoid​(PhysicalStore<java.lang.Double> output)
      • doSoftMax

        static void doSoftMax​(PhysicalStore<java.lang.Double> output)
      • doTanh

        static void doTanh​(PhysicalStore<java.lang.Double> output)
      • depth

        public int depth()
        Returns:
        The number of calculation layers
      • equals

        public boolean equals​(java.lang.Object obj)
        Overrides:
        equals in class java.lang.Object
      • getBias

        public double getBias​(int layer,
                              int output)
      • getWeight

        public double getWeight​(int layer,
                                int input,
                                int output)
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • newInvoker

        public NetworkInvoker newInvoker​(int batchSize)
        If you create multiple invokers you can use them in different threads simutaneously - the invoker contains any/all invocation specific state.
        Parameters:
        batchSize - The batch size - the number of batched invocations
        Returns:
        The invoker
      • newTrainer

        public NetworkTrainer newTrainer​(int batchSize)
        Only 1 trainer at the time.
        Parameters:
        batchSize - The batch size - the number of batched training examples
        Returns:
        The trainer
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • width

        public int width()
        Returns:
        The max number of nodes in any layer
      • writeTo

        public void writeTo​(java.io.DataOutput output)
                     throws java.io.IOException
        Will write (save) the ANN to the specified output. Can then later be read back by using from(DataInput).
        Throws:
        java.io.IOException
      • writeTo

        public void writeTo​(java.nio.file.Path path,
                            java.nio.file.OpenOption... options)
        See Also:
        writeTo(DataOutput)
      • countInputNodes

        int countInputNodes()
      • countInputNodes

        int countInputNodes​(int layer)
      • countOutputNodes

        int countOutputNodes()
      • countOutputNodes

        int countOutputNodes​(int layer)
      • getWeights

        java.util.List<MatrixStore<java.lang.Double>> getWeights()
      • newBatch

        DataBatch newBatch​(int rows,
                           int columns)
      • newStore

        PhysicalStore<java.lang.Double> newStore​(int rows,
                                                 int columns)
      • randomise

        void randomise()
      • scale

        void scale​(int layer,
                   double factor)
      • setBias

        void setBias​(int layer,
                     int output,
                     double bias)
      • setWeight

        void setWeight​(int layer,
                       int input,
                       int output,
                       double weight)