org.encog.neural.cpn

## Class CPN

- java.lang.Object
- - org.encog.ml.BasicML
  - - org.encog.neural.cpn.CPN

- All Implemented Interfaces:
    Serializable, MLError, MLInput, MLInputOutput, MLMethod, MLOutput, MLProperties, MLRegression, MLResettable

      public class CPN
      extends BasicML
      implements MLRegression, MLResettable, MLError

  Counterpropagation Neural Networks (CPN) were developed by Professor Robert Hecht-Nielsen in 1987. CPN neural networks are a hybrid neural network, employing characteristics of both a feedforward neural network and a self-organzing map (SOM). The CPN is composed of three layers, the input, the instar and the outstar. The connection from the input to the instar layer is competitive, with only one neuron being allowed to win. The connection between the instar and outstar is feedforward. The layers are trained separately, using instar training and outstar training. The CPN network is good at regression.
  See Also:
    Serialized Form

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `CPN(int theInputCount, int theInstarCount, int theOutstarCount, int theWinnerCount)` Construct the counterpropagation neural network.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `double` | `calculateError(MLDataSet data)` Calculate the error for this neural network.
    `MLData` | `compute(MLData input)` Compute regression.
    `MLData` | `computeInstar(MLData input)` Compute the instar layer.
    `MLData` | `computeOutstar(MLData input)` Compute the outstar layer.
    `int` | `getInputCount()`
    `int` | `getInstarCount()`
    `int` | `getOutputCount()`
    `int` | `getOutstarCount()`
    `Matrix` | `getWeightsInputToInstar()`
    `Matrix` | `getWeightsInstarToOutstar()`
    `int` | `getWinnerCount()`
    `void` | `reset()` Reset the weights.
    `void` | `reset(int seed)` Reset the weights with a seed.
    `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

    - #### CPN

          public CPN(int theInputCount,
             int theInstarCount,
             int theOutstarCount,
             int theWinnerCount)

      Construct the counterpropagation neural network.
      Parameters:
        `theInputCount` - The number of input neurons.
        `theInstarCount` - The number of instar neurons.
        `theOutstarCount` - The number of outstar neurons.
        `theWinnerCount` - The winner count.

  - ### Method Detail

    - #### calculateError

          public double calculateError(MLDataSet data)

      Calculate the error for this neural network.
      Specified by:
        `calculateError` in interface `MLError`
      Parameters:
        `data` - The training set.
      Returns:
        The error percentage.

    - #### compute

          public MLData compute(MLData input)

      Compute regression.
      Specified by:
        `compute` in interface `MLRegression`
      Parameters:
        `input` - The input data.
      Returns:
        The output data.

    - #### computeInstar

          public MLData computeInstar(MLData input)

      Compute the instar layer.
      Parameters:
        `input` - The input.
      Returns:
        The output.

    - #### computeOutstar

          public MLData computeOutstar(MLData input)

      Compute the outstar layer.
      Parameters:
        `input` - The input.
      Returns:
        The output.

    - #### getInputCount

          public int getInputCount()

      Specified by:
        `getInputCount` in interface `MLInput`
      Returns:
        The input.

    - #### getInstarCount

          public int getInstarCount()

      Returns:
        The instar count, same as the input count.

    - #### getOutputCount

          public int getOutputCount()

      Specified by:
        `getOutputCount` in interface `MLOutput`
      Returns:
        The output count.

    - #### getOutstarCount

          public int getOutstarCount()

      Returns:
        The outstar count, same as the output count.

    - #### getWeightsInputToInstar

          public Matrix getWeightsInputToInstar()

      Returns:
        The weights between the input and instar.

    - #### getWeightsInstarToOutstar

          public Matrix getWeightsInstarToOutstar()

      Returns:
        The weights between the instar and outstar.

    - #### getWinnerCount

          public int getWinnerCount()

      Returns:
        The winner count.

    - #### reset

          public void reset()

      Reset the weights.
      Specified by:
        `reset` in interface `MLResettable`

    - #### reset

          public void reset(int seed)

      Reset the weights with a seed.
      Specified by:
        `reset` in interface `MLResettable`
      Parameters:
        `seed` - The seed value.

    - #### 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.