Class NeuronSquareMesh2D

    • Constructor Detail

      • NeuronSquareMesh2D

        public NeuronSquareMesh2D​(int numRows,
                                  boolean wrapRowDim,
                                  int numCols,
                                  boolean wrapColDim,
                                  SquareNeighbourhood neighbourhoodType,
                                  FeatureInitializer[] featureInit)
        Creates a two-dimensional network composed of square cells: Each neuron not located on the border of the mesh has four neurons linked to it.
        The links are bi-directional.
        The topology of the network can also be a cylinder (if one of the dimensions is wrapped) or a torus (if both dimensions are wrapped).
        Parameters:
        numRows - Number of neurons in the first dimension.
        wrapRowDim - Whether to wrap the first dimension (i.e the first and last neurons will be linked together).
        numCols - Number of neurons in the second dimension.
        wrapColDim - Whether to wrap the second dimension (i.e the first and last neurons will be linked together).
        neighbourhoodType - Neighbourhood type.
        featureInit - Array of functions that will initialize the corresponding element of the features set of each newly created neuron. In particular, the size of this array defines the size of feature set.
        Throws:
        NumberIsTooSmallException - if numRows < 2 or numCols < 2.
    • Method Detail

      • copy

        public NeuronSquareMesh2D copy()
        Performs a deep copy of this instance. Upon return, the copied and original instances will be independent: Updating one will not affect the other.
        Returns:
        a new instance with the same state as this instance.
        Since:
        3.6
      • iterator

        public java.util.Iterator<Neuron> iterator()
        Specified by:
        iterator in interface java.lang.Iterable<Neuron>
        Since:
        3.6
      • getNetwork

        public Network getNetwork()
        Retrieves the underlying network. A reference is returned (enabling, for example, the network to be trained). This also implies that calling methods that modify the Network topology may cause this class to become inconsistent.
        Returns:
        the network.
      • getNumberOfRows

        public int getNumberOfRows()
        Gets the number of neurons in each row of this map.
        Returns:
        the number of rows.
      • getNumberOfColumns

        public int getNumberOfColumns()
        Gets the number of neurons in each column of this map.
        Returns:
        the number of column.
      • getNeuron

        public Neuron getNeuron​(int row,
                                int col,
                                NeuronSquareMesh2D.HorizontalDirection alongRowDir,
                                NeuronSquareMesh2D.VerticalDirection alongColDir)
        Retrieves the neuron at (location[0], location[1]) in the map. The neuron at position (0, 0) is located at the upper-left corner of the map.
        Parameters:
        row - Row index.
        col - Column index.
        alongRowDir - Direction along the given row (i.e. an offset will be added to the given column index.
        alongColDir - Direction along the given col (i.e. an offset will be added to the given row index.
        Returns:
        the neuron at the requested location, or null if the location is not on the map.
        See Also:
        getNeuron(int,int)