org.encog.neural.prune

## Class PruneSelective

- java.lang.Object
- - org.encog.neural.prune.PruneSelective

-     public class PruneSelective
      extends Object

  Prune a neural network selectively. This class allows you to either add or remove neurons from layers of a neural network. You can also randomize or stimulate neurons. No provision is given for removing an entire layer. Removing a layer requires a totally new set of weights between the layers before and after the removed one. This essentially makes any remaining weights useless. At this point you are better off just creating a new network of the desired dimensions.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `PruneSelective(BasicNetwork network)` Construct an object prune the neural network.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `changeNeuronCount(int layer, int neuronCount)` Change the neuron count for the network.
    `double` | `determineNeuronSignificance(int layer, int neuron)` Determine the significance of the neuron.
    `BasicNetwork` | `getNetwork()`
    `void` | `prune(int targetLayer, int neuron)` Prune one of the neurons from this layer.
    `void` | `randomizeNeuron(double low, double high, int targetLayer, int neuron)`
    `void` | `randomizeNeuron(int targetLayer, int neuron)` Assign random values to the network.
    `void` | `stimulateNeuron(double percent, int targetLayer, int neuron)` Stimulate the specified neuron by the specified percent.
    `void` | `stimulateWeakNeurons(int layer, int count, double percent)` Stimulate weaker neurons on a layer.

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

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

- - ### Constructor Detail

    - #### PruneSelective

          public PruneSelective(BasicNetwork network)

      Construct an object prune the neural network.
      Parameters:
        `network` - The network to prune.

  - ### Method Detail

    - #### changeNeuronCount

          public void changeNeuronCount(int layer,
                               int neuronCount)

      Change the neuron count for the network. If the count is increased then a zero-weighted neuron is added, which will not affect the output of the neural network. If the neuron count is decreased, then the weakest neuron will be removed. This method cannot be used to remove a bias neuron.
      Parameters:
        `layer` - The layer to adjust.
        `neuronCount` - The new neuron count for this layer.

    - #### determineNeuronSignificance

          public double determineNeuronSignificance(int layer,
                                           int neuron)

      Determine the significance of the neuron. The higher the return value, the more significant the neuron is.
      Parameters:
        `layer` - The layer to query.
        `neuron` - The neuron to query.
      Returns:
        How significant is this neuron.

    - #### getNetwork

          public BasicNetwork getNetwork()

      Returns:
        The network that is being processed.

    - #### prune

          public void prune(int targetLayer,
                   int neuron)

      Prune one of the neurons from this layer. Remove all entries in this weight matrix and other layers. This method cannot be used to remove a bias neuron.
      Parameters:
        `targetLayer` - The neuron to prune. Zero specifies the first neuron.
        `neuron` - The neuron to prune.

    - #### randomizeNeuron

          public void randomizeNeuron(double low,
                             double high,
                             int targetLayer,
                             int neuron)

      Parameters:
        `low` - The low-end of the range.
        `high` - The high-end of the range.
        `targetLayer` - The target layer.
        `neuron` - The target neuron.

    - #### randomizeNeuron

          public void randomizeNeuron(int targetLayer,
                             int neuron)

      Assign random values to the network. The range will be the min/max of existing neurons.
      Parameters:
        `targetLayer` - The target layer.
        `neuron` - The target neuron.

    - #### stimulateNeuron

          public void stimulateNeuron(double percent,
                             int targetLayer,
                             int neuron)

      Stimulate the specified neuron by the specified percent. This is used to randomize the weights and bias values for weak neurons.
      Parameters:
        `percent` - The percent to randomize by.
        `targetLayer` - The layer that the neuron is on.
        `neuron` - The neuron to randomize.

    - #### stimulateWeakNeurons

          public void stimulateWeakNeurons(int layer,
                                  int count,
                                  double percent)

      Stimulate weaker neurons on a layer. Find the weakest neurons and then randomize them by the specified percent.
      Parameters:
        `layer` - The layer to stimulate.
        `count` - The number of weak neurons to stimulate.
        `percent` - The percent to stimulate by.

Copyright © 2014. All Rights Reserved.