neural.net
Class Layer

java.lang.Object
  extended by neural.net.Layer
All Implemented Interfaces:
java.io.Serializable

public class Layer
extends java.lang.Object
implements java.io.Serializable

Represents a layer of neurons within an Artificial Neural Net

Version:
1.0.0
Author:
Jonathan Reimels
See Also:
Serialized Form

Constructor Summary
Layer(int neuronCount, int inputCountPerNeuron, ActivationFunction activationFunction)
          Constructor
 
Method Summary
 double[] fire(double[] inputs)
          Fire the layer of neurons, loops through each neuron in the layer and fires it
 double[] getLastOutputs()
          Get the output from the last fire()
 Neuron getNeuron(int id)
          Get a specific neuron in the layer
 int getNeuronCount()
          Get number of neurons in the layer
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Layer

public Layer(int neuronCount,
             int inputCountPerNeuron,
             ActivationFunction activationFunction)
Constructor

Parameters:
neuronCount - - number of neurons in the layer
inputCountPerNeuron - - number of inputs for each neuron in the layer
activationFunction - - class implementing ActivationFunction, used to calculate activation value of neuron
Method Detail

getNeuronCount

public int getNeuronCount()
Get number of neurons in the layer

Returns:
neuron count

getNeuron

public Neuron getNeuron(int id)
                 throws java.lang.Exception
Get a specific neuron in the layer

Parameters:
id - - the neuron to get
Returns:
Neuron
Throws:
java.lang.Exception - - throws an exception if id is out of bounds

getLastOutputs

public double[] getLastOutputs()
Get the output from the last fire()

Returns:
last output

fire

public double[] fire(double[] inputs)
              throws java.lang.Exception
Fire the layer of neurons, loops through each neuron in the layer and fires it

Parameters:
inputs - - input to pass to each neuron
Returns:
output from each neuron
Throws:
java.lang.Exception - - throws an exception if inputs length is invalid