Documentation of 'org.joone.helpers.structure.NeuralNetMatrix' Java class
NeuralNetMatrix
org.joone.helpers.structure

Class NeuralNetMatrix



  • public class NeuralNetMatrix
    extends java.lang.Object
    Utility class that performs several useful 'decompositions' of a NeuralNet object, making very simple to handle its internal structure. This class can be useful to analyze or transfor a neural network, because it transforms the network to a 'flat' structure, where there isn't any object pointed more than once. It, also, by means of the getConnectionMatrix public method, returns a 2D representation of the internal Synapses of a neural network.
    • Constructor Detail

      • NeuralNetMatrix

        public NeuralNetMatrix()
        Creates a new instance of NeuralNetMatrix
      • NeuralNetMatrix

        public NeuralNetMatrix(NeuralNet net)
        Creates a new instance of NeuralNetMatrix
    • Method Detail

      • setNeuralNet

        public void setNeuralNet(NeuralNet net)
        Method used to set the neural network to dissect
      • getConnectionMatrix

        public Synapse[][] getConnectionMatrix()
        Converts the neural structure to a matrix containing all the synapses of the neural network. At each not-null [x][y] element of the 2D array, there is a pointer to the Synapse connecting the Layer[x] to the Layer[y]. The returned 2D array of Synapses could be used, for instance, to draw a graphical representation of the neural network.
      • isThereAnyPath

        public boolean isThereAnyPath(Layer fromLayer,
                                      Layer toLayer)
        Searches a path between two layers. Useful in order to discover recurrent networks
        Returns:
        true if there is a path from fromLayer to toLayer
      • getOrderedConnectionMatrix

        public Synapse[][] getOrderedConnectionMatrix()
        Converts the neural structure to a matrix containing all the synapses of the neural network. The indexes indicates the layer in Layer[] getOrderedLayers(). At each not-null [x][y] element of the 2D array, there is a pointer to the Synapse connecting the (ordered)Layer[x] to the (ordered)Layer[y]. The returned 2D array of Synapses could be used, for instance, to draw a graphical representation of the neural network.
        Returns:
        a matrix where the indexes x,y point to the Layers returned by getOrderedLayers().
      • getBinaryOrderedConnectionMatrix

        public boolean[][] getBinaryOrderedConnectionMatrix()
        Converts the neural structure to a matrix containing all the synapses of the neural network. The index indicates the layer in Layer[] getOrderedLayers(). True means connection between the corresponding layers.
        Returns:
        a matrix where the indexes x,y point to the Layers returned by getOrderedLayers().
      • getOrderedLayers

        public Layer[] getOrderedLayers()
        This method calculates the order of the layers of a neural network, from the input to the output. This method fills also the translations array.
        Returns:
        An array containing the ordered Layers, from the input to the output (i.e. layers[0]=input layer, layers[n-1]=output layer.
      • getInputLayers

        public java.util.ArrayList getInputLayers(Synapse[][] connMatrix)
        Searches for all the input layers of the network. An input layer is represented by each column in connectionMatrix that doesn't contain any Synapse
        Returns:
        an ArrayList containing Integers that point to the indexes of the input layers
      • cloneElement

        public java.io.Serializable cloneElement(java.io.Serializable element)
        Clones a neural element.
        Parameters:
        element - The element to clone
        Returns:
        the clone of the element passed as parameter
      • getLayers

        public java.util.ArrayList getLayers()
        Getter for property layers.
        Returns:
        Value of property layers.
      • setLayers

        public void setLayers(java.util.ArrayList layers)
        Setter for property layers.
        Parameters:
        layers - New value of property layers.
      • getConnectionSet

        public java.util.ArrayList getConnectionSet()
        Getter for property connectionSet.
        Returns:
        Value of property connectionSet.
      • setConnectionSet

        public void setConnectionSet(java.util.ArrayList connectionSet)
        Setter for property connectionSet.
        Parameters:
        connectionSet - New value of property connectionSet.
      • getMonitor

        public Monitor getMonitor()
        Getter for property monitor.
        Returns:
        Value of property monitor.
      • setMonitor

        public void setMonitor(Monitor monitor)
        Setter for property monitor.
        Parameters:
        monitor - New value of property monitor.
      • getInputLayer

        public Layer getInputLayer()
      • setInputLayer

        public void setInputLayer(Layer inputLayer)
      • getOutputLayer

        public Layer getOutputLayer()
      • setOutputLayer

        public void setOutputLayer(Layer outputLayer)
      • getNumLayers

        public int getNumLayers()
      • getInputLayerInd

        public int getInputLayerInd()
        Calculates the index of the input layer
        Returns:
        The index, within NeuralNet.layers[], of the input layer
      • getOutputLayerInd

        public int getOutputLayerInd()
      • getLayerInd

        public int getLayerInd(Layer layer)
        Calculates the index of a layer within the layers array. This method uses the NeuralNet's
        Returns:
        the Layer's index starting from 0. Returns -1 if not found

DataMelt 3.0 © DataMelt by jWork.ORG

You see the box below because you did not login.