DeepBeliefNetwork

dbn.classifier.neural

## Class DeepBeliefNetwork

- java.lang.Object
- - com.syvys.jaRBM.RBMNet
  - - dbn.classifier.neural.DeepBeliefNetwork

- All Implemented Interfaces:
    java.io.Serializable, java.lang.Cloneable, mulan.classifier.neural.model.NeuralNet

      public class DeepBeliefNetwork
      extends com.syvys.jaRBM.RBMNet
      implements mulan.classifier.neural.model.NeuralNet, java.lang.Cloneable

  The structure of a Deep Belief Network (DBN). It extends the `RBMNet` class and all its methods. The main difference from the `RBMNet` is the constructor, which takes as a parameter an integers array with the sizes of all the labels and builds itself the network (you don't have to do it manually).
  This structure consists a number of `RBMImpl` neural networks that are going to be trained greedy. That means that when the first will be trained, then its output becomes the input to the second and so on.
  This class implements the `Cloneable` interface, so you can clone its instances (objects).
  See Also:
    `RBMNet`, `NeuralNet`, Serialized Form

- - ### Field Summary

    - ### Fields inherited from class com.syvys.jaRBM.RBMNet

      `_arrlistRBMs`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `DeepBeliefNetwork(int[] numUnitPerLayer)` Builds the `DeepBeliefNetwork` using an array with the sizes of layers.
    `DeepBeliefNetwork(com.syvys.jaRBM.RBMNet rbmnet)` Builds a DBN using a `RBMNet` object.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `DeepBeliefNetwork` | `clone()`
    `double[]` | `feedBackward(double[] inputPattern)` Back propagates the input pattern through the network.
    `double[]` | `feedBackward(double[] inputPattern, int fromRBMIndex)` Back propagates the input pattern through the network.
    `double[]` | `feedForward(double[] inputPattern)` Propagates the input pattern through the network.
    `double[]` | `feedForward(double[] inputPattern, int lastRBMIndex)` Propagates the input pattern through the network.
    `boolean[]` | `generateFeedBackwardUnits(double[] input)` Generates a feed backward bipartition.
    `boolean[]` | `generateFeedForwardUnits(double[] input)` Generates a feed forward bipartition.
    `int` | `getLayersCount()` Returns a total number of layers of the neural network.
    `java.util.List<mulan.classifier.neural.model.Neuron>` | `getLayerUnits(int layerIndex)` Returns units of a particular layer of the neural network.
    `int` | `getNetInputSize()` Gets the size/dimension of the input layer of the neural network.
    `int` | `getNetOutputSize()` Gets the size/dimension of the output layer of the neural network.
    `double[]` | `getOutput()` Returns the actual output of the neural network, which is a result of last processed input pattern.
    `void` | `reset()` Perform reset, re-initialization of neural network.
    `java.lang.String` | `toString()`

    - ### Methods inherited from class com.syvys.jaRBM.RBMNet

      `AddRBM, AddRBMNet, FlipAndStack, GenerateHiddenUnits, GenerateHiddenUnits, GenerateVisibleUnits, GenerateVisibleUnits, getConnectionWeightVector, getConnectionWeightVectorLength, getFlipped, getHiddenActivitiesFromVisibleData, getHiddenActivitiesFromVisibleData, getNumOfBottomVisibleUnits, getNumOfTopHiddenUnits, getNumRBMs, getRBM, getReconstructionMSE, getSquaredError, getVisibleActivitiesFromHiddenData, getVisibleActivitiesFromHiddenData, setConnectionWeightVector, setHiddenLayerType, setRBM, setVisibleLayerType`

    - ### Methods inherited from class java.lang.Object

      `equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Constructor Detail

    - #### DeepBeliefNetwork

          public DeepBeliefNetwork(int[] numUnitPerLayer)

      Builds the `DeepBeliefNetwork` using an array with the sizes of layers. If the parameter array has length 5, our new DeepBeliefNetwork will have 4 `RBMImpl`s stacked.
      Parameters:
        `numUnitPerLayer` - an array with the sizes of each layer
      Throws:
        `java.lang.IllegalArgumentException` - if number of layers are less then 3

    - #### DeepBeliefNetwork

          public DeepBeliefNetwork(com.syvys.jaRBM.RBMNet rbmnet)
                            throws java.lang.Exception

      Builds a DBN using a `RBMNet` object. It takes only the data from the `RBMNet`. It could cause an `Exception` if the `RBMNet` is `null`.
      Parameters:
        `rbmnet` - the `RBMNet` whose data we want to use
      Throws:
        `java.lang.Exception`

  - ### Method Detail

    - #### getNetInputSize

          public int getNetInputSize()

      Gets the size/dimension of the input layer of the neural network. This is the size of input pattern the neural network can process.
      Specified by:
        `getNetInputSize` in interface `mulan.classifier.neural.model.NeuralNet`
      Returns:
        the network input size

    - #### getNetOutputSize

          public int getNetOutputSize()

      Gets the size/dimension of the output layer of the neural network. This is the size of output pattern the neural network produces.
      Specified by:
        `getNetOutputSize` in interface `mulan.classifier.neural.model.NeuralNet`
      Returns:
        the network output size

    - #### getLayersCount

          public int getLayersCount()

      Returns a total number of layers of the neural network.
      Specified by:
        `getLayersCount` in interface `mulan.classifier.neural.model.NeuralNet`
      Returns:
        the number of layers in the neural network

    - #### getLayerUnits

          public java.util.List<mulan.classifier.neural.model.Neuron> getLayerUnits(int layerIndex)

      Returns units of a particular layer of the neural network. The valid indexes for layers are from 0 to N-1, where N is the total number of layers
      The first layer (index = 0) is always input layer and the last (index = N-1) always output layer.
      Specified by:
        `getLayerUnits` in interface `mulan.classifier.neural.model.NeuralNet`
      Parameters:
        `layerIndex` -
      Returns:
        returns an unmodifiable list of units of the particular layer
      Throws:
        `java.lang.IndexOutOfBoundsException` - if the index is out of range
      See Also:
        `Collections.unmodifiableList(List)`

    - #### feedForward

          public double[] feedForward(double[] inputPattern)

      Propagates the input pattern through the network.
      Specified by:
        `feedForward` in interface `mulan.classifier.neural.model.NeuralNet`
      Parameters:
        `inputPattern` - the input pattern for the network to process
      Returns:
        the output of the network
      Throws:
        `java.lang.IllegalArgumentException` - if input pattern is null or does not match network input dimension

    - #### feedForward

          public double[] feedForward(double[] inputPattern,
                             int lastRBMIndex)

      Propagates the input pattern through the network.
      Parameters:
        `inputPattern` - the input pattern for the network to process
        `lastRBMIndex` - the index of the last RBM to process
      Returns:
        the output of the network
      Throws:
        `java.lang.IllegalArgumentException` - if input pattern is null or does not match network input dimension
        `java.lang.ArrayIndexOutOfBoundsException` - if last RBM index is invalid

    - #### generateFeedForwardUnits

          public boolean[] generateFeedForwardUnits(double[] input)

      Generates a feed forward bipartition.
      Parameters:
        `input` -
      Returns:
        the status of the labels of the last layer in a bipartition (`true` or `false`)

    - #### feedBackward

          public double[] feedBackward(double[] inputPattern,
                              int fromRBMIndex)

      Back propagates the input pattern through the network.
      Parameters:
        `inputPattern` - the input pattern for the network to process from the back
        `fromRBMIndex` - the index of the last RBM to process
      Returns:
        the output of the top layer of the network
      Throws:
        `java.lang.IllegalArgumentException` - if input pattern is null or does not match network highest layers dimension
        `java.lang.ArrayIndexOutOfBoundsException` - if last RBM index is invalid

    - #### feedBackward

          public double[] feedBackward(double[] inputPattern)

      Back propagates the input pattern through the network.
      Parameters:
        `inputPattern` - the input pattern for the network to process from the back
      Returns:
        the output of the network on the top
      Throws:
        `java.lang.IllegalArgumentException` - if input pattern is null or does not match network higher layers dimension

    - #### generateFeedBackwardUnits

          public boolean[] generateFeedBackwardUnits(double[] input)

      Generates a feed backward bipartition.
      Parameters:
        `input` -
      Returns:
        the status of the labels of the first layer in a bipartition (`true` or `false`)

    - #### getOutput

          public double[] getOutput()

      Returns the actual output of the neural network, which is a result of last processed input pattern.
      Specified by:
        `getOutput` in interface `mulan.classifier.neural.model.NeuralNet`
      Returns:
        the output of the network. Returns null if network is reset or no input pattern was processed

    - #### reset

          public void reset()

      Perform reset, re-initialization of neural network. All learned knowledge stored in the network will be lost.
      Specified by:
        `reset` in interface `mulan.classifier.neural.model.NeuralNet`

    - #### clone

          public DeepBeliefNetwork clone()

      Overrides:
        `clone` in class `com.syvys.jaRBM.RBMNet`
      Returns:
        an exact copy of this `DeepBeliefNetwork`.

    - #### toString

          public java.lang.String toString()

      Overrides:
        `toString` in class `com.syvys.jaRBM.RBMNet`
      Returns:
        a string representation of the object