Documentation of 'org.joone.engine.Matrix' Java class
Matrix
org.joone.engine

Class Matrix

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Cloneable


    public class Matrix
    extends java.lang.Object
    implements java.io.Serializable, java.lang.Cloneable
    The Matrix object represents the connection matrix of the weights of a synapse or the biases of a layer. In case of a synapse, it contains the weight of each connection. In case of a layer, it contains the bias of each neuron.

    Besides the weights or biases, it holds the last modification (update value or delta) and 2 boolean values indicating whether the weight is on or off and trainable or fixed.

    See Also:
    Serialized Form
    • Field Summary

      Fields 
      Modifier and Type Field and Description
      static double DEFAULT_INITIAL
      This constant defines the boundaries of the default domain used for weight initialization.
      double[][] delta
      The value of the last modification, i.e.
      boolean[][] enabled
      Flag indicating whether the weight is on or off.
      boolean[][] fixed
      Flag indicating whether the weight is fixed or trainable / adjustable.
      double[][] value
      The values of the weights / biases.
    • Constructor Summary

      Constructors 
      Constructor and Description
      Matrix()
      Default constructor Needed for Save as XML
      Matrix(int aRows, int aColumns)
      This constructur creates a weights or biases according to the values aRows and aColumns.
      Matrix(int aRows, int aColumns, double anInitial)
      This constructur creates a weights or biases according to the values aRows and aColumns.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method and Description
      void addNoise(double amplitude)
      Adds noise to the weights.
      void clear()
      Clears (resets) the matrix object.
      java.lang.Object clone()
      Clones this matrix object.
      void disableAll()
      Disables all the weights (or biases) of this matrix.
      void enableAll()
      Enables all the weights (or biases) of this matrix.
      void fixAll()
      Fixes all the weights (or biases) of this matrix.
      double[][] getDelta()
      Gets delta[][].
      boolean[][] getEnabled()
      Gets enabled.
      boolean[][] getFixed()
      Gets fixed[][].
      int getM_cols()
      Gets m_cols.
      int getM_rows()
      Gets m_rows.
      double[][] getValue()
      Gets value[][].
      WeightInitializer getWeightInitializer()
      Gets the weight initializer.
      void initialize()
      Initializes the weights or biases by making a call to the weight initializer.
      void removeColumn(int aColumn)
      Removes a column.
      void removeRow(int aRow)
      Removes a row.
      void setDelta(double[][] newdelta)
      Sets delta[][].
      void setEnabled(boolean[][] newenabled)
      Sets enabled[][].
      void setFixed(boolean[][] newfixed)
      Sets fixed.
      void setM_cols(int newm_cols)
      Sets m_cols.
      void setM_rows(int newm_rows)
      Sets m_rows.
      void setValue(double[][] newvalue)
      Sets value[][].
      void setWeightInitializer(WeightInitializer aWeightInitializer)
      Sets the weight initializer and initializes the weights.
      void setWeightInitializer(WeightInitializer aWeightInitializer, boolean anInitialize)
      Sets the weight initializer.
      void unfixAll()
      Unfixes all the weights (or biases) of this matrix.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • DEFAULT_INITIAL

        public static final double DEFAULT_INITIAL
        This constant defines the boundaries of the default domain used for weight initialization. Weights or biases are initialised by default with a random value in the domain [-DEFAULT_INITIAL, DEFAULT_INITIAL]. Although different boundaries or even different weight intialization can be used by calling differnt constructors that that a WeightInitializer class as parameter or by calling the method initialize().
        See Also:
        Constant Field Values
      • value

        public double[][] value
        The values of the weights / biases.
      • delta

        public double[][] delta
        The value of the last modification, i.e. the last update.
      • enabled

        public boolean[][] enabled
        Flag indicating whether the weight is on or off.
      • fixed

        public boolean[][] fixed
        Flag indicating whether the weight is fixed or trainable / adjustable.
    • Constructor Detail

      • Matrix

        public Matrix()
        Default constructor Needed for Save as XML
      • Matrix

        public Matrix(int aRows,
                      int aColumns)
        This constructur creates a weights or biases according to the values aRows and aColumns. The weights or biases are initialised with a random value in the domain of [-DEFAULT_INITIAL, DEFAULT_INITIAL].
        Parameters:
        aRows - the number of rows (the number of neurons on the input side of a synapse or the number of biases).
        aColumns - the number of colums (the number of neurons on the output side of a synapse or zero in case of biases).
      • Matrix

        public Matrix(int aRows,
                      int aColumns,
                      double anInitial)
        This constructur creates a weights or biases according to the values aRows and aColumns. And the weights or biases are initialized with a random value in the domain of [-anInitial, anInitial].
        Parameters:
        aRows - the number of rows (the number of neurons on the input side of a synapse or the number of biases).
        aColumns - the number of colums (the number of neurons on the output side of a synapse or zero in case of biases).
        anInitial - the boundary of the domain within these weights or biases shoud be randomly initialized.
    • Method Detail

      • initialize

        public void initialize()
        Initializes the weights or biases by making a call to the weight initializer. The weight initializer can be set through setWeightInitializer(WeightInitializer)
      • setWeightInitializer

        public void setWeightInitializer(WeightInitializer aWeightInitializer)
        Sets the weight initializer and initializes the weights. This function calls setWeightInitializer(aWeightInitializer, true).
        Parameters:
        aWeightInitializer - the weight initializer to set.
      • setWeightInitializer

        public void setWeightInitializer(WeightInitializer aWeightInitializer,
                                         boolean anInitialize)
        Sets the weight initializer.
        Parameters:
        aWeightInitializer - the weight initializer to set.
        anInitialize - if true the weights will be initialized by the new weight initializer, if false the weights will not be initialized.
      • getWeightInitializer

        public WeightInitializer getWeightInitializer()
        Gets the weight initializer.
        Returns:
        the weight initializer that is set for this matrix.
      • clone

        public java.lang.Object clone()
        Clones this matrix object. It returns a copy of this matrix object.
        Overrides:
        clone in class java.lang.Object
        Returns:
        a copy of the current matrix object.
      • addNoise

        public void addNoise(double amplitude)
        Adds noise to the weights. The noise that is added to the weights is within the domain [-amplitude, amplitude].
        Parameters:
        amplitude - defines the domain of noise.
      • removeRow

        public void removeRow(int aRow)
        Removes a row.
        Parameters:
        aRow - the row to remove.
      • removeColumn

        public void removeColumn(int aColumn)
        Removes a column.
        Parameters:
        aColumn - the column to remove.
      • clear

        public void clear()
        Clears (resets) the matrix object. The weights/ biases (values) and its delta values are reset to zero.
      • enableAll

        public void enableAll()
        Enables all the weights (or biases) of this matrix.
      • disableAll

        public void disableAll()
        Disables all the weights (or biases) of this matrix.
      • fixAll

        public void fixAll()
        Fixes all the weights (or biases) of this matrix.
      • unfixAll

        public void unfixAll()
        Unfixes all the weights (or biases) of this matrix.
      • getM_rows

        public int getM_rows()
        Gets m_rows. Needed for Save as XML
        Returns:
        m_rows
      • setM_rows

        public void setM_rows(int newm_rows)
        Sets m_rows. Needed for Save as XML
        Parameters:
        newm_rows - the new number of rows to set.
      • getM_cols

        public int getM_cols()
        Gets m_cols. Needed for Save as XML
        Returns:
        m_cols
      • setM_cols

        public void setM_cols(int newm_cols)
        Sets m_cols. Needed for Save as XML
        Parameters:
        newm_cols - the new number of columns to set.
      • getDelta

        public double[][] getDelta()
        Gets delta[][]. Needed for Save as XML
        Returns:
        delta[][]
      • setDelta

        public void setDelta(double[][] newdelta)
        Sets delta[][]. Needed for Save as XML
        Parameters:
        newdelta - the new delta to set.
      • getValue

        public double[][] getValue()
        Gets value[][]. Needed for Save as XML
        Returns:
        value[][]
      • setValue

        public void setValue(double[][] newvalue)
        Sets value[][]. Needed for Save as XML
        Parameters:
        newvalue - the new values to set
      • getFixed

        public boolean[][] getFixed()
        Gets fixed[][]. Needed for Save as XML
        Returns:
        fixed[][]
      • setFixed

        public void setFixed(boolean[][] newfixed)
        Sets fixed. Needed for Save as XML
        Parameters:
        newfixed - the new fixed values to set
      • getEnabled

        public boolean[][] getEnabled()
        Gets enabled. Needed for Save as XML
        Returns:
        enabled[][]
      • setEnabled

        public void setEnabled(boolean[][] newenabled)
        Sets enabled[][]. Needed for Save as XML
        Parameters:
        newenabled - the new enabled values to set.

DataMelt 3.0 © DataMelt by jWork.ORG

You see the box below because you did not login.