NEATNetwork
org.encog.neural.neat

Class NEATNetwork

  • All Implemented Interfaces:
    Serializable, MLContext, MLError, MLInput, MLInputOutput, MLMethod, MLOutput, MLProperties, MLRegression


    public class NEATNetworkextends BasicMLimplements MLContext, MLRegression, MLError
    Implements a NEAT network as a synapse between two layers. In Encog, a NEAT network is created by using a NEATSynapse between an input and output layer. NEAT networks only have an input and an output layer. There are no actual hidden layers. Rather this synapse will evolve many hidden neurons that have connections that are not easily defined by layers. Connections can be feedforward, recurrent, or self-connected. NEAT networks relieve the programmer of the need to define the hidden layer structure of the neural network. The output from the neural network can be calculated normally or using a snapshot. The snapshot mode is slower, but it can be more accurate. The snapshot handles recurrent layers better, as it takes the time to loop through the network multiple times to "flush out" the recurrent links. NeuroEvolution of Augmenting Topologies (NEAT) is a genetic algorithm for the generation of evolving artificial neural networks. It was developed by Ken Stanley while at The University of Texas at Austin. http://www.cs.ucf.edu/~kstanley/
    See Also:
    Serialized Form
    • Constructor Detail

      • NEATNetwork

        public NEATNetwork()
        Default constructor.
      • NEATNetwork

        public NEATNetwork(int inputCount,           int outputCount,           List<NEATNeuron> neurons,           ActivationFunction activationFunction,           ActivationFunction outputActivationFunction,           int networkDepth)
        Construct a NEAT synapse.
        Parameters:
        inputCount - The number of input neurons.
        outputCount - The number of output neurons.
        neurons - The neurons in this synapse.
        activationFunction - The activation function to use.
        networkDepth - The depth of the network.
      • NEATNetwork

        public NEATNetwork(int inputCount,           int outputCount)
        Construct a NEAT network.
        Parameters:
        inputCount - The input count.
        outputCount - The output count.
    • Method Detail

      • clearContext

        public void clearContext()
        Clear any context from previous runs. This sets the activation of all neurons to zero.
        Specified by:
        clearContext in interface MLContext
      • compute

        public MLData compute(MLData input)
        Compute the output from this synapse.
        Specified by:
        compute in interface MLRegression
        Parameters:
        input - The input to this synapse.
        Returns:
        The output from this synapse.
      • getActivationFunction

        public ActivationFunction getActivationFunction()
        Returns:
        The activation function.
      • getNetworkDepth

        public int getNetworkDepth()
        Returns:
        The network depth.
      • getNeurons

        public List<NEATNeuron> getNeurons()
        Returns:
        The NEAT neurons.
      • isSnapshot

        public boolean isSnapshot()
        Returns:
        True if snapshot is being used.
      • setActivationFunction

        public void setActivationFunction(ActivationFunction activationFunction)
        Set the activation function.
        Parameters:
        activationFunction - The activation function.
      • setSnapshot

        public void setSnapshot(boolean snapshot)
        Sets if snapshot is used.
        Parameters:
        snapshot - True if snapshot is used.
      • getInputCount

        public int getInputCount()
        Specified by:
        getInputCount in interface MLInput
        Returns:
        The input.
      • getOutputCount

        public int getOutputCount()
        Specified by:
        getOutputCount in interface MLOutput
        Returns:
        The output count.
      • setInputCount

        public void setInputCount(int i)
      • setOutputCount

        public void setOutputCount(int i)
      • setNetworkDepth

        public void setNetworkDepth(int i)
      • getOutputActivationFunction

        public ActivationFunction getOutputActivationFunction()
        Returns:
        the outputActivationFunction
      • setOutputActivationFunction

        public void setOutputActivationFunction(ActivationFunction outputActivationFunction)
        Parameters:
        outputActivationFunction - the outputActivationFunction to set
      • 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.

SCaVis 2.1 © jWork.ORG