saaps.ann.mlff
Class Neuron

java.lang.Object
  |
  +--saaps.ann.mlff.Neuron
Direct Known Subclasses:
LinNeuron, TanhNeuron

public abstract class Neuron
extends java.lang.Object

This class represents a neuron. The neuron contains the weights and a bias. The class also contains an abstract method for the transfer function. Thus, the class must be inherited by a subclass that implements the transfer function.

Example:

double[] w = {-0.1,0.3,-0.5};
double b = 0.4;
Weights weights = new Weights(w,b);
TanhNeron myNeuron = new TanhNeuron(weights)

See Also:
TanhNeuron, LinNeuron, Layer, Network

Constructor Summary
Neuron()
          Creates new empty Neuron.
Neuron(Weights w)
          Creates a neuron from a Weights object.
 
Method Summary
 Data getOutput()
          Get the output from the neuron.
 void setInput(Data inp)
          Set the input data to the neuron.
abstract  Data transFun(Data in)
          The transfer function.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Neuron

public Neuron()
Creates new empty Neuron.

Neuron

public Neuron(Weights w)
Creates a neuron from a Weights object.
Parameters:
w - The weights and bias
Method Detail

setInput

public void setInput(Data inp)
Set the input data to the neuron.
Parameters:
inp - The input data

getOutput

public Data getOutput()
Get the output from the neuron.

If new input data has been presented to the neuron then the neuron is first run.

Returns:
The output data

transFun

public abstract Data transFun(Data in)
The transfer function.
Parameters:
in - The data dat goes into the transfer function
Returns:
The output from the tranfer function.