org.encog.neural.networks.structure
Class LayerComparator

java.lang.Object
  extended by org.encog.neural.networks.structure.LayerComparator
All Implemented Interfaces:
Comparator<Layer>

public class LayerComparator
extends Object
implements Comparator<Layer>

Used to compare layers and ensure a consistent sort order.


Constructor Summary
LayerComparator(NeuralStructure structure)
          Construct a level comparator for the specified structure.
 
Method Summary
 int compare(Layer layer1, Layer layer2)
          Compare two layers.
 boolean equal(Layer layer1, Layer layer2)
          Determine if two layers are equal.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface java.util.Comparator
equals
 

Constructor Detail

LayerComparator

public LayerComparator(NeuralStructure structure)
Construct a level comparator for the specified structure.

Parameters:
structure - The structure of the neural network to compare.
Method Detail

compare

public int compare(Layer layer1,
                   Layer layer2)
Compare two layers.

Specified by:
compare in interface Comparator<Layer>
Parameters:
layer1 - The first layer to compare.
layer2 - The second layer to compare.
Returns:
The value 0 if the argument layer is equal to this layer; a value less than 0 if this layer is less than the argument; and a value greater than 0 if this layer is greater than the layer argument.

equal

public boolean equal(Layer layer1,
                     Layer layer2)
Determine if two layers are equal. They are only equal if they have the same weight matrix size.

Parameters:
layer1 - The first layer to compare.
layer2 - The second layer to compare.
Returns:
True if they are equal, false if they are not.


Copyright © 2011. All Rights Reserved.