org.encog.neural.bam

## Class BAM

- java.lang.Object
- - org.encog.ml.BasicML
  - - org.encog.neural.bam.BAM

- All Implemented Interfaces:
    Serializable, MLMethod, MLProperties

      public class BAM
      extends BasicML

  Bidirectional associative memory (BAM) is a type of neural network developed by Bart Kosko in 1988. The BAM is a recurrent neural network that works similarly that allows patterns of different lengths to be mapped bidirectionally to other patterns. This allows it to act as almost a two-way hash map. During training the BAM is fed pattern pairs. The two halves of each pattern do not have to be the to be of the same length. However all patterns must be of the same overall structure. The BAM can be fed a distorted pattern on either side and will attempt to map to the correct value.
  Author:
    jheaton
  See Also:
    Serialized Form

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `BAM()` Default constructor, used mainly for persistence.
    `BAM(int theF1Count, int theF2Count)` Construct the BAM network.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addPattern(MLData inputPattern, MLData outputPattern)` Add a pattern to the neural network.
    `void` | `clear()` Clear any connection weights.
    `MLData` | `compute(MLData input)` Setup the network logic, read parameters from the network.
    `NeuralDataMapping` | `compute(NeuralDataMapping input)` Compute the network for the specified input.
    `int` | `getF1Count()`
    `int` | `getF2Count()`
    `Matrix` | `getWeightsF1toF2()`
    `Matrix` | `getWeightsF2toF1()`
    `void` | `setF1Count(int i)` Set the F1 neuron count.
    `void` | `setF2Count(int i)` Set the F2 neuron count.
    `void` | `setWeightsF1toF2(Matrix matrix)` Set the weights for F1 to F2.
    `void` | `setWeightsF2toF1(Matrix matrix)` Set the weights for F2 to F1.
    `void` | `updateProperties()` Update any objeccts when a property changes.

    - ### Methods inherited from class org.encog.ml.BasicML

      `getProperties, getPropertyDouble, getPropertyLong, getPropertyString, setProperty, setProperty, setProperty`

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

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

- - ### Constructor Detail

    - #### BAM

          public BAM()

      Default constructor, used mainly for persistence.

    - #### BAM

          public BAM(int theF1Count,
             int theF2Count)

      Construct the BAM network.
      Parameters:
        `theF1Count` - The F1 count.
        `theF2Count` - The F2 count.

  - ### Method Detail

    - #### addPattern

          public void addPattern(MLData inputPattern,
                        MLData outputPattern)

      Add a pattern to the neural network.
      Parameters:
        `inputPattern` - The input pattern.
        `outputPattern` - The output pattern(for this input).

    - #### clear

          public void clear()

      Clear any connection weights.

    - #### compute

          public MLData compute(MLData input)

      Setup the network logic, read parameters from the network. NOT USED, call compute(NeuralInputData).
      Parameters:
        `input` - NOT USED
      Returns:
        NOT USED

    - #### compute

          public NeuralDataMapping compute(NeuralDataMapping input)

      Compute the network for the specified input.
      Parameters:
        `input` - The input to the network.
      Returns:
        The output from the network.

    - #### getF1Count

          public int getF1Count()

      Returns:
        the f1Count

    - #### getF2Count

          public int getF2Count()

      Returns:
        the f2Count

    - #### getWeightsF1toF2

          public Matrix getWeightsF1toF2()

      Returns:
        the weightsF1toF2

    - #### getWeightsF2toF1

          public Matrix getWeightsF2toF1()

      Returns:
        the weightsF2toF1

    - #### setF1Count

          public void setF1Count(int i)

      Set the F1 neuron count.
      Parameters:
        `i` - The count.

    - #### setF2Count

          public void setF2Count(int i)

      Set the F2 neuron count.
      Parameters:
        `i` - The count.

    - #### setWeightsF1toF2

          public void setWeightsF1toF2(Matrix matrix)

      Set the weights for F1 to F2.
      Parameters:
        `matrix` - The weight matrix.

    - #### setWeightsF2toF1

          public void setWeightsF2toF1(Matrix matrix)

      Set the weights for F2 to F1.
      Parameters:
        `matrix` - The weight matrix.

    - #### updateProperties

          public void updateProperties()

      Update any objeccts when a property changes.
      Specified by:
        `updateProperties` in interface `MLProperties`
      Specified by:
        `updateProperties` in class `BasicML`

Copyright © 2014. All Rights Reserved.